File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed 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(
555555 // - Continue
556556
557557 // 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 ) {
559559 ptrace:: write ( pid, std:: ptr:: with_exposed_provenance_mut ( a) , 0 ) . unwrap ( ) ;
560560 }
561561
@@ -601,6 +601,11 @@ fn handle_segfault(
601601 // Also, don't let it continue with unprotected memory if something errors!
602602 let _ = wait:: waitid ( wait:: Id :: Pid ( pid) , WAIT_FLAGS ) . map_err ( |_| ExecError :: Died ( None ) ) ?;
603603
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+
604609 // Save registers and grab the bytes that were executed. This would
605610 // be really nasty if it was a jump or similar but those thankfully
606611 // won't do memory accesses and so can't trigger this!
You can’t perform that action at this time.
0 commit comments