Skip to content

Commit 1362c5f

Browse files
committed
Auto merge of #3966 - RalfJung:dont-trust-the-user, r=RalfJung
Do not store synchronization primitive IDs in adressable memory We shouldn't store this in a place where the program can mess with it. Fixes #1649 Blocked by rust-lang/rust#131593
2 parents e2c21d4 + 323ab1c commit 1362c5f

15 files changed

+383
-495
lines changed

Diff for: src/concurrency/init_once.rs

-17
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ use std::collections::VecDeque;
22

33
use rustc_index::Idx;
44

5-
use super::sync::EvalContextExtPriv as _;
65
use super::vector_clock::VClock;
76
use crate::*;
87

@@ -27,22 +26,6 @@ pub(super) struct InitOnce {
2726

2827
impl<'tcx> EvalContextExt<'tcx> for crate::MiriInterpCx<'tcx> {}
2928
pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
30-
fn init_once_get_or_create_id(
31-
&mut self,
32-
lock: &MPlaceTy<'tcx>,
33-
offset: u64,
34-
) -> InterpResult<'tcx, InitOnceId> {
35-
let this = self.eval_context_mut();
36-
this.get_or_create_id(
37-
lock,
38-
offset,
39-
|ecx| &mut ecx.machine.sync.init_onces,
40-
|_| interp_ok(Default::default()),
41-
)?
42-
.ok_or_else(|| err_ub_format!("init_once has invalid ID"))
43-
.into()
44-
}
45-
4629
#[inline]
4730
fn init_once_status(&mut self, id: InitOnceId) -> InitOnceStatus {
4831
let this = self.eval_context_ref();

0 commit comments

Comments
 (0)