Skip to content

Commit 613a436

Browse files
RalfJungpvdrz
authored andcommitted
add extra sanity check against depending on system time with isolation enabled
1 parent bc307b4 commit 613a436

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
@@ -869,6 +869,9 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
869869
callback: TimeoutCallback<'mir, 'tcx>,
870870
) {
871871
let this = self.eval_context_mut();
872+
if !this.machine.communicate() && matches!(call_time, Time::RealTime(..)) {
873+
panic!("cannot have `RealTime` callback with isolation enabled!")
874+
}
872875
this.machine.threads.register_timeout_callback(thread, call_time, callback);
873876
}
874877

src/machine.rs

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

1039+
// Make sure some time passes.
10391040
ecx.machine.clock.tick();
10401041

10411042
Ok(())

0 commit comments

Comments
 (0)