add extra sanity check against depending on system time with isolation enabled

This commit is contained in:
Ralf Jung 2022-09-01 12:29:48 +02:00 committed by Christian Poveda
parent bc307b40ba
commit 613a436cfc
No known key found for this signature in database
GPG key ID: 27525EF5E7420A50
2 changed files with 4 additions and 0 deletions

View file

@ -869,6 +869,9 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
callback: TimeoutCallback<'mir, 'tcx>,
) {
let this = self.eval_context_mut();
if !this.machine.communicate() && matches!(call_time, Time::RealTime(..)) {
panic!("cannot have `RealTime` callback with isolation enabled!")
}
this.machine.threads.register_timeout_callback(thread, call_time, callback);
}

View file

@ -1036,6 +1036,7 @@ impl<'mir, 'tcx> Machine<'mir, 'tcx> for Evaluator<'mir, 'tcx> {
// These are our preemption points.
ecx.maybe_preempt_active_thread();
// Make sure some time passes.
ecx.machine.clock.tick();
Ok(())