[PATCH v1] rust: cfi: only 64-bit arm and x86 support CFI_CLANG

Conor Dooley conor at kernel.org
Fri Oct 3 15:07:02 PDT 2025


On Mon, Sep 08, 2025 at 04:36:09PM +0200, Miguel Ojeda wrote:
> On Mon, Sep 8, 2025 at 3:13 PM Conor Dooley <conor at kernel.org> wrote:
> >
> > From: Conor Dooley <conor.dooley at microchip.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 at vger.kernel.org
> > Fixes: ca627e636551e ("rust: cfi: add support for CFI_CLANG with Rust")
> > Signed-off-by: Conor Dooley <conor.dooley at microchip.com>
> 
> If you are taking this through RISC-V:
> 
> Acked-by: Miguel Ojeda <ojeda at kernel.org>

Hopefully someone can take it! I was hoping it'd be 6.18 material, can
someone grab it for fixes please?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 228 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-riscv/attachments/20251003/41750d5f/attachment.sig>


More information about the linux-riscv mailing list