Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 93e34a0

Browse files
Darksonnojeda
authored andcommittedSep 26, 2024
rust: KASAN+RETHUNK requires rustc 1.83.0
When enabling both KASAN and RETHUNK, objtool emits the following warnings: rust/core.o: warning: objtool: asan.module_ctor+0x13: 'naked' return found in MITIGATION_RETHUNK build rust/core.o: warning: objtool: asan.module_dtor+0x13: 'naked' return found in MITIGATION_RETHUNK build This is caused by the -Zfunction-return=thunk-extern flag in rustc not informing LLVM about the mitigation at the module level (it does so at the function level only currently, which covers most cases, but both are required), which means that the KASAN functions asan.module_ctor and asan.module_dtor are generated without the rethunk mitigation. The other mitigations that we enabled for Rust (SLS, RETPOLINE) do not have the same bug, as they're being applied through the target-feature functionality instead. This is being fixed for rustc 1.83.0, so update Kconfig to reject this configuration on older compilers. Link: rust-lang/rust#130824 Fixes: d786855 ("x86/rust: support MITIGATION_RETHUNK") Reported-by: Miguel Ojeda <ojeda@kernel.org> Closes: https://lore.kernel.org/all/CANiq72myZL4_poCMuNFevtpYYc0V0embjSuKb7y=C+m3vVA_8g@mail.gmail.com/ Signed-off-by: Alice Ryhl <aliceryhl@google.com> Link: https://lore.kernel.org/r/20240926093849.1192264-1-aliceryhl@google.com [ Reworded to add the details mentioned in the list. - Miguel ] Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
1 parent af6017b commit 93e34a0

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed
 

‎init/Kconfig

+1
Original file line numberDiff line numberDiff line change
@@ -1950,6 +1950,7 @@ config RUST
19501950
select CFI_ICALL_NORMALIZE_INTEGERS if CFI_CLANG
19511951
depends on !CALL_PADDING || RUSTC_VERSION >= 108100
19521952
depends on !KASAN_SW_TAGS
1953+
depends on !(MITIGATION_RETHUNK && KASAN) || RUSTC_VERSION >= 108300
19531954
help
19541955
Enables Rust support in the kernel.
19551956

0 commit comments

Comments
 (0)
Failed to load comments.