2020-12-10 18:06:29 -06:00
|
|
|
// Verifies that no_sanitize attribute can be used to
|
2020-01-11 18:00:00 -06:00
|
|
|
// selectively disable sanitizer instrumentation.
|
|
|
|
//
|
2020-06-04 19:00:00 -05:00
|
|
|
// needs-sanitizer-address
|
2020-01-11 18:00:00 -06:00
|
|
|
// compile-flags: -Zsanitizer=address
|
|
|
|
|
|
|
|
#![crate_type="lib"]
|
|
|
|
#![feature(no_sanitize)]
|
|
|
|
|
2023-07-29 20:04:26 -05:00
|
|
|
// CHECK-LABEL: ; no_sanitize::unsanitized
|
2020-01-11 18:00:00 -06:00
|
|
|
// CHECK-NEXT: ; Function Attrs:
|
|
|
|
// CHECK-NOT: sanitize_address
|
|
|
|
// CHECK: start:
|
|
|
|
// CHECK-NOT: call void @__asan_report_load
|
|
|
|
// CHECK: }
|
|
|
|
#[no_sanitize(address)]
|
|
|
|
pub fn unsanitized(b: &mut u8) -> u8 {
|
|
|
|
*b
|
|
|
|
}
|
|
|
|
|
2023-07-29 20:04:26 -05:00
|
|
|
// CHECK-LABEL: ; no_sanitize::sanitized
|
2020-01-11 18:00:00 -06:00
|
|
|
// CHECK-NEXT: ; Function Attrs:
|
|
|
|
// CHECK: sanitize_address
|
|
|
|
// CHECK: start:
|
|
|
|
// CHECK: call void @__asan_report_load
|
|
|
|
// CHECK: }
|
|
|
|
pub fn sanitized(b: &mut u8) -> u8 {
|
|
|
|
*b
|
|
|
|
}
|