File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed
src/tools/miri/src/shims/native_lib/trace Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -530,7 +530,18 @@ fn handle_segfault(
530530 // Don't use wait_for_signal here since 1 instruction doesn't give room
531531 // for any uncertainty + we don't want it `cont()`ing randomly by accident
532532 // Also, don't let it continue with unprotected memory if something errors!
533- let _ = wait:: waitid ( wait:: Id :: Pid ( pid) , WAIT_FLAGS ) . map_err ( |_| ExecEnd ( None ) ) ?;
533+ let stat = wait:: waitid ( wait:: Id :: Pid ( pid) , WAIT_FLAGS ) . map_err ( |_| ExecEnd ( None ) ) ?;
534+ match stat {
535+ wait:: WaitStatus :: Signaled ( _, s, _)
536+ | wait:: WaitStatus :: Stopped ( _, s)
537+ | wait:: WaitStatus :: PtraceEvent ( _, s, _) =>
538+ assert ! (
539+ !matches!( s, signal:: SIGSEGV ) ,
540+ "native code segfaulted when re-trying memory access\n \
541+ is the native code trying to call a Rust function?"
542+ ) ,
543+ _ => ( ) ,
544+ }
534545
535546 // Zero out again to be safe
536547 for a in ( ch_stack..ch_stack. strict_add ( CALLBACK_STACK_SIZE ) ) . step_by ( ARCH_WORD_SIZE ) {
You can’t perform that action at this time.
0 commit comments