we don't need no whitelist

This commit is contained in:
Ralf Jung 2018-12-02 17:18:25 +01:00
parent c9bb212cae
commit 6df89de68a

View File

@ -310,26 +310,9 @@ impl<'a, 'mir, 'tcx> Machine<'a, 'mir, 'tcx> for Evaluator<'tcx> {
const STATIC_KIND: Option<MiriMemoryKind> = Some(MiriMemoryKind::MutStatic);
#[inline(always)]
fn enforce_validity(ecx: &EvalContext<'a, 'mir, 'tcx, Self>) -> bool {
if !ecx.machine.validate {
return false;
}
// Some functions are whitelisted until we figure out how to fix them.
// We walk up the stack a few frames to also cover their callees.
const WHITELIST: &[(&str, &str)] = &[
// Uses mem::uninitialized
("std::sys::windows::mutex::Mutex::", ""),
];
for frame in ecx.stack().iter()
.rev().take(3)
{
let name = frame.instance.to_string();
if WHITELIST.iter().any(|(prefix, suffix)| name.starts_with(prefix) && name.ends_with(suffix)) {
return false;
}
}
true
ecx.machine.validate
}
/// Returns Ok() when the function was handled, fail otherwise