Skip to content

Commit eb73876

Browse files
melverKAGA-KOKO
authored andcommitted
compiler.h: Move function attributes to compiler_types.h
Cleanup and move the KASAN and KCSAN related function attributes to compiler_types.h, where the rest of the same kind live. No functional change intended. 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/[email protected]
1 parent 95c094f commit eb73876

File tree

2 files changed

+29
-29
lines changed

2 files changed

+29
-29
lines changed

include/linux/compiler.h

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -303,35 +303,6 @@ do { \
303303
__WRITE_ONCE(x, val); \
304304
} while (0)
305305

306-
#ifdef CONFIG_KASAN
307-
/*
308-
* We can't declare function 'inline' because __no_sanitize_address conflicts
309-
* with inlining. Attempt to inline it may cause a build failure.
310-
* https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67368
311-
* '__maybe_unused' allows us to avoid defined-but-not-used warnings.
312-
*/
313-
# define __no_kasan_or_inline __no_sanitize_address notrace __maybe_unused
314-
# define __no_sanitize_or_inline __no_kasan_or_inline
315-
#else
316-
# define __no_kasan_or_inline __always_inline
317-
#endif
318-
319-
#define __no_kcsan __no_sanitize_thread
320-
#ifdef __SANITIZE_THREAD__
321-
/*
322-
* Rely on __SANITIZE_THREAD__ instead of CONFIG_KCSAN, to avoid not inlining in
323-
* compilation units where instrumentation is disabled.
324-
*/
325-
# define __no_kcsan_or_inline __no_kcsan notrace __maybe_unused
326-
# define __no_sanitize_or_inline __no_kcsan_or_inline
327-
#else
328-
# define __no_kcsan_or_inline __always_inline
329-
#endif
330-
331-
#ifndef __no_sanitize_or_inline
332-
#define __no_sanitize_or_inline __always_inline
333-
#endif
334-
335306
static __no_sanitize_or_inline
336307
unsigned long __read_once_word_nocheck(const void *addr)
337308
{

include/linux/compiler_types.h

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,35 @@ struct ftrace_likely_data {
171171
*/
172172
#define noinline_for_stack noinline
173173

174+
#ifdef CONFIG_KASAN
175+
/*
176+
* We can't declare function 'inline' because __no_sanitize_address conflicts
177+
* with inlining. Attempt to inline it may cause a build failure.
178+
* https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67368
179+
* '__maybe_unused' allows us to avoid defined-but-not-used warnings.
180+
*/
181+
# define __no_kasan_or_inline __no_sanitize_address notrace __maybe_unused
182+
# define __no_sanitize_or_inline __no_kasan_or_inline
183+
#else
184+
# define __no_kasan_or_inline __always_inline
185+
#endif
186+
187+
#define __no_kcsan __no_sanitize_thread
188+
#ifdef __SANITIZE_THREAD__
189+
/*
190+
* Rely on __SANITIZE_THREAD__ instead of CONFIG_KCSAN, to avoid not inlining in
191+
* compilation units where instrumentation is disabled.
192+
*/
193+
# define __no_kcsan_or_inline __no_kcsan notrace __maybe_unused
194+
# define __no_sanitize_or_inline __no_kcsan_or_inline
195+
#else
196+
# define __no_kcsan_or_inline __always_inline
197+
#endif
198+
199+
#ifndef __no_sanitize_or_inline
200+
#define __no_sanitize_or_inline __always_inline
201+
#endif
202+
174203
#endif /* __KERNEL__ */
175204

176205
#endif /* __ASSEMBLY__ */

0 commit comments

Comments
 (0)