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 <kees@kernel.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Nathan Chancellor <nathan@kernel.org>
Link: https://lore.kernel.org/r/20250904034656.3670313-1-kees@kernel.org
This commit is contained in:
Kees Cook 2025-09-03 20:46:40 -07:00 committed by Peter Zijlstra
parent 894af4a1cd
commit 038c7dc66e
2 changed files with 3 additions and 6 deletions

View File

@ -96,11 +96,6 @@
# define __noscs __attribute__((__no_sanitize__("shadow-call-stack")))
#endif
#if __has_feature(kcfi)
/* Disable CFI checking inside a function. */
#define __nocfi __attribute__((__no_sanitize__("kcfi")))
#endif
/*
* Turn individual warnings and errors on and off locally, depending
* on version.

View File

@ -432,7 +432,9 @@ struct ftrace_likely_data {
# define __noscs
#endif
#ifndef __nocfi
#if defined(CONFIG_CFI_CLANG)
# define __nocfi __attribute__((__no_sanitize__("kcfi")))
#else
# define __nocfi
#endif