From 613a436cfc7243d3b37d95b83fcf7aa9639f84da Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Thu, 1 Sep 2022 12:29:48 +0200 Subject: [PATCH] add extra sanity check against depending on system time with isolation enabled --- src/concurrency/thread.rs | 3 +++ src/machine.rs | 1 + 2 files changed, 4 insertions(+) diff --git a/src/concurrency/thread.rs b/src/concurrency/thread.rs index 5364b341ae3a..78a357dd6aff 100644 --- a/src/concurrency/thread.rs +++ b/src/concurrency/thread.rs @@ -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); } diff --git a/src/machine.rs b/src/machine.rs index 4cfedd3bdf42..bd2c43004653 100644 --- a/src/machine.rs +++ b/src/machine.rs @@ -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(())