From d7d762efb9ccf24409adefbbb0881e9da49b7fac Mon Sep 17 00:00:00 2001 From: Philippe Thierry Date: Fri, 6 Mar 2020 09:47:13 +0100 Subject: [PATCH] [bugfix] fix canary support for functions with ASM inline --- arch/cores/armv7-m/m4_syscall.c | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/arch/cores/armv7-m/m4_syscall.c b/arch/cores/armv7-m/m4_syscall.c index 3e9c727..774272c 100644 --- a/arch/cores/armv7-m/m4_syscall.c +++ b/arch/cores/armv7-m/m4_syscall.c @@ -35,7 +35,7 @@ int _main(uint32_t slot); #pragma clang optimize off /* Well, clang support local stack protection deactivation only since v8 :-/ */ #if __clang_major__ > 7 -#pragma clang attribute push(__attribute__((no_stack_protector)), apply_to = do_starttask) +#pragma clang attribute push(__attribute__((no_stack_protector))) #endif #endif @@ -72,17 +72,6 @@ __IN_SEC_VDSO void __stack_chk_fail(void) }; } -#if __clang__ -#pragma clang optimize on -#if __clang_major__ > 7 -#pragma clang attribute pop -#endif -#endif - -#if __GNUC__ -#pragma GCC pop_options -#endif - /** ** \private ** ISR handler glue. The kernel must set the real handler @ in the @@ -278,3 +267,15 @@ __IN_SEC_VDSO e_syscall_ret do_syscall(e_svc_type svc, __attribute__ ((unused)) return SYS_E_INVAL; } } + +#if __clang__ +#pragma clang optimize on +#if __clang_major__ > 7 +#pragma clang attribute pop +#endif +#endif + +#if __GNUC__ +#pragma GCC pop_options +#endif +