pub struct VmiTracker { /* private fields */ }Expand description
Untamperable host-side process tracker backed by SharedMemory introspection.
Implementations§
Source§impl VmiTracker
impl VmiTracker
pub fn new(memory: SharedMemory, memory_bytes: usize) -> Arc<Self> ⓘ
pub fn offsets(&self) -> Option<TaskStructOffsets>
Sourcepub fn read_proc(&self, task_addr: usize) -> Option<ProcInfo>
pub fn read_proc(&self, task_addr: usize) -> Option<ProcInfo>
Read a ProcInfo directly from a guest struct task_struct * address in SharedMemory.
Sourcepub fn calibrate(&self) -> Option<TaskStructOffsets>
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.
Sourcepub fn on_switch(&self, prev: i64, next: i64, prev_dead: i32, monitor: &Monitor)
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).
Sourcepub fn on_stack_drop(&self, task: i64, monitor: &Monitor)
pub fn on_stack_drop(&self, task: i64, monitor: &Monitor)
Hook called on wasm_stack_drop(task).
Sourcepub fn current_proc(&self) -> Option<ProcInfo>
pub fn current_proc(&self) -> Option<ProcInfo>
Read the currently executing guest process (if calibrated).
Sourcepub fn record_p9_tx(&self, monitor: &Monitor)
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.
Sourcepub fn record_net_tx(&self, monitor: &Monitor)
pub fn record_net_tx(&self, monitor: &Monitor)
Record the guest process currently sending a network frame.
Sourcepub fn last_p9_proc(&self) -> Option<ProcInfo>
pub fn last_p9_proc(&self) -> Option<ProcInfo>
Best-effort process attribution for an active 9P filesystem request.
Sourcepub fn last_net_proc(&self) -> Option<ProcInfo>
pub fn last_net_proc(&self) -> Option<ProcInfo>
Best-effort process attribution for an active network request.
Sourcepub fn active_processes(&self) -> Vec<ProcInfo>
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
impl Sync for VmiTracker
impl Unpin for VmiTracker
impl UnsafeUnpin for VmiTrackerwhere
*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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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