Skip to content

Commit 038c7dc

Browse files
keesPeter Zijlstra
authored andcommitted
compiler_types.h: Move __nocfi out of compiler-specific header
Prepare for GCC KCFI support and move the __nocfi attribute from compiler-clang.h to compiler_types.h. This was already gated by CONFIG_CFI_CLANG, so this remains safe for non-KCFI GCC builds. Signed-off-by: Kees Cook <[email protected]> Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Reviewed-by: Nathan Chancellor <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 894af4a commit 038c7dc

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

include/linux/compiler-clang.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -96,11 +96,6 @@
9696
# define __noscs __attribute__((__no_sanitize__("shadow-call-stack")))
9797
#endif
9898

99-
#if __has_feature(kcfi)
100-
/* Disable CFI checking inside a function. */
101-
#define __nocfi __attribute__((__no_sanitize__("kcfi")))
102-
#endif
103-
10499
/*
105100
* Turn individual warnings and errors on and off locally, depending
106101
* on version.

include/linux/compiler_types.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,9 @@ struct ftrace_likely_data {
432432
# define __noscs
433433
#endif
434434

435-
#ifndef __nocfi
435+
#if defined(CONFIG_CFI_CLANG)
436+
# define __nocfi __attribute__((__no_sanitize__("kcfi")))
437+
#else
436438
# define __nocfi
437439
#endif
438440

0 commit comments

Comments
 (0)