about summary refs log tree commit diff
diff options
context:
space:
mode:
authorRalf Jung <post@ralfj.de>2022-09-01 12:29:48 +0200
committerChristian Poveda <git@pvdrz.com>2022-09-13 15:16:41 -0500
commit613a436cfc7243d3b37d95b83fcf7aa9639f84da (patch)
tree50c3e2c24799c91af5bdb3d6c65b58dd590a18c5
parentbc307b40bad4fe33319db3e61e779aacb853d4ca (diff)
downloadrust-613a436cfc7243d3b37d95b83fcf7aa9639f84da.tar.gz
rust-613a436cfc7243d3b37d95b83fcf7aa9639f84da.zip
add extra sanity check against depending on system time with isolation enabled
-rw-r--r--src/concurrency/thread.rs3
-rw-r--r--src/machine.rs1
2 files changed, 4 insertions, 0 deletions
diff --git a/src/concurrency/thread.rs b/src/concurrency/thread.rs
index 5364b341ae3..78a357dd6af 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 4cfedd3bdf4..bd2c4300465 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(())