-Zsanitize and -Zsanitizer-cfi-normalize-integers flags are now target modifiers with custom consistency check function
This commit is contained in:
parent
922958cffe
commit
6d637dfecc
86 changed files with 311 additions and 68 deletions
|
|
@ -412,7 +412,7 @@ impl CStore {
|
|||
match (&left_name_val, &right_name_val) {
|
||||
(Some(l), Some(r)) => match l.1.opt.cmp(&r.1.opt) {
|
||||
cmp::Ordering::Equal => {
|
||||
if l.0.tech_value != r.0.tech_value {
|
||||
if !l.1.consistent(&tcx.sess.opts, Some(&r.1)) {
|
||||
report_diff(
|
||||
&l.0.prefix,
|
||||
&l.0.name,
|
||||
|
|
@ -424,20 +424,28 @@ impl CStore {
|
|||
right_name_val = None;
|
||||
}
|
||||
cmp::Ordering::Greater => {
|
||||
report_diff(&r.0.prefix, &r.0.name, None, Some(&r.1.value_name));
|
||||
if !r.1.consistent(&tcx.sess.opts, None) {
|
||||
report_diff(&r.0.prefix, &r.0.name, None, Some(&r.1.value_name));
|
||||
}
|
||||
right_name_val = None;
|
||||
}
|
||||
cmp::Ordering::Less => {
|
||||
report_diff(&l.0.prefix, &l.0.name, Some(&l.1.value_name), None);
|
||||
if !l.1.consistent(&tcx.sess.opts, None) {
|
||||
report_diff(&l.0.prefix, &l.0.name, Some(&l.1.value_name), None);
|
||||
}
|
||||
left_name_val = None;
|
||||
}
|
||||
},
|
||||
(Some(l), None) => {
|
||||
report_diff(&l.0.prefix, &l.0.name, Some(&l.1.value_name), None);
|
||||
if !l.1.consistent(&tcx.sess.opts, None) {
|
||||
report_diff(&l.0.prefix, &l.0.name, Some(&l.1.value_name), None);
|
||||
}
|
||||
left_name_val = None;
|
||||
}
|
||||
(None, Some(r)) => {
|
||||
report_diff(&r.0.prefix, &r.0.name, None, Some(&r.1.value_name));
|
||||
if !r.1.consistent(&tcx.sess.opts, None) {
|
||||
report_diff(&r.0.prefix, &r.0.name, None, Some(&r.1.value_name));
|
||||
}
|
||||
right_name_val = None;
|
||||
}
|
||||
(None, None) => break,
|
||||
|
|
|
|||
|
|
@ -83,10 +83,77 @@ pub struct TargetModifier {
|
|||
pub value_name: String,
|
||||
}
|
||||
|
||||
mod target_modifier_consistency_check {
|
||||
use super::*;
|
||||
pub(super) fn sanitizer(l: &TargetModifier, r: Option<&TargetModifier>) -> bool {
|
||||
let mut lparsed: SanitizerSet = Default::default();
|
||||
let lval = if l.value_name.is_empty() { None } else { Some(l.value_name.as_str()) };
|
||||
parse::parse_sanitizers(&mut lparsed, lval);
|
||||
|
||||
let mut rparsed: SanitizerSet = Default::default();
|
||||
let rval = r.filter(|v| !v.value_name.is_empty()).map(|v| v.value_name.as_str());
|
||||
parse::parse_sanitizers(&mut rparsed, rval);
|
||||
|
||||
// Some sanitizers need to be target modifiers, and some do not.
|
||||
// For now, we should mark all sanitizers as target modifiers except for these:
|
||||
// AddressSanitizer, LeakSanitizer
|
||||
let tmod_sanitizers = SanitizerSet::MEMORY
|
||||
| SanitizerSet::THREAD
|
||||
| SanitizerSet::HWADDRESS
|
||||
| SanitizerSet::CFI
|
||||
| SanitizerSet::MEMTAG
|
||||
| SanitizerSet::SHADOWCALLSTACK
|
||||
| SanitizerSet::KCFI
|
||||
| SanitizerSet::KERNELADDRESS
|
||||
| SanitizerSet::SAFESTACK
|
||||
| SanitizerSet::DATAFLOW;
|
||||
|
||||
lparsed & tmod_sanitizers == rparsed & tmod_sanitizers
|
||||
}
|
||||
pub(super) fn sanitizer_cfi_normalize_integers(
|
||||
opts: &Options,
|
||||
l: &TargetModifier,
|
||||
r: Option<&TargetModifier>,
|
||||
) -> bool {
|
||||
// For kCFI, the helper flag -Zsanitizer-cfi-normalize-integers should also be a target modifier
|
||||
if opts.unstable_opts.sanitizer.contains(SanitizerSet::KCFI) {
|
||||
if let Some(r) = r {
|
||||
return l.extend().tech_value == r.extend().tech_value;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
true
|
||||
}
|
||||
}
|
||||
|
||||
impl TargetModifier {
|
||||
pub fn extend(&self) -> ExtendedTargetModifierInfo {
|
||||
self.opt.reparse(&self.value_name)
|
||||
}
|
||||
// Custom consistency check for target modifiers (or default `l.tech_value == r.tech_value`)
|
||||
// When other is None, consistency with default value is checked
|
||||
pub fn consistent(&self, opts: &Options, other: Option<&TargetModifier>) -> bool {
|
||||
assert!(other.is_none() || self.opt == other.unwrap().opt);
|
||||
match self.opt {
|
||||
OptionsTargetModifiers::UnstableOptions(unstable) => match unstable {
|
||||
UnstableOptionsTargetModifiers::sanitizer => {
|
||||
return target_modifier_consistency_check::sanitizer(self, other);
|
||||
}
|
||||
UnstableOptionsTargetModifiers::sanitizer_cfi_normalize_integers => {
|
||||
return target_modifier_consistency_check::sanitizer_cfi_normalize_integers(
|
||||
opts, self, other,
|
||||
);
|
||||
}
|
||||
_ => {}
|
||||
},
|
||||
_ => {}
|
||||
};
|
||||
match other {
|
||||
Some(other) => self.extend().tech_value == other.extend().tech_value,
|
||||
None => false,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn tmod_push_impl(
|
||||
|
|
@ -2504,13 +2571,13 @@ written to standard error output)"),
|
|||
retpoline_external_thunk: bool = (false, parse_bool, [TRACKED TARGET_MODIFIER],
|
||||
"enables retpoline-external-thunk, retpoline-indirect-branches and retpoline-indirect-calls \
|
||||
target features (default: no)"),
|
||||
sanitizer: SanitizerSet = (SanitizerSet::empty(), parse_sanitizers, [TRACKED],
|
||||
sanitizer: SanitizerSet = (SanitizerSet::empty(), parse_sanitizers, [TRACKED TARGET_MODIFIER],
|
||||
"use a sanitizer"),
|
||||
sanitizer_cfi_canonical_jump_tables: Option<bool> = (Some(true), parse_opt_bool, [TRACKED],
|
||||
"enable canonical jump tables (default: yes)"),
|
||||
sanitizer_cfi_generalize_pointers: Option<bool> = (None, parse_opt_bool, [TRACKED],
|
||||
"enable generalizing pointer types (default: no)"),
|
||||
sanitizer_cfi_normalize_integers: Option<bool> = (None, parse_opt_bool, [TRACKED],
|
||||
sanitizer_cfi_normalize_integers: Option<bool> = (None, parse_opt_bool, [TRACKED TARGET_MODIFIER],
|
||||
"enable normalizing integer types (default: no)"),
|
||||
sanitizer_dataflow_abilist: Vec<String> = (Vec::new(), parse_comma_list, [TRACKED],
|
||||
"additional ABI list files that control how shadow parameters are passed (comma separated)"),
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
//@ only-linux
|
||||
//
|
||||
//@ revisions:ASAN ASAN-FAT-LTO
|
||||
//@ compile-flags: -Zsanitizer=address -Ctarget-feature=-crt-static
|
||||
//@ compile-flags: -Zsanitizer=address -Ctarget-feature=-crt-static -C unsafe-allow-abi-mismatch=sanitizer
|
||||
// [ASAN] no extra compile-flags
|
||||
//@[ASAN-FAT-LTO] compile-flags: -Cprefer-dynamic=false -Clto=fat
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
// Verifies that "CFI Canonical Jump Tables" module flag is added.
|
||||
//
|
||||
//@ needs-sanitizer-cfi
|
||||
//@ compile-flags: -Clto -Ctarget-feature=-crt-static -Zsanitizer=cfi
|
||||
//@ compile-flags: -Clto -Ctarget-feature=-crt-static -Zsanitizer=cfi -C unsafe-allow-abi-mismatch=sanitizer
|
||||
|
||||
#![crate_type = "lib"]
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
// Verifies that "cfi-normalize-integers" module flag is added.
|
||||
//
|
||||
//@ needs-sanitizer-cfi
|
||||
//@ compile-flags: -Clto -Ctarget-feature=-crt-static -Zsanitizer=cfi -Zsanitizer-cfi-normalize-integers
|
||||
//@ compile-flags: -Clto -Ctarget-feature=-crt-static -Zsanitizer=cfi -Zsanitizer-cfi-normalize-integers -C unsafe-allow-abi-mismatch=sanitizer,sanitizer-cfi-normalize-integers
|
||||
|
||||
#![crate_type = "lib"]
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
// Verifies that "EnableSplitLTOUnit" module flag is added.
|
||||
//
|
||||
//@ needs-sanitizer-cfi
|
||||
//@ compile-flags: -Clto -Ctarget-feature=-crt-static -Zsanitizer=cfi
|
||||
//@ compile-flags: -Clto -Ctarget-feature=-crt-static -Zsanitizer=cfi -C unsafe-allow-abi-mismatch=sanitizer
|
||||
|
||||
#![crate_type = "lib"]
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
// Verifies that the parent block's debug information are assigned to the inserted cfi block.
|
||||
//
|
||||
//@ needs-sanitizer-cfi
|
||||
//@ compile-flags: -Clto -Cno-prepopulate-passes -Copt-level=0 -Zsanitizer=cfi -Ctarget-feature=-crt-static -Cdebuginfo=1
|
||||
//@ compile-flags: -Clto -Cno-prepopulate-passes -Copt-level=0 -Zsanitizer=cfi -Ctarget-feature=-crt-static -Cdebuginfo=1 -C unsafe-allow-abi-mismatch=sanitizer
|
||||
|
||||
#![crate_type = "lib"]
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
// Verifies that pointer type membership tests for indirect calls are omitted.
|
||||
//
|
||||
//@ needs-sanitizer-cfi
|
||||
//@ compile-flags: -Clto -Cno-prepopulate-passes -Ctarget-feature=-crt-static -Zsanitizer=cfi -Copt-level=0
|
||||
//@ compile-flags: -Clto -Cno-prepopulate-passes -Ctarget-feature=-crt-static -Zsanitizer=cfi -Copt-level=0 -C unsafe-allow-abi-mismatch=sanitizer
|
||||
|
||||
#![crate_type = "lib"]
|
||||
#![feature(sanitize)]
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
// Verifies that pointer type membership tests for indirect calls are emitted.
|
||||
//
|
||||
//@ needs-sanitizer-cfi
|
||||
//@ compile-flags: -Clto -Cno-prepopulate-passes -Ctarget-feature=-crt-static -Zsanitizer=cfi -Copt-level=0
|
||||
//@ compile-flags: -Clto -Cno-prepopulate-passes -Ctarget-feature=-crt-static -Zsanitizer=cfi -Copt-level=0 -C unsafe-allow-abi-mismatch=sanitizer
|
||||
|
||||
#![crate_type = "lib"]
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
// Verifies that user-defined CFI encoding for types are emitted.
|
||||
//
|
||||
//@ needs-sanitizer-cfi
|
||||
//@ compile-flags: -Clto -Cno-prepopulate-passes -Ctarget-feature=-crt-static -Zsanitizer=cfi -Copt-level=0
|
||||
//@ compile-flags: -Clto -Cno-prepopulate-passes -Ctarget-feature=-crt-static -Zsanitizer=cfi -Copt-level=0 -C unsafe-allow-abi-mismatch=sanitizer
|
||||
|
||||
#![crate_type = "lib"]
|
||||
#![feature(cfi_encoding, extern_types)]
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
// for const generics.
|
||||
//
|
||||
//@ needs-sanitizer-cfi
|
||||
//@ compile-flags: -Clto -Cno-prepopulate-passes -Ctarget-feature=-crt-static -Zsanitizer=cfi -Copt-level=0
|
||||
//@ compile-flags: -Clto -Cno-prepopulate-passes -Ctarget-feature=-crt-static -Zsanitizer=cfi -Copt-level=0 -C unsafe-allow-abi-mismatch=sanitizer
|
||||
|
||||
#![crate_type = "lib"]
|
||||
#![feature(type_alias_impl_trait)]
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
// future.
|
||||
//
|
||||
//@ needs-sanitizer-cfi
|
||||
//@ compile-flags: -Clto -Cno-prepopulate-passes -Copt-level=0 -Zsanitizer=cfi -Ctarget-feature=-crt-static
|
||||
//@ compile-flags: -Clto -Cno-prepopulate-passes -Copt-level=0 -Zsanitizer=cfi -Ctarget-feature=-crt-static -C unsafe-allow-abi-mismatch=sanitizer
|
||||
|
||||
#![crate_type = "lib"]
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
// for function types.
|
||||
//
|
||||
//@ needs-sanitizer-cfi
|
||||
//@ compile-flags: -Clto -Cno-prepopulate-passes -Copt-level=0 -Zsanitizer=cfi -Ctarget-feature=-crt-static
|
||||
//@ compile-flags: -Clto -Cno-prepopulate-passes -Copt-level=0 -Zsanitizer=cfi -Ctarget-feature=-crt-static -C unsafe-allow-abi-mismatch=sanitizer
|
||||
|
||||
#![crate_type = "lib"]
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
// for lifetimes/regions.
|
||||
//
|
||||
//@ needs-sanitizer-cfi
|
||||
//@ compile-flags: -Clto -Cno-prepopulate-passes -Ctarget-feature=-crt-static -Zsanitizer=cfi -Copt-level=0
|
||||
//@ compile-flags: -Clto -Cno-prepopulate-passes -Ctarget-feature=-crt-static -Zsanitizer=cfi -Copt-level=0 -C unsafe-allow-abi-mismatch=sanitizer
|
||||
|
||||
#![crate_type = "lib"]
|
||||
#![feature(type_alias_impl_trait)]
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
// self so they can be used as function pointers.
|
||||
//
|
||||
//@ needs-sanitizer-cfi
|
||||
//@ compile-flags: -Clto -Cno-prepopulate-passes -Copt-level=0 -Zsanitizer=cfi -Ctarget-feature=-crt-static
|
||||
//@ compile-flags: -Clto -Cno-prepopulate-passes -Copt-level=0 -Zsanitizer=cfi -Ctarget-feature=-crt-static -C unsafe-allow-abi-mismatch=sanitizer
|
||||
|
||||
#![crate_type = "lib"]
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
// for paths.
|
||||
//
|
||||
//@ needs-sanitizer-cfi
|
||||
//@ compile-flags: -Clto -Cno-prepopulate-passes -Copt-level=0 -Zsanitizer=cfi -Ctarget-feature=-crt-static
|
||||
//@ compile-flags: -Clto -Cno-prepopulate-passes -Copt-level=0 -Zsanitizer=cfi -Ctarget-feature=-crt-static -C unsafe-allow-abi-mismatch=sanitizer
|
||||
|
||||
#![crate_type = "lib"]
|
||||
#![feature(type_alias_impl_trait)]
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
// for pointer types.
|
||||
//
|
||||
//@ needs-sanitizer-cfi
|
||||
//@ compile-flags: -Clto -Cno-prepopulate-passes -Copt-level=0 -Zsanitizer=cfi -Ctarget-feature=-crt-static
|
||||
//@ compile-flags: -Clto -Cno-prepopulate-passes -Copt-level=0 -Zsanitizer=cfi -Ctarget-feature=-crt-static -C unsafe-allow-abi-mismatch=sanitizer
|
||||
|
||||
#![crate_type = "lib"]
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
// for primitive types.
|
||||
//
|
||||
//@ needs-sanitizer-cfi
|
||||
//@ compile-flags: -Clto -Cno-prepopulate-passes -Copt-level=0 -Zsanitizer=cfi -Ctarget-feature=-crt-static
|
||||
//@ compile-flags: -Clto -Cno-prepopulate-passes -Copt-level=0 -Zsanitizer=cfi -Ctarget-feature=-crt-static -C unsafe-allow-abi-mismatch=sanitizer
|
||||
|
||||
#![crate_type = "lib"]
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
// for repr transparent types.
|
||||
//
|
||||
//@ needs-sanitizer-cfi
|
||||
//@ compile-flags: -Clto -Cno-prepopulate-passes -Copt-level=0 -Zsanitizer=cfi -Ctarget-feature=-crt-static
|
||||
//@ compile-flags: -Clto -Cno-prepopulate-passes -Copt-level=0 -Zsanitizer=cfi -Ctarget-feature=-crt-static -C unsafe-allow-abi-mismatch=sanitizer
|
||||
|
||||
#![crate_type = "lib"]
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
// for sequence types.
|
||||
//
|
||||
//@ needs-sanitizer-cfi
|
||||
//@ compile-flags: -Clto -Cno-prepopulate-passes -Copt-level=0 -Zsanitizer=cfi -Ctarget-feature=-crt-static
|
||||
//@ compile-flags: -Clto -Cno-prepopulate-passes -Copt-level=0 -Zsanitizer=cfi -Ctarget-feature=-crt-static -C unsafe-allow-abi-mismatch=sanitizer
|
||||
|
||||
#![crate_type = "lib"]
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
// for trait types.
|
||||
//
|
||||
//@ needs-sanitizer-cfi
|
||||
//@ compile-flags: -Clto -Cno-prepopulate-passes -Copt-level=0 -Zsanitizer=cfi -Ctarget-feature=-crt-static
|
||||
//@ compile-flags: -Clto -Cno-prepopulate-passes -Copt-level=0 -Zsanitizer=cfi -Ctarget-feature=-crt-static -C unsafe-allow-abi-mismatch=sanitizer
|
||||
|
||||
#![crate_type = "lib"]
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
// for user-defined types.
|
||||
//
|
||||
//@ needs-sanitizer-cfi
|
||||
//@ compile-flags: -Clto -Cno-prepopulate-passes -Copt-level=0 -Zsanitizer=cfi -Ctarget-feature=-crt-static
|
||||
//@ compile-flags: -Clto -Cno-prepopulate-passes -Copt-level=0 -Zsanitizer=cfi -Ctarget-feature=-crt-static -C unsafe-allow-abi-mismatch=sanitizer
|
||||
|
||||
#![crate_type = "lib"]
|
||||
#![feature(extern_types)]
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
// Verifies that generalized type metadata for functions are emitted.
|
||||
//
|
||||
//@ needs-sanitizer-cfi
|
||||
//@ compile-flags: -Clto -Cno-prepopulate-passes -Ctarget-feature=-crt-static -Zsanitizer=cfi -Zsanitizer-cfi-generalize-pointers
|
||||
//@ compile-flags: -Clto -Cno-prepopulate-passes -Ctarget-feature=-crt-static -Zsanitizer=cfi -Zsanitizer-cfi-generalize-pointers -C unsafe-allow-abi-mismatch=sanitizer
|
||||
|
||||
#![crate_type = "lib"]
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
// Verifies that normalized and generalized type metadata for functions are emitted.
|
||||
//
|
||||
//@ needs-sanitizer-cfi
|
||||
//@ compile-flags: -Clto -Cno-prepopulate-passes -Ctarget-feature=-crt-static -Zsanitizer=cfi -Zsanitizer-cfi-normalize-integers -Zsanitizer-cfi-generalize-pointers
|
||||
//@ compile-flags: -Clto -Cno-prepopulate-passes -Ctarget-feature=-crt-static -Zsanitizer=cfi -Zsanitizer-cfi-normalize-integers -Zsanitizer-cfi-generalize-pointers -C unsafe-allow-abi-mismatch=sanitizer,sanitizer-cfi-normalize-integers
|
||||
|
||||
#![crate_type = "lib"]
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
// Verifies that normalized type metadata for functions are emitted.
|
||||
//
|
||||
//@ needs-sanitizer-cfi
|
||||
//@ compile-flags: -Clto -Cno-prepopulate-passes -Ctarget-feature=-crt-static -Zsanitizer=cfi -Zsanitizer-cfi-normalize-integers
|
||||
//@ compile-flags: -Clto -Cno-prepopulate-passes -Ctarget-feature=-crt-static -Zsanitizer=cfi -Zsanitizer-cfi-normalize-integers -C unsafe-allow-abi-mismatch=sanitizer,sanitizer-cfi-normalize-integers
|
||||
|
||||
#![crate_type = "lib"]
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
// Verifies that type metadata for functions are emitted.
|
||||
//
|
||||
//@ needs-sanitizer-cfi
|
||||
//@ compile-flags: -Clto -Cno-prepopulate-passes -Ctarget-feature=-crt-static -Zsanitizer=cfi
|
||||
//@ compile-flags: -Clto -Cno-prepopulate-passes -Ctarget-feature=-crt-static -Zsanitizer=cfi -C unsafe-allow-abi-mismatch=sanitizer
|
||||
|
||||
#![crate_type = "lib"]
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
// Verifies that type metadata identifiers for trait objects are emitted correctly.
|
||||
//
|
||||
//@ needs-sanitizer-cfi
|
||||
//@ compile-flags: -Clto -Cno-prepopulate-passes -Copt-level=0 -Ctarget-feature=-crt-static -Zsanitizer=cfi
|
||||
//@ compile-flags: -Clto -Cno-prepopulate-passes -Copt-level=0 -Ctarget-feature=-crt-static -Zsanitizer=cfi -C unsafe-allow-abi-mismatch=sanitizer
|
||||
|
||||
#![crate_type = "lib"]
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
// emitted correctly.
|
||||
//
|
||||
//@ needs-sanitizer-cfi
|
||||
//@ compile-flags: -Clinker-plugin-lto -Copt-level=0 -Zsanitizer=cfi -Ctarget-feature=-crt-static
|
||||
//@ compile-flags: -Clinker-plugin-lto -Copt-level=0 -Zsanitizer=cfi -Ctarget-feature=-crt-static -C unsafe-allow-abi-mismatch=sanitizer
|
||||
#![crate_type = "bin"]
|
||||
#![feature(linkage)]
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
// Verifies that pointer types are generalized.
|
||||
//
|
||||
//@ needs-sanitizer-cfi
|
||||
//@ compile-flags: -Clto -Cno-prepopulate-passes -Ctarget-feature=-crt-static -Zsanitizer=cfi -Zsanitizer-cfi-generalize-pointers -Copt-level=0
|
||||
//@ compile-flags: -Clto -Cno-prepopulate-passes -Ctarget-feature=-crt-static -Zsanitizer=cfi -Zsanitizer-cfi-generalize-pointers -Copt-level=0 -C unsafe-allow-abi-mismatch=sanitizer
|
||||
|
||||
#![crate_type = "lib"]
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
// Verifies that integer types are normalized.
|
||||
//
|
||||
//@ needs-sanitizer-cfi
|
||||
//@ compile-flags: -Clto -Cno-prepopulate-passes -Ctarget-feature=-crt-static -Zsanitizer=cfi -Zsanitizer-cfi-normalize-integers -Copt-level=0
|
||||
//@ compile-flags: -Clto -Cno-prepopulate-passes -Ctarget-feature=-crt-static -Zsanitizer=cfi -Zsanitizer-cfi-normalize-integers -Copt-level=0 -C unsafe-allow-abi-mismatch=sanitizer,sanitizer-cfi-normalize-integers
|
||||
|
||||
#![crate_type = "lib"]
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
// Verifies that functions are instrumented.
|
||||
//
|
||||
//@ needs-sanitizer-dataflow
|
||||
//@ compile-flags: -Copt-level=0 -Zsanitizer=dataflow
|
||||
//@ compile-flags: -Copt-level=0 -Zsanitizer=dataflow -C unsafe-allow-abi-mismatch=sanitizer
|
||||
|
||||
#![crate_type = "lib"]
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
//@ needs-sanitizer-memory
|
||||
//@ revisions:MSAN-0 MSAN-1 MSAN-2 MSAN-1-LTO MSAN-2-LTO
|
||||
//
|
||||
//@ compile-flags: -Zsanitizer=memory -Ctarget-feature=-crt-static
|
||||
//@ compile-flags: -Zsanitizer=memory -Ctarget-feature=-crt-static -C unsafe-allow-abi-mismatch=sanitizer
|
||||
// [MSAN-0] no extra compile-flags
|
||||
//@[MSAN-1] compile-flags: -Zsanitizer-memory-track-origins=1
|
||||
//@[MSAN-2] compile-flags: -Zsanitizer-memory-track-origins
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
// applied when enabling the memtag sanitizer.
|
||||
//
|
||||
//@ needs-sanitizer-memtag
|
||||
//@ compile-flags: -Zsanitizer=memtag -Ctarget-feature=+mte -Copt-level=0
|
||||
//@ compile-flags: -C unsafe-allow-abi-mismatch=sanitizer -Zsanitizer=memtag -Ctarget-feature=+mte -Copt-level=0
|
||||
|
||||
#![crate_type = "lib"]
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
// This tests that the safestack attribute is applied when enabling the safe-stack sanitizer.
|
||||
//
|
||||
//@ needs-sanitizer-safestack
|
||||
//@ compile-flags: -Zsanitizer=safestack -Copt-level=0
|
||||
//@ compile-flags: -Zsanitizer=safestack -Copt-level=0 -C unsafe-allow-abi-mismatch=sanitizer
|
||||
|
||||
#![crate_type = "lib"]
|
||||
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
// Verifies that sanitize(xyz = "off") attribute prevents inlining when
|
||||
// given sanitizer is enabled, but has no effect on inlining otherwise.
|
||||
//
|
||||
//@ needs-sanitizer-address
|
||||
//@ needs-sanitizer-leak
|
||||
//@ revisions: ASAN LSAN
|
||||
//@ compile-flags: -C unsafe-allow-abi-mismatch=sanitizer
|
||||
//@ compile-flags: -Copt-level=3 -Zmir-opt-level=4 -Ctarget-feature=-crt-static
|
||||
//@[ASAN] compile-flags: -Zsanitizer=address
|
||||
//@[LSAN] compile-flags: -Zsanitizer=leak
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
// the address sanitizer.
|
||||
//
|
||||
//@ needs-sanitizer-address
|
||||
//@ compile-flags: -Zsanitizer=address -Ctarget-feature=-crt-static -Copt-level=0
|
||||
//@ compile-flags: -Zsanitizer=address -Ctarget-feature=-crt-static -Copt-level=0 -C unsafe-allow-abi-mismatch=sanitizer
|
||||
|
||||
#![crate_type = "lib"]
|
||||
#![feature(sanitize)]
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
//@ needs-sanitizer-memory
|
||||
//@ revisions:ASAN ASAN-RECOVER MSAN MSAN-RECOVER MSAN-RECOVER-LTO
|
||||
//@ no-prefer-dynamic
|
||||
//
|
||||
//@ compile-flags: -C unsafe-allow-abi-mismatch=sanitizer
|
||||
//@ compile-flags: -Ctarget-feature=-crt-static
|
||||
//@[ASAN] compile-flags: -Zsanitizer=address -Copt-level=0
|
||||
//@[ASAN-RECOVER] compile-flags: -Zsanitizer=address -Zsanitizer-recover=address -Copt-level=0
|
||||
|
|
|
|||
|
|
@ -8,6 +8,8 @@
|
|||
//@ needs-sanitizer-support
|
||||
//@ needs-sanitizer-address
|
||||
|
||||
//@ compile-flags: -C unsafe-allow-abi-mismatch=sanitizer
|
||||
|
||||
use run_make_support::{run_fail, rustc};
|
||||
|
||||
fn main() {
|
||||
|
|
|
|||
|
|
@ -7,6 +7,8 @@
|
|||
//@ needs-sanitizer-support
|
||||
//@ needs-sanitizer-address
|
||||
|
||||
//@ compile-flags: -C unsafe-allow-abi-mismatch=sanitizer
|
||||
|
||||
use run_make_support::{run_fail, rustc};
|
||||
|
||||
fn main() {
|
||||
|
|
|
|||
|
|
@ -11,6 +11,8 @@
|
|||
//@ needs-sanitizer-support
|
||||
//@ needs-sanitizer-address
|
||||
|
||||
//@ compile-flags: -C unsafe-allow-abi-mismatch=sanitizer
|
||||
|
||||
use run_make_support::{cc, extra_c_flags, extra_cxx_flags, run_fail, rustc, static_lib_name};
|
||||
|
||||
fn main() {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
//@ needs-sanitizer-support
|
||||
//@ needs-sanitizer-address
|
||||
//@ compile-flags: --test -Z sanitizer=address
|
||||
//@ compile-flags: --test -Z sanitizer=address -C unsafe-allow-abi-mismatch=sanitizer
|
||||
//
|
||||
// #43031: Verify that rustdoc passes `-Z` options to rustc. Use an extern
|
||||
// function that is provided by the sanitizer runtime, if flag is not passed
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
//@ revisions: emit_mir instrument cfi
|
||||
|
||||
//@ compile-flags: -C unsafe-allow-abi-mismatch=sanitizer
|
||||
|
||||
// Make sure we don't try to emit MIR for it.
|
||||
//@[emit_mir] compile-flags: --emit=mir
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
//@ build-pass
|
||||
//@ needs-sanitizer-cfi
|
||||
//@ compile-flags: -Ccodegen-units=1 -Clto -Ctarget-feature=-crt-static -Zsanitizer=cfi
|
||||
//@ compile-flags: -Ccodegen-units=1 -Clto -Ctarget-feature=-crt-static -Zsanitizer=cfi -C unsafe-allow-abi-mismatch=sanitizer
|
||||
//@ no-prefer-dynamic
|
||||
//@ only-x86_64-unknown-linux-gnu
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
//@ needs-sanitizer-address
|
||||
//@ ignore-cross-compile
|
||||
//
|
||||
//@ compile-flags: -Z sanitizer=address -O -g
|
||||
//@ compile-flags: -Z sanitizer=address -O -g -C unsafe-allow-abi-mismatch=sanitizer
|
||||
//
|
||||
//@ run-fail-or-crash
|
||||
//@ error-pattern: AddressSanitizer: stack-buffer-overflow
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
//! See <https://github.com/rust-lang/rust/issues/124390>.
|
||||
|
||||
//@ run-pass
|
||||
//@ compile-flags:-Zsanitizer=address
|
||||
//@ compile-flags:-Zsanitizer=address -C unsafe-allow-abi-mismatch=sanitizer
|
||||
//@ aux-build: asan_odr_win-2.rs
|
||||
//@ only-windows-msvc
|
||||
//@ needs-sanitizer-support
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
//@ needs-sanitizer-address
|
||||
//@ ignore-cross-compile
|
||||
//
|
||||
//@ compile-flags: -Z sanitizer=address -O
|
||||
//@ compile-flags: -Z sanitizer=address -O -C unsafe-allow-abi-mismatch=sanitizer
|
||||
//
|
||||
//@ run-fail-or-crash
|
||||
//@ regex-error-pattern: AddressSanitizer: (SEGV|attempting free on address which was not malloc)
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
// trait object type to fail, causing an ICE.
|
||||
//
|
||||
//@ needs-sanitizer-cfi
|
||||
//@ compile-flags: -Ccodegen-units=1 -Clto -Ctarget-feature=-crt-static -Zsanitizer=cfi
|
||||
//@ compile-flags: -Ccodegen-units=1 -Clto -Ctarget-feature=-crt-static -Zsanitizer=cfi -C unsafe-allow-abi-mismatch=sanitizer
|
||||
//@ edition: 2021
|
||||
//@ no-prefer-dynamic
|
||||
//@ only-x86_64-unknown-linux-gnu
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
//@ ignore-backends: gcc
|
||||
//@ [cfi] needs-sanitizer-cfi
|
||||
//@ [kcfi] needs-sanitizer-kcfi
|
||||
//@ compile-flags: -C target-feature=-crt-static
|
||||
//@ compile-flags: -C target-feature=-crt-static -C unsafe-allow-abi-mismatch=sanitizer
|
||||
//@ [cfi] compile-flags: -C codegen-units=1 -C lto -C prefer-dynamic=off -C opt-level=0
|
||||
//@ [cfi] compile-flags: -Z sanitizer=cfi
|
||||
//@ [kcfi] compile-flags: -Z sanitizer=kcfi
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
//@ needs-sanitizer-cfi
|
||||
//@ compile-flags: -Ccodegen-units=1 -Clto -Ctarget-feature=-crt-static -Zsanitizer=cfi
|
||||
//@ compile-flags: -Ccodegen-units=1 -Clto -Ctarget-feature=-crt-static -Zsanitizer=cfi -C unsafe-allow-abi-mismatch=sanitizer
|
||||
//@ no-prefer-dynamic
|
||||
//@ only-x86_64-unknown-linux-gnu
|
||||
//@ ignore-backends: gcc
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
//@ ignore-backends: gcc
|
||||
//@ [cfi] needs-sanitizer-cfi
|
||||
//@ [kcfi] needs-sanitizer-kcfi
|
||||
//@ compile-flags: -C target-feature=-crt-static
|
||||
//@ compile-flags: -C target-feature=-crt-static -C unsafe-allow-abi-mismatch=sanitizer
|
||||
//@ [cfi] compile-flags: -C codegen-units=1 -C lto -C prefer-dynamic=off -C opt-level=0
|
||||
//@ [cfi] compile-flags: -Z sanitizer=cfi
|
||||
//@ [kcfi] compile-flags: -Z sanitizer=kcfi
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
//@ ignore-backends: gcc
|
||||
//@ [cfi] needs-sanitizer-cfi
|
||||
//@ [kcfi] needs-sanitizer-kcfi
|
||||
//@ compile-flags: -C target-feature=-crt-static
|
||||
//@ compile-flags: -C target-feature=-crt-static -C unsafe-allow-abi-mismatch=sanitizer
|
||||
//@ [cfi] compile-flags: -C codegen-units=1 -C lto -C prefer-dynamic=off -C opt-level=0
|
||||
//@ [cfi] compile-flags: -Z sanitizer=cfi
|
||||
//@ [kcfi] compile-flags: -Z sanitizer=kcfi
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@
|
|||
//@ [cfi] needs-sanitizer-cfi
|
||||
//@ [kcfi] needs-sanitizer-kcfi
|
||||
//@ compile-flags: -C target-feature=-crt-static
|
||||
//@ compile-flags: -C unsafe-allow-abi-mismatch=sanitizer
|
||||
//@ [cfi] compile-flags: -C codegen-units=1 -C lto -C prefer-dynamic=off -C opt-level=0
|
||||
//@ [cfi] compile-flags: -Z sanitizer=cfi
|
||||
//@ [kcfi] compile-flags: -Z sanitizer=kcfi
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
//@ ignore-backends: gcc
|
||||
//@ needs-sanitizer-cfi
|
||||
//@ compile-flags: -Clto -Copt-level=0 -Cprefer-dynamic=off -Ctarget-feature=-crt-static -Zsanitizer=cfi
|
||||
//@ compile-flags: -C unsafe-allow-abi-mismatch=sanitizer
|
||||
//@ run-pass
|
||||
|
||||
struct EmptyDrop;
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
// FIXME(#122848) Remove only-linux once OSX CFI binaries works
|
||||
//@ only-linux
|
||||
//@ ignore-backends: gcc
|
||||
//@ compile-flags: --crate-type=bin -Cprefer-dynamic=off -Clto -Zsanitizer=cfi
|
||||
//@ compile-flags: --crate-type=bin -Cprefer-dynamic=off -Clto -Zsanitizer=cfi -C unsafe-allow-abi-mismatch=sanitizer
|
||||
//@ compile-flags: -C target-feature=-crt-static -C codegen-units=1 -C opt-level=0
|
||||
// FIXME(#118761) Should be run-pass once the labels on drop are compatible.
|
||||
// This test is being landed ahead of that to test that the compiler doesn't ICE while labeling the
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
//@ [cfi] needs-sanitizer-cfi
|
||||
//@ [kcfi] needs-sanitizer-kcfi
|
||||
//@ compile-flags: -C target-feature=-crt-static
|
||||
//@ compile-flags: -C unsafe-allow-abi-mismatch=sanitizer
|
||||
//@ [cfi] compile-flags: -C opt-level=0 -C codegen-units=1 -C lto
|
||||
//@ [cfi] compile-flags: -C prefer-dynamic=off
|
||||
//@ [cfi] compile-flags: -Z sanitizer=cfi
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
//@ needs-sanitizer-cfi
|
||||
//@ check-pass
|
||||
//@ compile-flags: -Clto -Cno-prepopulate-passes -Ctarget-feature=-crt-static -Zsanitizer=cfi -Zsanitizer-cfi-generalize-pointers
|
||||
//@ compile-flags: -C unsafe-allow-abi-mismatch=sanitizer
|
||||
|
||||
#![feature(cfg_sanitizer_cfi)]
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
//
|
||||
//@ needs-sanitizer-cfi
|
||||
//@ check-pass
|
||||
//@ compile-flags: -Clto -Cno-prepopulate-passes -Ctarget-feature=-crt-static -Zsanitizer=cfi -Zsanitizer-cfi-normalize-integers
|
||||
//@ compile-flags: -Clto -Cno-prepopulate-passes -Ctarget-feature=-crt-static -Zsanitizer=cfi -Zsanitizer-cfi-normalize-integers -C unsafe-allow-abi-mismatch=sanitizer,sanitizer-cfi-normalize-integers
|
||||
|
||||
#![feature(cfg_sanitizer_cfi)]
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
//@ ignore-backends: gcc
|
||||
//@ [cfi] needs-sanitizer-cfi
|
||||
//@ [kcfi] needs-sanitizer-kcfi
|
||||
//@ compile-flags: -C target-feature=-crt-static
|
||||
//@ compile-flags: -C target-feature=-crt-static -C unsafe-allow-abi-mismatch=sanitizer
|
||||
//@ [cfi] compile-flags: -C codegen-units=1 -C lto -C prefer-dynamic=off -C opt-level=0
|
||||
//@ [cfi] compile-flags: -Z sanitizer=cfi
|
||||
//@ [kcfi] compile-flags: -Z sanitizer=kcfi
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
//@ ignore-backends: gcc
|
||||
//@ [cfi] needs-sanitizer-cfi
|
||||
//@ [kcfi] needs-sanitizer-kcfi
|
||||
//@ compile-flags: -C target-feature=-crt-static
|
||||
//@ compile-flags: -C target-feature=-crt-static -C unsafe-allow-abi-mismatch=sanitizer
|
||||
//@ [cfi] compile-flags: -C codegen-units=1 -C lto -C prefer-dynamic=off -C opt-level=0
|
||||
//@ [cfi] compile-flags: -Z sanitizer=cfi
|
||||
//@ [kcfi] compile-flags: -Z sanitizer=kcfi
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
//@ ignore-backends: gcc
|
||||
//@ [cfi] needs-sanitizer-cfi
|
||||
//@ [kcfi] needs-sanitizer-kcfi
|
||||
//@ compile-flags: -C target-feature=-crt-static
|
||||
//@ compile-flags: -C target-feature=-crt-static -C unsafe-allow-abi-mismatch=sanitizer
|
||||
//@ [cfi] compile-flags: -C codegen-units=1 -C lto -C prefer-dynamic=off -C opt-level=0
|
||||
//@ [cfi] compile-flags: -Z sanitizer=cfi
|
||||
//@ [kcfi] compile-flags: -Z sanitizer=kcfi
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
//@ needs-sanitizer-cfi
|
||||
//@ compile-flags: -Ccodegen-units=1 -Clto -Ctarget-feature=-crt-static -Zsanitizer=cfi
|
||||
//@ compile-flags: -Ccodegen-units=1 -Clto -Ctarget-feature=-crt-static -Zsanitizer=cfi -C unsafe-allow-abi-mismatch=sanitizer
|
||||
//@ no-prefer-dynamic
|
||||
//@ only-x86_64-unknown-linux-gnu
|
||||
//@ build-pass
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
//@ ignore-backends: gcc
|
||||
//@ [cfi] needs-sanitizer-cfi
|
||||
//@ [kcfi] needs-sanitizer-kcfi
|
||||
//@ compile-flags: -C target-feature=-crt-static
|
||||
//@ compile-flags: -C target-feature=-crt-static -C unsafe-allow-abi-mismatch=sanitizer
|
||||
//@ [cfi] compile-flags: -C codegen-units=1 -C lto -C prefer-dynamic=off -C opt-level=0
|
||||
//@ [cfi] compile-flags: -Z sanitizer=cfi
|
||||
//@ [kcfi] compile-flags: -Z sanitizer=kcfi
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
//@ needs-sanitizer-support
|
||||
//@ needs-sanitizer-dataflow
|
||||
//@ run-pass
|
||||
//@ compile-flags: -Zsanitizer=dataflow -Zsanitizer-dataflow-abilist={{src-base}}/sanitizer/dataflow-abilist.txt
|
||||
//@ compile-flags: -Zsanitizer=dataflow -Zsanitizer-dataflow-abilist={{src-base}}/sanitizer/dataflow-abilist.txt -C unsafe-allow-abi-mismatch=sanitizer
|
||||
|
||||
use std::mem::size_of;
|
||||
use std::os::raw::{c_int, c_long, c_void};
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
//@ ignore-aarch64-unknown-linux-gnu
|
||||
//
|
||||
// FIXME(#83989): codegen-units=1 triggers linker errors on aarch64-gnu
|
||||
//@ compile-flags: -Z sanitizer=hwaddress -O -g -C codegen-units=16
|
||||
//@ compile-flags: -Z sanitizer=hwaddress -O -g -C codegen-units=16 -C unsafe-allow-abi-mismatch=sanitizer
|
||||
//
|
||||
//@ run-fail
|
||||
//@ error-pattern: HWAddressSanitizer: tag-mismatch
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
// encode_ty and caused the compiler to ICE.
|
||||
//
|
||||
//@ needs-sanitizer-cfi
|
||||
//@ compile-flags: -Ccodegen-units=1 -Clto -Ctarget-feature=-crt-static -Zsanitizer=cfi
|
||||
//@ compile-flags: -Ccodegen-units=1 -Clto -Ctarget-feature=-crt-static -Zsanitizer=cfi -C unsafe-allow-abi-mismatch=sanitizer
|
||||
//@ edition: 2021
|
||||
//@ no-prefer-dynamic
|
||||
//@ only-x86_64-unknown-linux-gnu
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
// was expecting array type lengths to be evaluated, this was causing an ICE.
|
||||
//
|
||||
//@ build-pass
|
||||
//@ compile-flags: -Ccodegen-units=1 -Clto -Zsanitizer=cfi -Ctarget-feature=-crt-static
|
||||
//@ compile-flags: -Ccodegen-units=1 -Clto -Zsanitizer=cfi -Ctarget-feature=-crt-static -C unsafe-allow-abi-mismatch=sanitizer
|
||||
//@ needs-sanitizer-cfi
|
||||
|
||||
#![crate_type = "lib"]
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
//@ needs-sanitizer-address
|
||||
//@ ignore-cross-compile
|
||||
//
|
||||
//@ compile-flags: -Copt-level=0 -Zsanitizer=address
|
||||
//@ compile-flags: -Copt-level=0 -Zsanitizer=address -C unsafe-allow-abi-mismatch=sanitizer
|
||||
//@ run-pass
|
||||
|
||||
pub struct Wrap {
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
//@ needs-sanitizer-kcfi
|
||||
//@ no-prefer-dynamic
|
||||
//@ compile-flags: -C panic=abort -Zsanitizer=kcfi -C symbol-mangling-version=v0
|
||||
//@ compile-flags: -C panic=abort -Zsanitizer=kcfi -C symbol-mangling-version=v0 -C unsafe-allow-abi-mismatch=sanitizer
|
||||
//@ build-pass
|
||||
//@ ignore-backends: gcc
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
//@ needs-sanitizer-support
|
||||
//@ needs-sanitizer-leak
|
||||
//
|
||||
//@ compile-flags: -Z sanitizer=leak -O
|
||||
//@ compile-flags: -Z sanitizer=leak -O -C unsafe-allow-abi-mismatch=sanitizer
|
||||
//
|
||||
//@ run-fail
|
||||
//@ error-pattern: LeakSanitizer: detected memory leaks
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
//@ needs-sanitizer-support
|
||||
//@ needs-sanitizer-memory
|
||||
//
|
||||
//@ compile-flags: -C unsafe-allow-abi-mismatch=sanitizer
|
||||
//
|
||||
//@ revisions: unoptimized optimized
|
||||
//
|
||||
//@ [optimized]compile-flags: -Z sanitizer=memory -Zsanitizer-memory-track-origins -O
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
//@ needs-sanitizer-support
|
||||
//@ needs-sanitizer-memory
|
||||
//
|
||||
//@ compile-flags: -C unsafe-allow-abi-mismatch=sanitizer
|
||||
//
|
||||
//@ revisions: unoptimized optimized
|
||||
//
|
||||
//@ [optimized]compile-flags: -Z sanitizer=memory -Zsanitizer-memory-track-origins -O
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
//@ needs-sanitizer-support
|
||||
//@ needs-sanitizer-memory
|
||||
//
|
||||
//@ compile-flags: -C unsafe-allow-abi-mismatch=sanitizer
|
||||
//
|
||||
//@ revisions: unoptimized optimized
|
||||
//
|
||||
//@ [optimized]compile-flags: -Z sanitizer=memory -Zsanitizer-memory-track-origins -O
|
||||
|
|
|
|||
|
|
@ -6,6 +6,8 @@
|
|||
//@ needs-sanitizer-address
|
||||
//@ ignore-cross-compile
|
||||
//
|
||||
//@ compile-flags: -C unsafe-allow-abi-mismatch=sanitizer
|
||||
//
|
||||
//@ no-prefer-dynamic
|
||||
//@ revisions: opt0 opt1
|
||||
//@ compile-flags: -Zsanitizer=address -Clto=thin
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@
|
|||
//@ needs-sanitizer-support
|
||||
//@ needs-sanitizer-thread
|
||||
//
|
||||
//@ compile-flags: -Z sanitizer=thread -O
|
||||
//@ compile-flags: -Z sanitizer=thread -O -C unsafe-allow-abi-mismatch=sanitizer
|
||||
//
|
||||
//@ run-fail-or-crash
|
||||
//@ error-pattern: WARNING: ThreadSanitizer: data race
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
//@ needs-sanitizer-address
|
||||
//@ ignore-cross-compile
|
||||
//
|
||||
//@ compile-flags: -Zsanitizer=address
|
||||
//@ compile-flags: -Zsanitizer=address -C unsafe-allow-abi-mismatch=sanitizer
|
||||
//@ run-fail-or-crash
|
||||
//@ error-pattern: ERROR: AddressSanitizer: stack-use-after-scope
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,7 @@
|
|||
//@ no-prefer-dynamic
|
||||
//@ needs-sanitizer-kcfi
|
||||
//@ compile-flags: -C panic=abort -Zsanitizer=kcfi -Zsanitizer-cfi-normalize-integers
|
||||
|
||||
#![feature(no_core)]
|
||||
#![crate_type = "rlib"]
|
||||
#![no_core]
|
||||
6
tests/ui/target_modifiers/auxiliary/no-sanitizers.rs
Normal file
6
tests/ui/target_modifiers/auxiliary/no-sanitizers.rs
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
//@ no-prefer-dynamic
|
||||
//@ compile-flags: -C panic=abort
|
||||
|
||||
#![feature(no_core)]
|
||||
#![crate_type = "rlib"]
|
||||
#![no_core]
|
||||
10
tests/ui/target_modifiers/auxiliary/safestack-and-kcfi.rs
Normal file
10
tests/ui/target_modifiers/auxiliary/safestack-and-kcfi.rs
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
//@ no-prefer-dynamic
|
||||
|
||||
//@ needs-sanitizer-kcfi
|
||||
//@ needs-sanitizer-safestack
|
||||
|
||||
//@ compile-flags: -C panic=abort -Zsanitizer=safestack,kcfi
|
||||
|
||||
#![feature(no_core)]
|
||||
#![crate_type = "rlib"]
|
||||
#![no_core]
|
||||
18
tests/ui/target_modifiers/sanitizer-kcfi-normalize-ints.rs
Normal file
18
tests/ui/target_modifiers/sanitizer-kcfi-normalize-ints.rs
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
// For kCFI, the helper flag -Zsanitizer-cfi-normalize-integers should also be a target modifier.
|
||||
|
||||
//@ needs-sanitizer-kcfi
|
||||
//@ aux-build:kcfi-normalize-ints.rs
|
||||
//@ compile-flags: -Cpanic=abort
|
||||
|
||||
//@ revisions: ok wrong_flag wrong_sanitizer
|
||||
//@[ok] compile-flags: -Zsanitizer=kcfi -Zsanitizer-cfi-normalize-integers
|
||||
//@[wrong_flag] compile-flags: -Zsanitizer=kcfi
|
||||
//@[ok] check-pass
|
||||
|
||||
#![feature(no_core)]
|
||||
//[wrong_flag]~^ ERROR mixing `-Zsanitizer-cfi-normalize-integers` will cause an ABI mismatch in crate `sanitizer_kcfi_normalize_ints`
|
||||
//[wrong_sanitizer]~^^ ERROR mixing `-Zsanitizer` will cause an ABI mismatch in crate `sanitizer_kcfi_normalize_ints`
|
||||
#![crate_type = "rlib"]
|
||||
#![no_core]
|
||||
|
||||
extern crate kcfi_normalize_ints;
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
error: mixing `-Zsanitizer-cfi-normalize-integers` will cause an ABI mismatch in crate `sanitizer_kcfi_normalize_ints`
|
||||
--> $DIR/sanitizer-kcfi-normalize-ints.rs:12:1
|
||||
|
|
||||
LL | #![feature(no_core)]
|
||||
| ^
|
||||
|
|
||||
= help: the `-Zsanitizer-cfi-normalize-integers` flag modifies the ABI so Rust crates compiled with different values of this flag cannot be used together safely
|
||||
= note: unset `-Zsanitizer-cfi-normalize-integers` in this crate is incompatible with `-Zsanitizer-cfi-normalize-integers=` in dependency `kcfi_normalize_ints`
|
||||
= help: set `-Zsanitizer-cfi-normalize-integers=` in this crate or unset `-Zsanitizer-cfi-normalize-integers` in `kcfi_normalize_ints`
|
||||
= help: if you are sure this will not cause problems, you may use `-Cunsafe-allow-abi-mismatch=sanitizer-cfi-normalize-integers` to silence this error
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
error: mixing `-Zsanitizer` will cause an ABI mismatch in crate `sanitizer_kcfi_normalize_ints`
|
||||
--> $DIR/sanitizer-kcfi-normalize-ints.rs:12:1
|
||||
|
|
||||
LL | #![feature(no_core)]
|
||||
| ^
|
||||
|
|
||||
= help: the `-Zsanitizer` flag modifies the ABI so Rust crates compiled with different values of this flag cannot be used together safely
|
||||
= note: unset `-Zsanitizer` in this crate is incompatible with `-Zsanitizer=kcfi` in dependency `kcfi_normalize_ints`
|
||||
= help: set `-Zsanitizer=kcfi` in this crate or unset `-Zsanitizer` in `kcfi_normalize_ints`
|
||||
= help: if you are sure this will not cause problems, you may use `-Cunsafe-allow-abi-mismatch=sanitizer` to silence this error
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
// AddressSanitizer, LeakSanitizer are good to be inconsistent (they are not a target modifiers)
|
||||
|
||||
//@ revisions: wrong_address_san wrong_leak_san
|
||||
|
||||
//@[wrong_address_san] needs-sanitizer-address
|
||||
//@[wrong_leak_san] needs-sanitizer-leak
|
||||
|
||||
//@ aux-build:no-sanitizers.rs
|
||||
//@ compile-flags: -Cpanic=abort -C target-feature=-crt-static
|
||||
|
||||
//@[wrong_address_san] compile-flags: -Zsanitizer=address
|
||||
//@[wrong_leak_san] compile-flags: -Zsanitizer=leak
|
||||
//@ check-pass
|
||||
|
||||
#![feature(no_core)]
|
||||
#![crate_type = "rlib"]
|
||||
#![no_core]
|
||||
|
||||
extern crate no_sanitizers;
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
error: mixing `-Zsanitizer` will cause an ABI mismatch in crate `sanitizers_safestack_and_kcfi`
|
||||
--> $DIR/sanitizers-safestack-and-kcfi.rs:16:1
|
||||
|
|
||||
LL | #![feature(no_core)]
|
||||
| ^
|
||||
|
|
||||
= help: the `-Zsanitizer` flag modifies the ABI so Rust crates compiled with different values of this flag cannot be used together safely
|
||||
= note: unset `-Zsanitizer` in this crate is incompatible with `-Zsanitizer=safestack,kcfi` in dependency `safestack_and_kcfi`
|
||||
= help: set `-Zsanitizer=safestack,kcfi` in this crate or unset `-Zsanitizer` in `safestack_and_kcfi`
|
||||
= help: if you are sure this will not cause problems, you may use `-Cunsafe-allow-abi-mismatch=sanitizer` to silence this error
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
error: mixing `-Zsanitizer` will cause an ABI mismatch in crate `sanitizers_safestack_and_kcfi`
|
||||
--> $DIR/sanitizers-safestack-and-kcfi.rs:16:1
|
||||
|
|
||||
LL | #![feature(no_core)]
|
||||
| ^
|
||||
|
|
||||
= help: the `-Zsanitizer` flag modifies the ABI so Rust crates compiled with different values of this flag cannot be used together safely
|
||||
= note: `-Zsanitizer=safestack` in this crate is incompatible with `-Zsanitizer=safestack,kcfi` in dependency `safestack_and_kcfi`
|
||||
= help: set `-Zsanitizer=safestack,kcfi` in this crate or `-Zsanitizer=safestack` in `safestack_and_kcfi`
|
||||
= help: if you are sure this will not cause problems, you may use `-Cunsafe-allow-abi-mismatch=sanitizer` to silence this error
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
error: mixing `-Zsanitizer` will cause an ABI mismatch in crate `sanitizers_safestack_and_kcfi`
|
||||
--> $DIR/sanitizers-safestack-and-kcfi.rs:16:1
|
||||
|
|
||||
LL | #![feature(no_core)]
|
||||
| ^
|
||||
|
|
||||
= help: the `-Zsanitizer` flag modifies the ABI so Rust crates compiled with different values of this flag cannot be used together safely
|
||||
= note: `-Zsanitizer=kcfi` in this crate is incompatible with `-Zsanitizer=safestack,kcfi` in dependency `safestack_and_kcfi`
|
||||
= help: set `-Zsanitizer=safestack,kcfi` in this crate or `-Zsanitizer=kcfi` in `safestack_and_kcfi`
|
||||
= help: if you are sure this will not cause problems, you may use `-Cunsafe-allow-abi-mismatch=sanitizer` to silence this error
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
|
||||
23
tests/ui/target_modifiers/sanitizers-safestack-and-kcfi.rs
Normal file
23
tests/ui/target_modifiers/sanitizers-safestack-and-kcfi.rs
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
//@ needs-sanitizer-kcfi
|
||||
//@ needs-sanitizer-safestack
|
||||
|
||||
//@ aux-build:safestack-and-kcfi.rs
|
||||
//@ compile-flags: -Cpanic=abort
|
||||
|
||||
//@ revisions: good good_reverted missed_safestack missed_kcfi missed_both
|
||||
//@[good] compile-flags: -Zsanitizer=safestack,kcfi
|
||||
//@[good_reverted] compile-flags: -Zsanitizer=kcfi,safestack
|
||||
//@[missed_safestack] compile-flags: -Zsanitizer=kcfi
|
||||
//@[missed_kcfi] compile-flags: -Zsanitizer=safestack
|
||||
// [missed_both] no additional compile-flags:
|
||||
//@[good] check-pass
|
||||
//@[good_reverted] check-pass
|
||||
|
||||
#![feature(no_core)]
|
||||
//[missed_safestack]~^ ERROR mixing `-Zsanitizer` will cause an ABI mismatch in crate `sanitizers_safestack_and_kcfi`
|
||||
//[missed_kcfi]~^^ ERROR mixing `-Zsanitizer` will cause an ABI mismatch in crate `sanitizers_safestack_and_kcfi`
|
||||
//[missed_both]~^^^ ERROR mixing `-Zsanitizer` will cause an ABI mismatch in crate `sanitizers_safestack_and_kcfi`
|
||||
#![crate_type = "rlib"]
|
||||
#![no_core]
|
||||
|
||||
extern crate safestack_and_kcfi;
|
||||
Loading…
Add table
Add a link
Reference in a new issue