diff options
-rw-r--r-- | ripple/minitrace/src/main.rs | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/ripple/minitrace/src/main.rs b/ripple/minitrace/src/main.rs index 847fb24..c7fb369 100644 --- a/ripple/minitrace/src/main.rs +++ b/ripple/minitrace/src/main.rs @@ -10,6 +10,7 @@ use { sys::{ personality::{self, Persona}, ptrace, + resource::{self, Resource as HostResource}, signal::Signal as HostSignal, wait::{waitpid, WaitPidFlag, WaitStatus}, }, @@ -64,6 +65,21 @@ impl Process { persona.insert(Persona::ADDR_NO_RANDOMIZE); personality::set(persona)?; + // set stack limit (to guarantee top-down address space layout) + resource::setrlimit( + HostResource::RLIMIT_STACK, + Some( + // not a particularly meaningful number, + // just plucked from the author's system + 8 * 1024 * 1024, + ), + Some( + 128 * 1024 * 1024 + // guard page + - 4096, + ), + )?; + ptrace::traceme()?; Ok(()) }); |