Skip to content

Commit 780c566

Browse files
committed
add extra sanity check against depending on system time with isolation enabled
1 parent 86f3491 commit 780c566

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

src/concurrency/thread.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -865,6 +865,9 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
865865
callback: TimeoutCallback<'mir, 'tcx>,
866866
) {
867867
let this = self.eval_context_mut();
868+
if !this.machine.communicate() && matches!(call_time, Time::RealTime(..)) {
869+
panic!("cannot have `RealTime` callback with isolation enabled!")
870+
}
868871
this.machine.threads.register_timeout_callback(thread, call_time, callback);
869872
}
870873

src/machine.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1018,6 +1018,7 @@ impl<'mir, 'tcx> Machine<'mir, 'tcx> for Evaluator<'mir, 'tcx> {
10181018
// These are our preemption points.
10191019
ecx.maybe_preempt_active_thread();
10201020

1021+
// Make sure some time passes.
10211022
ecx.machine.clock.tick();
10221023

10231024
Ok(())

0 commit comments

Comments
 (0)