archive mirror
 help / color / mirror / Atom feed
From: Nathan Chancellor <>
To: Catalin Marinas <>, Will Deacon <>
Cc: Nick Desaulniers <>,,,,
	Nathan Chancellor <>
Subject: [PATCH v2] arm64: Restrict ARM64_BTI_KERNEL to clang 12.0.0 and newer
Date: Mon, 12 Jul 2021 14:46:37 -0700	[thread overview]
Message-ID: <> (raw)
In-Reply-To: <>

Commit 97fed779f2a6 ("arm64: bti: Provide Kconfig for kernel mode BTI")
disabled CONFIG_ARM64_BTI_KERNEL when CONFIG_GCOV_KERNEL was enabled and
compiling with clang because of warnings that were seen with
allmodconfig because LLVM was not emitting PAC/BTI instructions for
compiler generated functions:

warning: some functions compiled with BTI and some compiled without BTI
warning: not setting BTI in feature flags

This depedency was fine for avoiding the warnings with allmodconfig
until commit 51c2ee6d121c ("Kconfig: Introduce ARCH_WANTS_NO_INSTR and
being enabled with clang 12.0.0 or older because those versions do not
support the no_profile_instrument_function attribute.

As a result, CONFIG_ARM64_BTI_KERNEL gets enabled with allmodconfig and
there are more warnings like the ones above due to CONFIG_KASAN, which
suffers from the same problem as CONFIG_GCOV_KERNEL. This was most
likely not noticed at the time because allmodconfig +
CONFIG_GCOV_KERNEL=n was not tested. defconfig + CONFIG_KASAN=y is
enough to reproduce the same warnings as above.

The root cause of the warnings was resolved in LLVM during the 12.0.0
release so rather than play whack-a-mole with the dependencies, just
update CONFIG_ARM64_BTI_KERNEL to require clang 12.0.0, which will have
all of the issues ironed out.

Signed-off-by: Nathan Chancellor <>

v1 -> v2:

* Fix typo ("compilign" to "compiling") per Will.

* Clarify that these warnings are reproducible back at the time of
  97fed779f2a6 with allmodconfig + CONFIG_GCOV_KERNEL=n but that
  configuration was most likely not tested.

* Clarify that the warnings come from CONFIG_KASAN, which suffers from
  the same issue at CONFIG_GCOV_KERNEL because there are compiler
  generated functions.

* Clarify that the root cause of the warnings is resolved in 12.0.0 and
  link to the GitHub commit rather than the Phabricator instance, in
  case LLVM moves to GitHub reviews in the future.

Hopefully this is adequate explanation for what is going on, thanks to
Will and Nick for providing input on the commit message.

 arch/arm64/Kconfig | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index e07e7de9ac49..b5b13a932561 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -1605,7 +1605,8 @@ config ARM64_BTI_KERNEL
 	depends on !CC_IS_GCC || GCC_VERSION >= 100100
-	depends on !(CC_IS_CLANG && GCOV_KERNEL)
+	#
+	depends on !CC_IS_CLANG || CLANG_VERSION >= 120000
 	  Build the kernel with Branch Target Identification annotations

base-commit: e73f0f0ee7541171d89f2e2491130c7771ba58d3

  parent reply	other threads:[~2021-07-12 21:51 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-09  0:06 [PATCH] " Nathan Chancellor
2021-07-12 12:24 ` Will Deacon
2021-07-12 17:04   ` Nick Desaulniers
2021-07-12 21:46 ` Nathan Chancellor [this message]
2021-07-12 23:15   ` [PATCH v2] " Nick Desaulniers
2021-07-13 18:08   ` Will Deacon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \ \ \ \ \ \
    --subject='Re: [PATCH v2] arm64: Restrict ARM64_BTI_KERNEL to clang 12.0.0 and newer' \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
on how to clone and mirror all data and code used for this inbox