Skip to main content

VmiTracker

Struct VmiTracker 

Source
pub struct VmiTracker { /* private fields */ }
Expand description

Untamperable host-side process tracker backed by SharedMemory introspection.

Implementations§

Source§

impl VmiTracker

Source

pub fn new(memory: SharedMemory, memory_bytes: usize) -> Arc<Self> ⓘ

Source

pub fn offsets(&self) -> Option<TaskStructOffsets>

Source

pub fn read_proc(&self, task_addr: usize) -> Option<ProcInfo>

Read a ProcInfo directly from a guest struct task_struct * address in SharedMemory.

Source

pub fn calibrate(&self) -> Option<TaskStructOffsets>

Auto-calibrate struct task_struct offsets directly from live boot tasks in SharedMemory. Safe to call multiple times; locks offsets permanently once verified.

Source

pub fn on_switch(&self, prev: i64, next: i64, prev_dead: i32, monitor: &Monitor)

Hook called on every wasm_switch_to(prev, next, is_new, prev_dead).

Source

pub fn on_stack_drop(&self, task: i64, monitor: &Monitor)

Hook called on wasm_stack_drop(task).

Source

pub fn current_proc(&self) -> Option<ProcInfo>

Read the currently executing guest process (if calibrated).

Source

pub fn record_p9_tx(&self, monitor: &Monitor)

Record the guest process currently sending a 9P (vsock port 564) request. Linux net/9p/trans_fd dispatches TX via p9_write_work on kworker/*, so when current is a kernel thread (ppid == 2), attribute the request to the userspace task that just yielded into it.

Source

pub fn record_net_tx(&self, monitor: &Monitor)

Record the guest process currently sending a network frame.

Source

pub fn last_p9_proc(&self) -> Option<ProcInfo>

Best-effort process attribution for an active 9P filesystem request.

Source

pub fn last_net_proc(&self) -> Option<ProcInfo>

Best-effort process attribution for an active network request.

Source

pub fn active_processes(&self) -> Vec<ProcInfo>

Snapshot all currently live guest processes directly from SharedMemory (sorted by PID). Works instantaneously even while the guest VM is completely frozen via crate::Vm::pause.

Auto Trait Implementations§

§

impl !Freeze for VmiTracker

§

impl !RefUnwindSafe for VmiTracker

§

impl !UnwindSafe for VmiTracker

§

impl Forget for VmiTracker

§

impl Move for VmiTracker

§

impl Send for VmiTracker
where Arc<SharedMemoryInner>: Send, Arc<EngineInner>: Send, Atomic<u64>: Send, OnceLock<TaskStructOffsets>: Send, Mutex<VmiState>: Send,

§

impl Sync for VmiTracker
where Arc<SharedMemoryInner>: Sync, Arc<EngineInner>: Sync, Atomic<u64>: Sync, OnceLock<TaskStructOffsets>: Sync, Mutex<VmiState>: Sync,

§

impl Unpin for VmiTracker
where Arc<SharedMemoryInner>: Unpin, Arc<EngineInner>: Unpin, Align8<u64>: Unpin, Align4<u32>: Unpin, Align1<u8>: Unpin, *const u8 is !null: Unpin,

§

impl UnsafeUnpin for VmiTracker
where *const ArcInner<SharedMemoryInner> is !null: UnsafeUnpin, PhantomData<ArcInner<SharedMemoryInner>>: UnsafeUnpin, *const ArcInner<EngineInner> is !null: UnsafeUnpin, PhantomData<ArcInner<EngineInner>>: UnsafeUnpin, Align8<u64>: UnsafeUnpin, Align4<u32>: UnsafeUnpin, PhantomData<TaskStructOffsets>: UnsafeUnpin, Align1<u8>: UnsafeUnpin, *const u8 is !null: UnsafeUnpin, PhantomData<(usize, ())>: UnsafeUnpin, PhantomData<(usize, (u32, String))>: UnsafeUnpin, PhantomData<u8>: UnsafeUnpin,

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> 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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.