From c68cef9048e96af1211a57bd7a5f6ca6efdfc7b2 Mon Sep 17 00:00:00 2001 From: Sedat Dilek Date: Fri, 25 May 2018 09:40:07 +0200 Subject: [PATCH 1/2] compiler-clang.h: Add no_stack_protector function attribute support From [1]: "Clang supports the __attribute__((no_stack_protector)) attribute which disables the stack protector on the specified function. This attribute is useful for selectively disabling the stack protector on some functions when building with -fstack-protector compiler option." This is needed to mark native_save_fl() with __nostackprotector attribute to fix a bug in the x86/paravirt/stackprotector area with Clang (see [2] and [3]). NOTE: Clang-7 (>= svn331925) supports no_stack_protector function attribute. [1] https://clang.llvm.org/docs/AttributeReference.html#no-stack-protector-clang-no-stack-protector-clang-no-stack-protector [2] https://bugs.llvm.org/show_bug.cgi?id=37512 [3] https://github.com/ClangBuiltLinux/linux/issues/16 --- include/linux/compiler-clang.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/include/linux/compiler-clang.h b/include/linux/compiler-clang.h index 070f85d92c15..5f49ff0bf7ee 100644 --- a/include/linux/compiler-clang.h +++ b/include/linux/compiler-clang.h @@ -21,3 +21,9 @@ #ifdef __noretpoline #undef __noretpoline #endif + +/* Clang-7 (>= svn331925) supports no_stack_protector function attribute. */ +#ifdef __nostackprotector +#undef __nostackprotector +#define __nostackprotector __attribute__((no_stack_protector)) +#endif -- 2.17.0