Skip to content

Commit 5cd80b6

Browse files
committed
sanitizers: Stabilize AddressSanitizer and LeakSanitizer
Stabilize AddressSanitizer and LeakSanitizer for the Tier 1 targets that support them.
1 parent 832830a commit 5cd80b6

28 files changed

+70
-26
lines changed

compiler/rustc_target/src/spec/targets/aarch64_apple_darwin.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ pub(crate) fn target() -> Target {
2121
max_atomic_width: Some(128),
2222
// FIXME: The leak sanitizer currently fails the tests, see #88132.
2323
supported_sanitizers: SanitizerSet::ADDRESS | SanitizerSet::CFI | SanitizerSet::THREAD,
24+
stable_sanitizers: SanitizerSet::ADDRESS,
2425
supports_xray: true,
2526
..opts
2627
},

compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_gnu.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,13 @@ pub(crate) fn target() -> Target {
2525
stack_probes: StackProbeType::Inline,
2626
supported_sanitizers: SanitizerSet::ADDRESS
2727
| SanitizerSet::CFI
28+
| SanitizerSet::HWADDRESS
2829
| SanitizerSet::KCFI
2930
| SanitizerSet::LEAK
3031
| SanitizerSet::MEMORY
3132
| SanitizerSet::MEMTAG
32-
| SanitizerSet::THREAD
33-
| SanitizerSet::HWADDRESS,
33+
| SanitizerSet::THREAD,
34+
stable_sanitizers: SanitizerSet::ADDRESS | SanitizerSet::LEAK,
3435
supports_xray: true,
3536
..base::linux_gnu::opts()
3637
},

compiler/rustc_target/src/spec/targets/i686_pc_windows_msvc.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ pub(crate) fn target() -> Target {
66
base.cpu = "pentium4".into();
77
base.max_atomic_width = Some(64);
88
base.supported_sanitizers = SanitizerSet::ADDRESS;
9+
base.stable_sanitizers = SanitizerSet::ADDRESS;
910

1011
base.add_pre_link_args(
1112
LinkerFlavor::Msvc(Lld::No),

compiler/rustc_target/src/spec/targets/i686_unknown_linux_gnu.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ pub(crate) fn target() -> Target {
1919
base.cpu = "pentium4".into();
2020
base.max_atomic_width = Some(64);
2121
base.supported_sanitizers = SanitizerSet::ADDRESS;
22+
base.stable_sanitizers = SanitizerSet::ADDRESS;
2223
base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-m32"]);
2324
base.stack_probes = StackProbeType::Inline;
2425

compiler/rustc_target/src/spec/targets/x86_64_apple_darwin.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ pub(crate) fn target() -> Target {
2222
| SanitizerSet::CFI
2323
| SanitizerSet::LEAK
2424
| SanitizerSet::THREAD,
25+
stable_sanitizers: SanitizerSet::ADDRESS | SanitizerSet::LEAK,
2526
supports_xray: true,
2627
..opts
2728
},

compiler/rustc_target/src/spec/targets/x86_64_pc_windows_msvc.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ pub(crate) fn target() -> Target {
77
base.plt_by_default = false;
88
base.max_atomic_width = Some(128);
99
base.supported_sanitizers = SanitizerSet::ADDRESS;
10+
base.stable_sanitizers = SanitizerSet::ADDRESS;
1011

1112
Target {
1213
llvm_target: "x86_64-pc-windows-msvc".into(),

compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_gnu.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,13 @@ pub(crate) fn target() -> Target {
1212
base.static_position_independent_executables = true;
1313
base.supported_sanitizers = SanitizerSet::ADDRESS
1414
| SanitizerSet::CFI
15-
| SanitizerSet::KCFI
1615
| SanitizerSet::DATAFLOW
16+
| SanitizerSet::KCFI
1717
| SanitizerSet::LEAK
1818
| SanitizerSet::MEMORY
1919
| SanitizerSet::SAFESTACK
2020
| SanitizerSet::THREAD;
21+
base.stable_sanitizers = SanitizerSet::ADDRESS | SanitizerSet::LEAK;
2122
base.supports_xray = true;
2223

2324
// When we're asked to use the `rust-lld` linker by default, set the appropriate lld-using

tests/codegen/sanitizer/cfi/external_weak_symbols.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// emitted correctly.
33
//
44
//@ needs-sanitizer-cfi
5-
//@ compile-flags: -Clinker-plugin-lto -Copt-level=0 -Zsanitizer=cfi -Ctarget-feature=-crt-static
5+
//@ compile-flags: -Clinker-plugin-lto -Copt-level=0 -Zunstable-options -Csanitize=cfi -Ctarget-feature=-crt-static
66
#![crate_type = "bin"]
77
#![feature(linkage)]
88

tests/codegen/sanitizer/kasan-emits-instrumentation.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Verifies that `-Csanitize=kernel-address` emits sanitizer instrumentation.
22

33
//@ add-core-stubs
4-
//@ compile-flags: -Zunstable-options -Zsanitizer=kernel-address -Copt-level=0
4+
//@ compile-flags: -Zunstable-options -Csanitize=kernel-address -Copt-level=0
55
//@ revisions: aarch64 riscv64imac riscv64gc x86_64
66
//@[aarch64] compile-flags: --target aarch64-unknown-none
77
//@[aarch64] needs-llvm-components: aarch64

tests/codegen/sanitizer/riscv64-shadow-call-stack.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//@ add-core-stubs
2-
//@ compile-flags: --target riscv64imac-unknown-none-elf -Zunstable-options -Zsanitizer=shadow-call-stack
2+
//@ compile-flags: --target riscv64imac-unknown-none-elf -Zunstable-options -Csanitize=shadow-call-stack
33
//@ needs-llvm-components: riscv
44

55
#![allow(internal_features)]

0 commit comments

Comments
 (0)