Rollup merge of #91675 - ivanloz:memtagsan, r=nagisa
Add MemTagSanitizer Support Add support for the LLVM [MemTagSanitizer](https://llvm.org/docs/MemTagSanitizer.html). On hardware which supports it (see caveats below), the MemTagSanitizer can catch bugs similar to AddressSanitizer and HardwareAddressSanitizer, but with lower overhead. On a tag mismatch, a SIGSEGV is signaled with code SEGV_MTESERR / SEGV_MTEAERR. # Usage `-Zsanitizer=memtag -C target-feature="+mte"` # Comments/Caveats * MemTagSanitizer is only supported on AArch64 targets with hardware support * Requires `-C target-feature="+mte"` * LLVM MemTagSanitizer currently only performs stack tagging. # TODO * Tests * Example
This commit is contained in:
commit
0bb72a2c66
15 changed files with 67 additions and 6 deletions
|
@ -14,7 +14,9 @@ pub fn target() -> Target {
|
|||
// As documented in https://developer.android.com/ndk/guides/cpu-features.html
|
||||
// the neon (ASIMD) and FP must exist on all android aarch64 targets.
|
||||
features: "+neon,+fp-armv8".to_string(),
|
||||
supported_sanitizers: SanitizerSet::CFI | SanitizerSet::HWADDRESS,
|
||||
supported_sanitizers: SanitizerSet::CFI
|
||||
| SanitizerSet::HWADDRESS
|
||||
| SanitizerSet::MEMTAG,
|
||||
..super::android_base::opts()
|
||||
},
|
||||
}
|
||||
|
|
|
@ -14,6 +14,7 @@ pub fn target() -> Target {
|
|||
| SanitizerSet::CFI
|
||||
| SanitizerSet::LEAK
|
||||
| SanitizerSet::MEMORY
|
||||
| SanitizerSet::MEMTAG
|
||||
| SanitizerSet::THREAD
|
||||
| SanitizerSet::HWADDRESS,
|
||||
..super::linux_gnu_base::opts()
|
||||
|
|
|
@ -606,6 +606,7 @@ bitflags::bitflags! {
|
|||
const THREAD = 1 << 3;
|
||||
const HWADDRESS = 1 << 4;
|
||||
const CFI = 1 << 5;
|
||||
const MEMTAG = 1 << 6;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -619,6 +620,7 @@ impl SanitizerSet {
|
|||
SanitizerSet::CFI => "cfi",
|
||||
SanitizerSet::LEAK => "leak",
|
||||
SanitizerSet::MEMORY => "memory",
|
||||
SanitizerSet::MEMTAG => "memtag",
|
||||
SanitizerSet::THREAD => "thread",
|
||||
SanitizerSet::HWADDRESS => "hwaddress",
|
||||
_ => return None,
|
||||
|
@ -652,6 +654,7 @@ impl IntoIterator for SanitizerSet {
|
|||
SanitizerSet::CFI,
|
||||
SanitizerSet::LEAK,
|
||||
SanitizerSet::MEMORY,
|
||||
SanitizerSet::MEMTAG,
|
||||
SanitizerSet::THREAD,
|
||||
SanitizerSet::HWADDRESS,
|
||||
]
|
||||
|
@ -1883,6 +1886,7 @@ impl Target {
|
|||
Some("cfi") => SanitizerSet::CFI,
|
||||
Some("leak") => SanitizerSet::LEAK,
|
||||
Some("memory") => SanitizerSet::MEMORY,
|
||||
Some("memtag") => SanitizerSet::MEMTAG,
|
||||
Some("thread") => SanitizerSet::THREAD,
|
||||
Some("hwaddress") => SanitizerSet::HWADDRESS,
|
||||
Some(s) => return Err(format!("unknown sanitizer {}", s)),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue