Skip to main content

Regs

Struct Regs 

Source
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: u64

Bytes already handed out below the red zone by Regs::alloc_stack.

Implementations§

Source§

impl Regs

Source

pub fn fetch(pid: i32) -> Result<Regs, i32>

Fetches the registers of pid.

Source

pub fn pid(&self) -> i32

Thread id these registers belong to.

Source

pub fn abi(&self) -> Abi

ABI the tracee made this syscall through.

Source

pub fn sysnum(&self) -> i64

Syscall number being entered, in the tracee’s own ABI numbering.

Source

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.

Source

pub fn arg(&self, i: usize) -> u64

Syscall argument i (0..6), in the register order of the tracee’s ABI.

Source

pub fn set_arg(&mut self, i: usize, v: u64)

Sets syscall argument i (0..6) in the register the tracee’s ABI uses.

Source

pub fn sp(&self) -> u64

Current stack pointer.

Source

pub fn ip(&self) -> u64

Current instruction pointer.

Source

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.

Source

pub fn commit(&self) -> Result<(), i32>

Writes the modified registers back if anything changed.

Trait Implementations§

Source§

impl Clone for Regs

Source§

fn clone(&self) -> Regs

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementations§

§

impl Freeze for Regs

§

impl RefUnwindSafe for Regs

§

impl Send for Regs

§

impl Sync for Regs

§

impl Unpin for Regs

§

impl UnsafeUnpin for Regs

§

impl UnwindSafe for Regs

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.