[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAK7LNAQoJWUscyxXVnOQ9924MYZwaZGgfBYSzmjJxKH_UC0Pkw@mail.gmail.com>
Date: Sat, 2 Apr 2022 22:31:03 +0900
From: Masahiro Yamada <masahiroy@...nel.org>
To: Sami Tolvanen <samitolvanen@...gle.com>
Cc: Kees Cook <keescook@...omium.org>,
Catalin Marinas <catalin.marinas@....com>,
Mark Rutland <mark.rutland@....com>,
Nathan Chancellor <nathan@...nel.org>,
Nick Desaulniers <ndesaulniers@...gle.com>,
Will Deacon <will@...nel.org>,
linux-arm-kernel <linux-arm-kernel@...ts.infradead.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
llvm@...ts.linux.dev
Subject: Re: [PATCH 1/3] kbuild: Change CFI_CLANG to depend on __builtin_function_start
On Sat, Apr 2, 2022 at 5:19 AM Sami Tolvanen <samitolvanen@...gle.com> wrote:
>
> Clang 14 added support for the __builtin_function_start()
> built-in function, which allows us to implement function_nocfi()
> without architecture-specific inline assembly. This patch changes
> CONFIG_CFI_CLANG to depend on the built-in and effectively upgrades
> the minimum supported compiler version for CFI to Clang 14.
>From this description, I think the straight-forward change would be:
depends on CLANG_VERSION >= 120000
-->
depends on CLANG_VERSION >= 140000
Any reason to avoid this?
>
> Signed-off-by: Sami Tolvanen <samitolvanen@...gle.com>
> ---
> arch/Kconfig | 5 +----
> init/Kconfig | 3 +++
> 2 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/arch/Kconfig b/arch/Kconfig
> index 29b0167c088b..eecfc2809781 100644
> --- a/arch/Kconfig
> +++ b/arch/Kconfig
> @@ -723,10 +723,7 @@ config ARCH_SUPPORTS_CFI_CLANG
> config CFI_CLANG
> bool "Use Clang's Control Flow Integrity (CFI)"
> depends on LTO_CLANG && ARCH_SUPPORTS_CFI_CLANG
> - # Clang >= 12:
> - # - https://bugs.llvm.org/show_bug.cgi?id=46258
> - # - https://bugs.llvm.org/show_bug.cgi?id=47479
> - depends on CLANG_VERSION >= 120000
> + depends on CC_HAS_BUILTIN_FUNCTION_START
> select KALLSYMS
> help
> This option enables Clang’s forward-edge Control Flow Integrity
> diff --git a/init/Kconfig b/init/Kconfig
> index ddcbefe535e9..f024fd353373 100644
> --- a/init/Kconfig
> +++ b/init/Kconfig
> @@ -86,6 +86,9 @@ config CC_HAS_ASM_INLINE
> config CC_HAS_NO_PROFILE_FN_ATTR
> def_bool $(success,echo '__attribute__((no_profile_instrument_function)) int x();' | $(CC) -x c - -c -o /dev/null -Werror)
>
> +config CC_HAS_BUILTIN_FUNCTION_START
> + def_bool $(success,echo 'void f(void) {}; void *p = __builtin_function_start(f);' | $(CC) -x c - -c -o /dev/null)
> +
> config PAHOLE_VERSION
> int
> default $(shell,$(srctree)/scripts/pahole-version.sh $(PAHOLE))
> --
> 2.35.0
>
--
Best Regards
Masahiro Yamada
Powered by blists - more mailing lists