arch/arm/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
When KASAN is enabled, such as with allmodconfig, the build fails when
building the Rust code with:
error: kernel-address sanitizer is not supported for this target
error: aborting due to 1 previous error
make[4]: *** [rust/Makefile:654: rust/core.o] Error 1
The arm-unknown-linux-gnueabi target does not support KASAN, so avoid
saying Rust is supported when it is enabled.
Cc: stable@vger.kernel.org
Fixes: ccb8ce526807 ("ARM: 9441/1: rust: Enable Rust support for ARMv7")
Link: https://github.com/Rust-for-Linux/linux/issues/1234
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
---
arch/arm/Kconfig | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 71fc5dd4123f..73e6647bea46 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -136,7 +136,7 @@ config ARM
select MMU_GATHER_RCU_TABLE_FREE if SMP && ARM_LPAE
select HAVE_REGS_AND_STACK_ACCESS_API
select HAVE_RSEQ
- select HAVE_RUST if CPU_LITTLE_ENDIAN && CPU_32v7
+ select HAVE_RUST if CPU_LITTLE_ENDIAN && CPU_32v7 && !KASAN
select HAVE_STACKPROTECTOR
select HAVE_SYSCALL_TRACEPOINTS
select HAVE_UID16
---
base-commit: 5d6919055dec134de3c40167a490f33c74c12581
change-id: 20260511-arm-avoid-rust-with-kasan-7670981ef8b5
Best regards,
--
Cheers,
Nathan
On Mon, May 11, 2026 at 10:02 AM Nathan Chancellor <nathan@kernel.org> wrote:
>
> When KASAN is enabled, such as with allmodconfig, the build fails when
> building the Rust code with:
>
> error: kernel-address sanitizer is not supported for this target
>
> error: aborting due to 1 previous error
>
> make[4]: *** [rust/Makefile:654: rust/core.o] Error 1
>
> The arm-unknown-linux-gnueabi target does not support KASAN, so avoid
> saying Rust is supported when it is enabled.
>
> Cc: stable@vger.kernel.org
> Fixes: ccb8ce526807 ("ARM: 9441/1: rust: Enable Rust support for ARMv7")
> Link: https://github.com/Rust-for-Linux/linux/issues/1234
> Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Applied to `rust-fixes` -- thanks everyone!
Cheers,
Miguel
On 5/11/26 10:02 AM, Nathan Chancellor wrote:
> When KASAN is enabled, such as with allmodconfig, the build fails when
> building the Rust code with:
>
> error: kernel-address sanitizer is not supported for this target
>
> error: aborting due to 1 previous error
>
> make[4]: *** [rust/Makefile:654: rust/core.o] Error 1
>
> The arm-unknown-linux-gnueabi target does not support KASAN, so avoid
> saying Rust is supported when it is enabled.
>
> Cc: stable@vger.kernel.org
> Fixes: ccb8ce526807 ("ARM: 9441/1: rust: Enable Rust support for ARMv7")
> Link: https://github.com/Rust-for-Linux/linux/issues/1234
> Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Seems fine to me either like this or as Alice mentioned in another reply.
Reviewed-by: Christian Schrefl <chrisi.schrefl@gmail.com>
Cheers,
Christian
On Mon, May 11, 2026 at 05:02:44PM +0900, Nathan Chancellor wrote:
> When KASAN is enabled, such as with allmodconfig, the build fails when
> building the Rust code with:
>
> error: kernel-address sanitizer is not supported for this target
>
> error: aborting due to 1 previous error
>
> make[4]: *** [rust/Makefile:654: rust/core.o] Error 1
>
> The arm-unknown-linux-gnueabi target does not support KASAN, so avoid
> saying Rust is supported when it is enabled.
>
> Cc: stable@vger.kernel.org
> Fixes: ccb8ce526807 ("ARM: 9441/1: rust: Enable Rust support for ARMv7")
> Link: https://github.com/Rust-for-Linux/linux/issues/1234
> Signed-off-by: Nathan Chancellor <nathan@kernel.org>
I would probably suggest moving the conditions out to a separate
RUSTC_SUPPORTS_ARM config option similar to what I did in commit
d077242d68a3 ("rust: support for shadow call stack sanitizer").
This way it will be simpler to adjust this logic when the target obtains
support for this sanitizer.
Also, we may need the same change for CONFIG_CFI too.
Alice
On Mon, May 11, 2026 at 08:21:48AM +0000, Alice Ryhl wrote:
> On Mon, May 11, 2026 at 05:02:44PM +0900, Nathan Chancellor wrote:
> > When KASAN is enabled, such as with allmodconfig, the build fails when
> > building the Rust code with:
> >
> > error: kernel-address sanitizer is not supported for this target
> >
> > error: aborting due to 1 previous error
> >
> > make[4]: *** [rust/Makefile:654: rust/core.o] Error 1
> >
> > The arm-unknown-linux-gnueabi target does not support KASAN, so avoid
> > saying Rust is supported when it is enabled.
> >
> > Cc: stable@vger.kernel.org
> > Fixes: ccb8ce526807 ("ARM: 9441/1: rust: Enable Rust support for ARMv7")
> > Link: https://github.com/Rust-for-Linux/linux/issues/1234
> > Signed-off-by: Nathan Chancellor <nathan@kernel.org>
>
> I would probably suggest moving the conditions out to a separate
> RUSTC_SUPPORTS_ARM config option similar to what I did in commit
> d077242d68a3 ("rust: support for shadow call stack sanitizer").
>
> This way it will be simpler to adjust this logic when the target obtains
> support for this sanitizer.
Sure, I kept it simple for backporting purposes but I don't mind
breaking out the dependencies into their own symbol, even though it
feels like that could be done when support for the sanitizer is
re-enabled, which would truly mirror what you did. No strong opinion
though, so I will send a v2 after giving some time for other comments.
> Also, we may need the same change for CONFIG_CFI too.
I think the dependencies of HAVE_CFI_ICALL_NORMALIZE_INTEGERS_RUSTC
prevent RUST from being selected when CFI is enabled for ARM, so I don't
think there is a problem there.
--
Cheers,
Nathan
On Mon, May 11, 2026 at 11:09 AM Nathan Chancellor <nathan@kernel.org> wrote: > > Sure, I kept it simple for backporting purposes but I don't mind > breaking out the dependencies into their own symbol, even though it > feels like that could be done when support for the sanitizer is > re-enabled, which would truly mirror what you did. No strong opinion > though, so I will send a v2 after giving some time for other comments. I think it is fine either way, especially for a fix, but up to the KASAN/arm maintainers of course. Thanks for the patch! If KASAN or arm maintainers want to pick it up: Acked-by: Miguel Ojeda <ojeda@kernel.org> Otherwise I can send it in a fixes PR I will likely need to send later this cycle, so please let me know! Cheers, Miguel
On Mon, May 11, 2026 at 11:58:42AM +0200, Miguel Ojeda wrote: > On Mon, May 11, 2026 at 11:09 AM Nathan Chancellor <nathan@kernel.org> wrote: > > > > Sure, I kept it simple for backporting purposes but I don't mind > > breaking out the dependencies into their own symbol, even though it > > feels like that could be done when support for the sanitizer is > > re-enabled, which would truly mirror what you did. No strong opinion > > though, so I will send a v2 after giving some time for other comments. > > I think it is fine either way, especially for a fix, but up to the > KASAN/arm maintainers of course. > > Thanks for the patch! > > If KASAN or arm maintainers want to pick it up: > > Acked-by: Miguel Ojeda <ojeda@kernel.org> > > Otherwise I can send it in a fixes PR I will likely need to send later > this cycle, so please let me know! FWIW, I think Russell has been away dealing with personal stuff recently: https://lore.kernel.org/aeDSTIS9-TDSihbX@shell.armlinux.org.uk/ So I doubt he would fight you taking it, given that it is Rust related. I am rather selfishly motivated to have it picked up and merged because I have to remember to pass KCONFIG_ALLCONFIG=<(echo CONFIG_RUST=n) every time that I have to test arm allmodconfig. But don't feel rushed to pick it up if you want to wait for a formal agreement on the path forward. -- Cheers, Nathan
On Thu, May 14, 2026 at 2:35 PM Nathan Chancellor <nathan@kernel.org> wrote: > > FWIW, I think Russell has been away dealing with personal stuff > recently: > > https://lore.kernel.org/aeDSTIS9-TDSihbX@shell.armlinux.org.uk/ > > So I doubt he would fight you taking it, given that it is Rust related. > I am rather selfishly motivated to have it picked up and merged because > I have to remember to pass KCONFIG_ALLCONFIG=<(echo CONFIG_RUST=n) every > time that I have to test arm allmodconfig. But don't feel rushed to pick > it up if you want to wait for a formal agreement on the path forward. Thanks for the context -- in that case, yeah, I will apply it to avoid you (and others) further trouble. If someone shouts I can take it out. Cheers, Miguel
© 2016 - 2026 Red Hat, Inc.