Skip to content

Commit

Permalink
sanitizers: Stabilize core sanitizers
Browse files Browse the repository at this point in the history
Stabilize AddressSanitizer, LeakSanitizer, MemorySanitizer,
ThreadSanitizer for the Tier 1 targets that support them.
  • Loading branch information
rcvalle authored and Ramon de C Valle committed Apr 24, 2024
1 parent 4c35022 commit 2cfed6e
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,14 @@ pub fn target() -> Target {
max_atomic_width: Some(128),
stack_probes: StackProbeType::Inline,
supported_sanitizers: SanitizerSupport {
stable: SanitizerSet::empty(),
unstable: SanitizerSet::ADDRESS
| SanitizerSet::CFI
| SanitizerSet::HWADDRESS
| SanitizerSet::KCFI
stable: SanitizerSet::ADDRESS
| SanitizerSet::LEAK
| SanitizerSet::MEMORY
| SanitizerSet::MEMTAG
| SanitizerSet::THREAD,
unstable: SanitizerSet::CFI
| SanitizerSet::KCFI
| SanitizerSet::MEMTAG
| SanitizerSet::HWADDRESS,
},
supports_xray: true,
..base::linux_gnu::opts()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ pub fn target() -> Target {
base.cpu = "pentium4".into();
base.max_atomic_width = Some(64);
base.supported_sanitizers =
SanitizerSupport { stable: SanitizerSet::empty(), unstable: SanitizerSet::ADDRESS };
SanitizerSupport { stable: SanitizerSet::ADDRESS, unstable: SanitizerSet::empty() };

base.add_pre_link_args(
LinkerFlavor::Msvc(Lld::No),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ pub fn target() -> Target {
base.cpu = "pentium4".into();
base.max_atomic_width = Some(64);
base.supported_sanitizers =
SanitizerSupport { stable: SanitizerSet::empty(), unstable: SanitizerSet::ADDRESS };
SanitizerSupport { stable: SanitizerSet::ADDRESS, unstable: SanitizerSet::empty() };
base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-m32"]);
base.stack_probes = StackProbeType::Inline;

Expand Down
7 changes: 2 additions & 5 deletions compiler/rustc_target/src/spec/targets/x86_64_apple_darwin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,8 @@ pub fn target() -> Target {
base.frame_pointer = FramePointer::Always;
base.add_pre_link_args(LinkerFlavor::Darwin(Cc::Yes, Lld::No), &["-m64"]);
base.supported_sanitizers = SanitizerSupport {
stable: SanitizerSet::empty(),
unstable: SanitizerSet::ADDRESS
| SanitizerSet::CFI
| SanitizerSet::LEAK
| SanitizerSet::THREAD,
stable: SanitizerSet::ADDRESS | SanitizerSet::LEAK | SanitizerSet::THREAD,
unstable: SanitizerSet::CFI,
};

Target {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ pub fn target() -> Target {
base.plt_by_default = false;
base.max_atomic_width = Some(128);
base.supported_sanitizers =
SanitizerSupport { stable: SanitizerSet::empty(), unstable: SanitizerSet::ADDRESS };
SanitizerSupport { stable: SanitizerSet::ADDRESS, unstable: SanitizerSet::empty() };

Target {
llvm_target: "x86_64-pc-windows-msvc".into(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,14 @@ pub fn target() -> Target {
base.stack_probes = StackProbeType::Inline;
base.static_position_independent_executables = true;
base.supported_sanitizers = SanitizerSupport {
stable: SanitizerSet::empty(),
unstable: SanitizerSet::ADDRESS
| SanitizerSet::CFI
| SanitizerSet::DATAFLOW
| SanitizerSet::KCFI
stable: SanitizerSet::ADDRESS
| SanitizerSet::LEAK
| SanitizerSet::MEMORY
| SanitizerSet::SAFESTACK
| SanitizerSet::THREAD,
unstable: SanitizerSet::CFI
| SanitizerSet::KCFI
| SanitizerSet::DATAFLOW
| SanitizerSet::SAFESTACK,
};
base.supports_xray = true;

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// Verifies that stable supported sanitizers can be used with `-Zunstable-options`.
//
//@ needs-llvm-components: x86_64
//@ needs-sanitizer-support
//@ needs-sanitizer-address
//@ build-pass
//@ compile-flags: -Zunstable-options -Csanitizer=address --target x86_64-unknown-linux-gnu

#![feature(no_core)]
#![no_core]
#![no_main]
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// Verifies that stable supported sanitizers can be used without `-Zunstable-options`.
//
//@ needs-llvm-components: x86_64
//@ needs-sanitizer-support
//@ needs-sanitizer-address
//@ build-pass
//@ compile-flags: -Csanitizer=address --target x86_64-unknown-linux-gnu

#![feature(no_core)]
#![no_core]
#![no_main]

0 comments on commit 2cfed6e

Please sign in to comment.