File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed
src/tools/miri/src/shims/trace Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -555,7 +555,7 @@ fn handle_segfault(
555
555
// - Continue
556
556
557
557
// Ensure the stack is properly zeroed out!
558
- for a in ( ch_stack..ch_stack. strict_add ( page_size ) ) . step_by ( ARCH_WORD_SIZE ) {
558
+ for a in ( ch_stack..ch_stack. strict_add ( FAKE_STACK_SIZE ) ) . step_by ( ARCH_WORD_SIZE ) {
559
559
ptrace:: write ( pid, std:: ptr:: with_exposed_provenance_mut ( a) , 0 ) . unwrap ( ) ;
560
560
}
561
561
@@ -601,6 +601,11 @@ fn handle_segfault(
601
601
// Also, don't let it continue with unprotected memory if something errors!
602
602
let _ = wait:: waitid ( wait:: Id :: Pid ( pid) , WAIT_FLAGS ) . map_err ( |_| ExecError :: Died ( None ) ) ?;
603
603
604
+ // Zero out again to be safe
605
+ for a in ( ch_stack..ch_stack. strict_add ( FAKE_STACK_SIZE ) ) . step_by ( ARCH_WORD_SIZE ) {
606
+ ptrace:: write ( pid, std:: ptr:: with_exposed_provenance_mut ( a) , 0 ) . unwrap ( ) ;
607
+ }
608
+
604
609
// Save registers and grab the bytes that were executed. This would
605
610
// be really nasty if it was a jump or similar but those thankfully
606
611
// won't do memory accesses and so can't trigger this!
You can’t perform that action at this time.
0 commit comments