fix dumb mistake
This commit is contained in:
parent
fdc2d52bc8
commit
d20f3a83c2
1 changed files with 6 additions and 1 deletions
|
|
@ -555,7 +555,7 @@ fn handle_segfault(
|
|||
// - Continue
|
||||
|
||||
// Ensure the stack is properly zeroed out!
|
||||
for a in (ch_stack..ch_stack.strict_add(page_size)).step_by(ARCH_WORD_SIZE) {
|
||||
for a in (ch_stack..ch_stack.strict_add(FAKE_STACK_SIZE)).step_by(ARCH_WORD_SIZE) {
|
||||
ptrace::write(pid, std::ptr::with_exposed_provenance_mut(a), 0).unwrap();
|
||||
}
|
||||
|
||||
|
|
@ -601,6 +601,11 @@ fn handle_segfault(
|
|||
// Also, don't let it continue with unprotected memory if something errors!
|
||||
let _ = wait::waitid(wait::Id::Pid(pid), WAIT_FLAGS).map_err(|_| ExecError::Died(None))?;
|
||||
|
||||
// Zero out again to be safe
|
||||
for a in (ch_stack..ch_stack.strict_add(FAKE_STACK_SIZE)).step_by(ARCH_WORD_SIZE) {
|
||||
ptrace::write(pid, std::ptr::with_exposed_provenance_mut(a), 0).unwrap();
|
||||
}
|
||||
|
||||
// Save registers and grab the bytes that were executed. This would
|
||||
// be really nasty if it was a jump or similar but those thankfully
|
||||
// won't do memory accesses and so can't trigger this!
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue