pub struct Regs {
pid: i32,
orig: user_regs_struct,
cur: user_regs_struct,
scratch_used: u64,
}Expand description
Registers of a tracee stopped at syscall entry, with pending edits.
Fields§
§pid: i32§orig: user_regs_struct§cur: user_regs_struct§scratch_used: u64Bytes already handed out below the red zone by Regs::alloc_stack.
Implementations§
Source§impl Regs
impl Regs
Sourcepub fn fail(&mut self, errno: i32)
pub fn fail(&mut self, errno: i32)
Skips the syscall and makes it fail with errno: a tracer that sets the
number to -1 at the entry or seccomp stop has the tracee see whatever
it put in the result register (seccomp(2), SECCOMP_RET_TRACE), which
is ENOSYS left alone.
Sourcepub fn arg(&self, i: usize) -> u64
pub fn arg(&self, i: usize) -> u64
Syscall argument i (0..6), in the register order of the tracee’s ABI.
Sourcepub fn set_arg(&mut self, i: usize, v: u64)
pub fn set_arg(&mut self, i: usize, v: u64)
Sets syscall argument i (0..6) in the register the tracee’s ABI uses.
Sourcepub fn alloc_stack(&mut self, size: u64) -> u64
pub fn alloc_stack(&mut self, size: u64) -> u64
Reserves size bytes of scratch space below the tracee’s stack pointer.
The stack pointer itself is left untouched: we take no exit stop that
could restore it, and the memory below sp minus the red zone is
unused while the thread sits in the syscall instruction. (aarch64 has
no red zone; skipping one is harmless.) Successive reservations stack
downwards. For execve the kernel discards the whole stack anyway.
§Arguments
size- Bytes to reserve; the result is 16-byte aligned.
§Returns
The address of the reserved block in the tracee.