File tree Expand file tree Collapse file tree 3 files changed +9
-5
lines changed Expand file tree Collapse file tree 3 files changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -273,9 +273,9 @@ impl IsolatedAlloc {
273
273
self . page_ptrs . clone ( ) . into_iter ( ) . map ( |p| p. expose_provenance ( ) ) . collect ( ) ;
274
274
for ( ptr, size) in & self . huge_ptrs {
275
275
for i in 0 ..size / self . page_size {
276
- pages. push ( unsafe { ptr. add ( i * self . page_size ) . expose_provenance ( ) } ) ;
276
+ pages. push ( ptr. expose_provenance ( ) . strict_add ( i * self . page_size ) ) ;
277
277
}
278
- } ) ;
278
+ }
279
279
pages
280
280
}
281
281
}
Original file line number Diff line number Diff line change @@ -798,7 +798,11 @@ fn main() {
798
798
#[ cfg( target_os = "linux" ) ]
799
799
if !miri_config. native_lib . is_empty ( ) && !miri_config. force_old_native_lib {
800
800
// 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
802
806
let _ = unsafe { miri:: init_sv ( ) } ;
803
807
}
804
808
run_compiler_and_exit (
Original file line number Diff line number Diff line change @@ -5,10 +5,10 @@ use ipc_channel::ipc;
5
5
use nix:: sys:: { ptrace, signal} ;
6
6
use nix:: unistd;
7
7
8
- use crate :: alloc:: isolated_alloc:: IsolatedAlloc ;
9
8
use super :: messages:: { Confirmation , MemEvents , TraceRequest } ;
10
9
use super :: parent:: { ChildListener , sv_loop} ;
11
10
use super :: { FAKE_STACK_SIZE , StartFfiInfo } ;
11
+ use crate :: alloc:: isolated_alloc:: IsolatedAlloc ;
12
12
13
13
static SUPERVISOR : std:: sync:: Mutex < Option < Supervisor > > = std:: sync:: Mutex :: new ( None ) ;
14
14
@@ -135,7 +135,7 @@ impl Supervisor {
135
135
/// receiving back events through `get_events`.
136
136
///
137
137
/// # 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 .
139
139
pub unsafe fn init_sv ( ) -> Result < ( ) , SvInitError > {
140
140
// On Linux, this will check whether ptrace is fully disabled by the Yama module.
141
141
// If Yama isn't running or we're not on Linux, we'll still error later, but
You can’t perform that action at this time.
0 commit comments