mirror of
https://github.com/rust-lang/rust.git
synced 2025-10-03 02:40:40 +00:00

This removes the #[no_sanitize] attribute, which was behind an unstable feature named no_sanitize. Instead, we introduce the sanitize attribute which is more powerful and allows to be extended in the future (instead of just focusing on turning sanitizers off). This also makes sanitize(kernel_address = ..) attribute work with -Zsanitize=address To do it the same as how clang disables address sanitizer, we now disable ASAN on sanitize(kernel_address = "off") and KASAN on sanitize(address = "off"). The same was added to clang in https://reviews.llvm.org/D44981.
18 lines
516 B
Rust
18 lines
516 B
Rust
// This tests that the shadowcallstack attribute is
|
|
// applied when enabling the shadow-call-stack sanitizer.
|
|
//
|
|
//@ needs-sanitizer-shadow-call-stack
|
|
//@ compile-flags: -Zsanitizer=shadow-call-stack
|
|
|
|
#![crate_type = "lib"]
|
|
#![feature(sanitize)]
|
|
|
|
// CHECK: ; sanitizer_scs_attr_check::scs
|
|
// CHECK-NEXT: ; Function Attrs:{{.*}}shadowcallstack
|
|
pub fn scs() {}
|
|
|
|
// CHECK: ; sanitizer_scs_attr_check::no_scs
|
|
// CHECK-NOT: ; Function Attrs:{{.*}}shadowcallstack
|
|
#[sanitize(shadow_call_stack = "off")]
|
|
pub fn no_scs() {}
|