Commit-ID: 7375ae3a0b79ea072f4c672039f08f5db633b9e1 Gitweb: http://git.kernel.org/tip/7375ae3a0b79ea072f4c672039f08f5db633b9e1 Author: Tom Lendacky <thomas.lenda...@amd.com> AuthorDate: Mon, 17 Jul 2017 16:10:34 -0500 Committer: Ingo Molnar <mi...@kernel.org> CommitDate: Tue, 18 Jul 2017 20:23:20 +0200
compiler-gcc.h: Introduce __nostackprotector function attribute Create a new function attribute, __nostackprotector, that can used to turn off stack protection on a per function basis. Signed-off-by: Tom Lendacky <thomas.lenda...@amd.com> Reviewed-by: Thomas Gleixner <t...@linutronix.de> Cc: Alexander Potapenko <gli...@google.com> Cc: Andrey Ryabinin <aryabi...@virtuozzo.com> Cc: Andy Lutomirski <l...@kernel.org> Cc: Arnd Bergmann <a...@arndb.de> Cc: Borislav Petkov <b...@alien8.de> Cc: Brijesh Singh <brijesh.si...@amd.com> Cc: Dave Young <dyo...@redhat.com> Cc: Dmitry Vyukov <dvyu...@google.com> Cc: Jonathan Corbet <cor...@lwn.net> Cc: Konrad Rzeszutek Wilk <konrad.w...@oracle.com> Cc: Larry Woodman <lwood...@redhat.com> Cc: Linus Torvalds <torva...@linux-foundation.org> Cc: Matt Fleming <m...@codeblueprint.co.uk> Cc: Michael S. Tsirkin <m...@redhat.com> Cc: Paolo Bonzini <pbonz...@redhat.com> Cc: Peter Zijlstra <pet...@infradead.org> Cc: Radim Krčmář <rkrc...@redhat.com> Cc: Rik van Riel <r...@redhat.com> Cc: Toshimitsu Kani <toshi.k...@hpe.com> Cc: kasan-...@googlegroups.com Cc: k...@vger.kernel.org Cc: linux-a...@vger.kernel.org Cc: linux-...@vger.kernel.org Cc: linux-...@vger.kernel.org Cc: linux...@kvack.org Link: http://lkml.kernel.org/r/0576fd5c74440ad0250f16ac6609ecf587812456.1500319216.git.thomas.lenda...@amd.com Signed-off-by: Ingo Molnar <mi...@kernel.org> --- include/linux/compiler-gcc.h | 2 ++ include/linux/compiler.h | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h index cd4bbe8..c28cedd 100644 --- a/include/linux/compiler-gcc.h +++ b/include/linux/compiler-gcc.h @@ -166,6 +166,8 @@ #if GCC_VERSION >= 40100 # define __compiletime_object_size(obj) __builtin_object_size(obj, 0) + +#define __nostackprotector __attribute__((__optimize__("no-stack-protector"))) #endif #if GCC_VERSION >= 40300 diff --git a/include/linux/compiler.h b/include/linux/compiler.h index 219f82f..3f8c88e 100644 --- a/include/linux/compiler.h +++ b/include/linux/compiler.h @@ -470,6 +470,10 @@ static __always_inline void __write_once_size(volatile void *p, void *res, int s #define __visible #endif +#ifndef __nostackprotector +# define __nostackprotector +#endif + /* * Assume alignment of return value. */