HWASan support

This commit is contained in:
Tri Vo 2021-01-22 18:32:38 -08:00
parent 0b7a598e12
commit c7d9bffe76
18 changed files with 100 additions and 12 deletions

View file

@ -4,7 +4,7 @@ error: invalid argument for `no_sanitize`
LL | #[no_sanitize(brontosaurus)]
| ^^^^^^^^^^^^
|
= note: expected one of: `address`, `memory` or `thread`
= note: expected one of: `address`, `hwaddress`, `memory` or `thread`
error: aborting due to previous error

View file

@ -0,0 +1,19 @@
// needs-sanitizer-support
// needs-sanitizer-hwaddress
//
// compile-flags: -Z sanitizer=hwaddress -O -g
//
// run-fail
// error-pattern: HWAddressSanitizer: tag-mismatch
#![feature(test)]
use std::hint::black_box;
fn main() {
let xs = vec![0, 1, 2, 3];
// Avoid optimizing everything out.
let xs = black_box(xs.as_ptr());
let code = unsafe { *xs.offset(4) };
std::process::exit(code);
}