mirror of
https://github.com/rust-lang/rust.git
synced 2026-04-27 18:57:42 +03:00
Rollup merge of #154677 - Darksonn:hwasan-tagged-globals, r=davidtwco
hwaddress: automatically add `-Ctarget-feature=+tagged-globals` Note that since HWAddressSanitizer is/should be a target modifier, we do not have to worry about whether this LLVM target feature changes the ABI. Fixes: rust-lang/rust#148185
This commit is contained in:
@@ -18,6 +18,7 @@
|
||||
// hwasan: @__hwasan_tls
|
||||
// hwasan: call void @llvm.hwasan.check.memaccess.shortgranules
|
||||
// hwasan: declare void @__hwasan_init()
|
||||
// hwasan: attributes #0 {{.*"target-features"=".*\+tagged-globals.*"}}
|
||||
|
||||
// The `__hwasan_tls` symbol is unconditionally declared by LLVM's `HWAddressSanitizer` pass.
|
||||
// However, in kernel mode KHWASAN does not actually use it (because shadow mapping is fixed
|
||||
@@ -33,6 +34,7 @@
|
||||
//
|
||||
// khwasan-NOT: @__hwasan_init
|
||||
// khwasan: call void @llvm.hwasan.check.memaccess.shortgranules
|
||||
// khwasan-NOT: attributes #0 {{.*"target-features"=".*\+tagged-globals.*"}}
|
||||
#[no_mangle]
|
||||
pub fn test(b: &mut u8) -> u8 {
|
||||
*b
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//@ needs-sanitizer-support
|
||||
//@ needs-sanitizer-hwaddress
|
||||
//
|
||||
//@ compile-flags: -Z sanitizer=hwaddress -O -g -C target-feature=+tagged-globals -C unsafe-allow-abi-mismatch=sanitizer
|
||||
//@ compile-flags: -Z sanitizer=hwaddress -O -g -C unsafe-allow-abi-mismatch=sanitizer
|
||||
//
|
||||
//@ run-fail
|
||||
//@ error-pattern: HWAddressSanitizer: tag-mismatch
|
||||
@@ -15,5 +15,3 @@ fn main() {
|
||||
let code = unsafe { *xs.offset(4) };
|
||||
std::process::exit(code);
|
||||
}
|
||||
|
||||
//~? WARN unknown and unstable feature specified for `-Ctarget-feature`: `tagged-globals`
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
warning: unknown and unstable feature specified for `-Ctarget-feature`: `tagged-globals`
|
||||
|
|
||||
= note: it is still passed through to the codegen backend, but use of this feature might be unsound and the behavior of this feature can change in the future
|
||||
= help: consider filing a feature request
|
||||
|
||||
warning: 1 warning emitted
|
||||
|
||||
Reference in New Issue
Block a user