Skip to content

Commit 5708f5f

Browse files
Darksonnintel-lab-lkp
authored andcommitted
rust: kasan: add support for Software Tag-Based KASAN
This adds support for Software Tag-Based KASAN (KASAN_SW_TAGS) when CONFIG_RUST is enabled. This requires that rustc includes support for the kernel-hwaddress sanitizer, which is available since 1.96.0 [1]. Unlike with clang, we need to pass -Zsanitizer-recover in addition to -Zsanitizer because the option is not implied automatically. Link: rust-lang/rust#153049 [1] Reviewed-by: Danilo Krummrich <dakr@kernel.org> Signed-off-by: Alice Ryhl <aliceryhl@google.com>
1 parent 1f318b9 commit 5708f5f

2 files changed

Lines changed: 1 addition & 3 deletions

File tree

init/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2179,7 +2179,7 @@ config RUST
21792179
depends on !CFI || HAVE_CFI_ICALL_NORMALIZE_INTEGERS_RUSTC
21802180
select CFI_ICALL_NORMALIZE_INTEGERS if CFI
21812181
depends on !CALL_PADDING || RUSTC_VERSION >= 108100
2182-
depends on !KASAN_SW_TAGS
2182+
depends on !KASAN_SW_TAGS || RUSTC_VERSION >= 109600
21832183
depends on !(MITIGATION_RETHUNK && KASAN) || RUSTC_VERSION >= 108300
21842184
help
21852185
Enables Rust support in the kernel.

scripts/Makefile.kasan

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,6 @@ ifdef CONFIG_KASAN_SW_TAGS
7171

7272
CFLAGS_KASAN := -fsanitize=kernel-hwaddress
7373

74-
# This sets flags that will enable SW_TAGS KASAN once enabled in Rust. These
75-
# will not work today, and is guarded against in dependencies for CONFIG_RUST.
7674
RUSTFLAGS_KASAN := -Zsanitizer=kernel-hwaddress \
7775
-Zsanitizer-recover=kernel-hwaddress
7876

0 commit comments

Comments
 (0)