Skip to content

Commit 17ff063

Browse files
committed
review comments
1 parent dc848f3 commit 17ff063

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

src/alloc/isolated_alloc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ impl IsolatedAlloc {
275275
for i in 0..size / self.page_size {
276276
pages.push(unsafe { ptr.add(i * self.page_size).expose_provenance() });
277277
}
278-
});
278+
}
279279
pages
280280
}
281281
}

src/bin/miri.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -798,7 +798,11 @@ fn main() {
798798
#[cfg(target_os = "linux")]
799799
if !miri_config.native_lib.is_empty() && !miri_config.force_old_native_lib {
800800
// FIXME: This should display a diagnostic / warning on error
801-
// SAFETY: No other threads have spawned yet
801+
// SAFETY: If any other threads exist at this point (e.g. for the ctrlc
802+
// handler), they will not interact with anything on the main rustc/Miri
803+
// thread in an async-signal-unsafe way such as by accessing shared
804+
// semaphores, etc.; the handler only calls `sleep()` and `exit()`, which
805+
// are async-signal-safe, and accessing atomics is also
802806
let _ = unsafe { miri::init_sv() };
803807
}
804808
run_compiler_and_exit(

src/shims/trace/child.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ use ipc_channel::ipc;
55
use nix::sys::{ptrace, signal};
66
use nix::unistd;
77

8-
use crate::alloc::isolated_alloc::IsolatedAlloc;
98
use super::messages::{Confirmation, MemEvents, TraceRequest};
109
use super::parent::{ChildListener, sv_loop};
1110
use super::{FAKE_STACK_SIZE, StartFfiInfo};
11+
use crate::alloc::isolated_alloc::IsolatedAlloc;
1212

1313
static SUPERVISOR: std::sync::Mutex<Option<Supervisor>> = std::sync::Mutex::new(None);
1414

@@ -135,7 +135,7 @@ impl Supervisor {
135135
/// receiving back events through `get_events`.
136136
///
137137
/// # Safety
138-
/// Only a single OS thread must exist in the process when calling this.
138+
/// The invariants for `fork()` must be upheld by the caller.
139139
pub unsafe fn init_sv() -> Result<(), SvInitError> {
140140
// On Linux, this will check whether ptrace is fully disabled by the Yama module.
141141
// If Yama isn't running or we're not on Linux, we'll still error later, but

0 commit comments

Comments
 (0)