[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250904182829.GA2110053@ax162>
Date: Thu, 4 Sep 2025 11:28:29 -0700
From: Nathan Chancellor <nathan@...nel.org>
To: Kees Cook <kees@...nel.org>
Cc: Peter Zijlstra <peterz@...radead.org>,
Nick Desaulniers <nick.desaulniers+lkml@...il.com>,
Bill Wendling <morbo@...gle.com>,
Justin Stitt <justinstitt@...gle.com>,
Miguel Ojeda <ojeda@...nel.org>, Marco Elver <elver@...gle.com>,
Przemek Kitszel <przemyslaw.kitszel@...el.com>,
Ramon de C Valle <rcvalle@...gle.com>, llvm@...ts.linux.dev,
Vegard Nossum <vegard.nossum@...cle.com>,
Linus Walleij <linus.walleij@...aro.org>,
Jeff Johnson <jeff.johnson@....qualcomm.com>,
Randy Dunlap <rdunlap@...radead.org>,
David Woodhouse <dwmw2@...radead.org>,
"Russell King (Oracle)" <rmk+kernel@...linux.org.uk>,
Jonathan Corbet <corbet@....net>,
"Paul E. McKenney" <paulmck@...nel.org>,
Nicolas Schier <nicolas.schier@...ux.dev>,
Masahiro Yamada <masahiroy@...nel.org>,
Arnd Bergmann <arnd@...db.de>,
Krzysztof Kozlowski <krzysztof.kozlowski@...aro.org>,
Sami Tolvanen <samitolvanen@...gle.com>,
Mark Rutland <mark.rutland@....com>, linux-kernel@...r.kernel.org,
linux-doc@...r.kernel.org, linux-kbuild@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org, x86@...nel.org,
linux-hardening@...r.kernel.org
Subject: Re: [PATCH v2 1/9] compiler_types.h: Move __nocfi out of
compiler-specific header
On Wed, Sep 03, 2025 at 08:46:40PM -0700, Kees Cook wrote:
> 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@...nel.org>
> ---
I reviewed this on v1:
https://lore.kernel.org/20250827194657.GA3572128@ax162/
but just to make sure it sticks :)
Reviewed-by: Nathan Chancellor <nathan@...nel.org>
> ---
> include/linux/compiler-clang.h | 5 -----
> include/linux/compiler_types.h | 4 +++-
> 2 files changed, 3 insertions(+), 6 deletions(-)
>
> diff --git a/include/linux/compiler-clang.h b/include/linux/compiler-clang.h
> index fa4ffe037bc7..7a4568e421dc 100644
> --- a/include/linux/compiler-clang.h
> +++ b/include/linux/compiler-clang.h
> @@ -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.
> diff --git a/include/linux/compiler_types.h b/include/linux/compiler_types.h
> index 16755431fc11..a910f9fa5341 100644
> --- a/include/linux/compiler_types.h
> +++ b/include/linux/compiler_types.h
> @@ -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
>
> --
> 2.34.1
>
Powered by blists - more mailing lists