lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250908-distill-lint-1ae78bcf777c@spud>
Date: Mon,  8 Sep 2025 14:12:35 +0100
From: Conor Dooley <conor@...nel.org>
To: linux-kernel@...r.kernel.org
Cc: conor@...nel.org,
	Conor Dooley <conor.dooley@...rochip.com>,
	stable@...r.kernel.org,
	Paul Walmsley <paul.walmsley@...ive.com>,
	Palmer Dabbelt <palmer@...belt.com>,
	Alexandre Ghiti <alex@...ti.fr>,
	Miguel Ojeda <ojeda@...nel.org>,
	Alex Gaynor <alex.gaynor@...il.com>,
	Boqun Feng <boqun.feng@...il.com>,
	Gary Guo <gary@...yguo.net>,
	Björn Roy Baron <bjorn3_gh@...tonmail.com>,
	Benno Lossin <lossin@...nel.org>,
	Andreas Hindborg <a.hindborg@...nel.org>,
	Alice Ryhl <aliceryhl@...gle.com>,
	Trevor Gross <tmgross@...ch.edu>,
	Danilo Krummrich <dakr@...nel.org>,
	Kees Cook <kees@...nel.org>,
	Sami Tolvanen <samitolvanen@...gle.com>,
	Matthew Maurer <mmaurer@...gle.com>,
	"Peter Zijlstra (Intel)" <peterz@...radead.org>,
	linux-riscv@...ts.infradead.org,
	rust-for-linux@...r.kernel.org
Subject: [PATCH v1] rust: cfi: only 64-bit arm and x86 support CFI_CLANG

From: Conor Dooley <conor.dooley@...rochip.com>

The kernel uses the standard rustc targets for non-x86 targets, and out
of those only 64-bit arm's target has kcfi support enabled. For x86, the
custom 64-bit target enables kcfi.

The HAVE_CFI_ICALL_NORMALIZE_INTEGERS_RUSTC config option that allows
CFI_CLANG to be used in combination with RUST does not check whether the
rustc target supports kcfi. This breaks the build on riscv (and
presumably 32-bit arm) when CFI_CLANG and RUST are enabled at the same
time.

Ordinarily, a rustc-option check would be used to detect target support
but unfortunately rustc-option filters out the target for reasons given
in commit 46e24a545cdb4 ("rust: kasan/kbuild: fix missing flags on first
build"). As a result, if the host supports kcfi but the target does not,
e.g. when building for riscv on x86_64, the build would remain broken.

Instead, make HAVE_CFI_ICALL_NORMALIZE_INTEGERS_RUSTC depend on the only
two architectures where the target used supports it to fix the build.

CC: stable@...r.kernel.org
Fixes: ca627e636551e ("rust: cfi: add support for CFI_CLANG with Rust")
Signed-off-by: Conor Dooley <conor.dooley@...rochip.com>
---
CC: Paul Walmsley <paul.walmsley@...ive.com>
CC: Palmer Dabbelt <palmer@...belt.com>
CC: Alexandre Ghiti <alex@...ti.fr>
CC: Miguel Ojeda <ojeda@...nel.org>
CC: Alex Gaynor <alex.gaynor@...il.com>
CC: Boqun Feng <boqun.feng@...il.com>
CC: Gary Guo <gary@...yguo.net>
CC: "Björn Roy Baron" <bjorn3_gh@...tonmail.com>
CC: Benno Lossin <lossin@...nel.org>
CC: Andreas Hindborg <a.hindborg@...nel.org>
CC: Alice Ryhl <aliceryhl@...gle.com>
CC: Trevor Gross <tmgross@...ch.edu>
CC: Danilo Krummrich <dakr@...nel.org>
CC: Kees Cook <kees@...nel.org>
CC: Sami Tolvanen <samitolvanen@...gle.com>
CC: Matthew Maurer <mmaurer@...gle.com>
CC: "Peter Zijlstra (Intel)" <peterz@...radead.org>
CC: linux-kernel@...r.kernel.org
CC: linux-riscv@...ts.infradead.org
CC: rust-for-linux@...r.kernel.org
---
 arch/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/Kconfig b/arch/Kconfig
index d1b4ffd6e0856..880cddff5eda7 100644
--- a/arch/Kconfig
+++ b/arch/Kconfig
@@ -917,6 +917,7 @@ config HAVE_CFI_ICALL_NORMALIZE_INTEGERS_RUSTC
 	def_bool y
 	depends on HAVE_CFI_ICALL_NORMALIZE_INTEGERS_CLANG
 	depends on RUSTC_VERSION >= 107900
+	depends on ARM64 || X86_64
 	# With GCOV/KASAN we need this fix: https://github.com/rust-lang/rust/pull/129373
 	depends on (RUSTC_LLVM_VERSION >= 190103 && RUSTC_VERSION >= 108200) || \
 		(!GCOV_KERNEL && !KASAN_GENERIC && !KASAN_SW_TAGS)
-- 
2.47.2


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ