diff options
author | edef <edef@unfathomable.blue> | 2022-07-30 17:55:04 +0000 |
---|---|---|
committer | edef <edef@unfathomable.blue> | 2022-07-30 17:55:04 +0000 |
commit | dd94473c5724f8215790a9195df96cfa7bd6a04b (patch) | |
tree | ad30855e60fff52761f72db1c0029dc3d3f30f67 /ripple/minitrace | |
parent | af0e1c89df27f77f253e60a33d9a2e9484c86d07 (diff) | |
download | unf-legacy-dd94473c5724f8215790a9195df96cfa7bd6a04b.tar.zst |
ripple/minitrace: configure stack rlimits
Removing the RLIMIT_STACK soft limit changes address space layout markedly. Change-Id: I64d1a1fc1b397200245d5f790ce126c99d4b4797
Diffstat (limited to 'ripple/minitrace')
-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(()) }); |