From 2be3d3ef5b92bd30f09a344eb0f8d7f6ac55db7e Mon Sep 17 00:00:00 2001 From: Peter Zijlstra Date: Tue, 2 Jun 2020 18:47:11 +0200 Subject: [PATCH] x86, kcsan: Add __no_kcsan to noinstr commit 5ddbc4082e1072eeeae52ff561a88620a05be08f upstream. Backport summary: for 5.4 kernel fsgsbase support. The 'noinstr' function attribute means no-instrumentation, this should very much include *SAN. Because lots of that is broken at present, only include KCSAN for now, as that is limited to clang11, which has sane function attribute behaviour. Signed-off-by: Peter Zijlstra (Intel) (cherry picked from commit 5ddbc4082e1072eeeae52ff561a88620a05be08f) Signed-off-by: Ethan Zhao --- include/linux/compiler_types.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/include/linux/compiler_types.h b/include/linux/compiler_types.h index b94d08d05..b2e50f7a1 100644 --- a/include/linux/compiler_types.h +++ b/include/linux/compiler_types.h @@ -180,6 +180,10 @@ struct ftrace_likely_data { */ #define noinline_for_stack noinline +/* Section for code which can't be instrumented at all */ +#define noinstr \ + noinline notrace __attribute((__section__(".noinstr.text"))) + #endif /* __KERNEL__ */ #endif /* __ASSEMBLY__ */