Meet compiled kernel binaray abnormal issue while enabling generic kasan in kernel 6.12 with some default KBUILD_RUSTFLAGS on

Miguel Ojeda ojeda at kernel.org
Mon Jul 14 13:04:30 PDT 2025


On Mon, 14 Jul 2025 03:12:33 +0000 "刘海燕 (Haiyan Liu)" <haiyan.liu at unisoc.com> wrote:
>
> After I delete the rust build flags, the asan.module_ctor binary is right and kasan feature works fine.Could you help check why KBUILD_RUSTFLAGS impacts kernel complication with kasan feature enabled and how can this issue fixed?

I assume Rust is enabled in that kernel, right? Or do you mean that somehow removing those lines from the `Makefile` makes the issue go away even if Rust is not enabled?

Could you please share your kernel commit and the full configuration? From a quick build arm64 KASAN in v6.12.38, I see the `paciasp`/`autiasp` pair in one of the Rust object files:

    0000000000000000 <asan.module_ctor>:
           0: d503233f     	paciasp
           4: f81f0ffe     	str	x30, [sp, #-0x10]!
           8: 90000000     	adrp	x0, 0x0 <asan.module_ctor>
           c: 91000000     	add	x0, x0, #0x0
          10: 52800601     	mov	w1, #0x30               // =48
          14: 94000000     	bl	0x14 <asan.module_ctor+0x14>
          18: f84107fe     	ldr	x30, [sp], #0x10
          1c: d50323bf     	autiasp
          20: d65f03c0     	ret

But I am definitely not an expert at all in this, so Cc'ing KASAN and Android maintainers: https://lore.kernel.org/rust-for-linux/4c459085b9ae42bdbf99b6014952b965@BJMBX01.spreadtrum.com/

Cheers,
Miguel



More information about the linux-arm-kernel mailing list