Skip to content

Commit e3b779d

Browse files
melverKAGA-KOKO
authored andcommitted
kcsan: Remove 'noinline' from __no_kcsan_or_inline
Some compilers incorrectly inline small __no_kcsan functions, which then results in instrumenting the accesses. For this reason, the 'noinline' attribute was added to __no_kcsan_or_inline. All known versions of GCC are affected by this. Supported versions of Clang are unaffected, and never inline a no_sanitize function. However, the attribute 'noinline' in __no_kcsan_or_inline causes unexpected code generation in functions that are __no_kcsan and call a __no_kcsan_or_inline function. In certain situations it is expected that the __no_kcsan_or_inline function is actually inlined by the __no_kcsan function, and *no* calls are emitted. By removing the 'noinline' attribute, give the compiler the ability to inline and generate the expected code in __no_kcsan functions. Signed-off-by: Marco Elver <[email protected]> Signed-off-by: Borislav Petkov <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Acked-by: Peter Zijlstra (Intel) <[email protected]> Acked-by: Will Deacon <[email protected]> Link: https://lkml.kernel.org/r/CANpmjNNOpJk0tprXKB_deiNAv_UmmORf1-2uajLhnLWQQ1hvoA@mail.gmail.com Link: https://lkml.kernel.org/r/[email protected]
1 parent d31d4d6 commit e3b779d

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

include/linux/compiler.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -329,11 +329,9 @@ do { \
329329
#ifdef __SANITIZE_THREAD__
330330
/*
331331
* Rely on __SANITIZE_THREAD__ instead of CONFIG_KCSAN, to avoid not inlining in
332-
* compilation units where instrumentation is disabled. The attribute 'noinline'
333-
* is required for older compilers, where implicit inlining of very small
334-
* functions renders __no_sanitize_thread ineffective.
332+
* compilation units where instrumentation is disabled.
335333
*/
336-
# define __no_kcsan_or_inline __no_kcsan noinline notrace __maybe_unused
334+
# define __no_kcsan_or_inline __no_kcsan notrace __maybe_unused
337335
# define __no_sanitize_or_inline __no_kcsan_or_inline
338336
#else
339337
# define __no_kcsan_or_inline __always_inline

0 commit comments

Comments
 (0)