Skip to main content

LinuxOs

Struct LinuxOs 

Source
pub struct LinuxOs<Driver>
where Driver: VmiDriver,
{ /* private fields */ }
Expand description

VMI operations for the Linux operating system.

LinuxOs provides methods and utilities for introspecting a Linux-based virtual machine. It encapsulates Linux-specific knowledge and operations, allowing for high-level interactions with the guest OS structures and processes.

Implementations§

Source§

impl<Driver> LinuxOs<Driver>
where Driver: VmiRead, Driver::Architecture: ArchAdapter<Driver>,

Source

pub fn new(profile: &Profile<'_>) -> Result<Self, VmiError>

Creates a new LinuxOs instance.

Source

pub fn find_banner( vmi: &VmiCore<Driver>, registers: &<Driver::Architecture as Architecture>::Registers, ) -> Result<Option<String>, VmiError>

Locates and retrieves the Linux banner string from kernel memory.

The banner string typically contains kernel version information and build details.

Source

pub fn kaslr_offset(vmi: VmiState<'_, Self>) -> Result<u64, VmiError>

Returns the KASLR (Kernel Address Space Layout Randomization) offset.

This value represents the randomized offset applied to the kernel’s base address when KASLR is enabled.

Source

pub fn per_cpu(vmi: VmiState<'_, Self>) -> Va

Retrieves the per-CPU base address for the current CPU.

Linux maintains per-CPU data structures, and this method returns the base address for accessing such data on the current processor.

Source

pub fn linked_list<'a>( vmi: VmiState<'a, Self>, list_head: Va, offset: u64, ) -> Result<impl Iterator<Item = Result<Va, VmiError>> + use<'a, Driver>, VmiError>

Returns an iterator over a doubly-linked list of LIST_ENTRY structures.

This method is used to iterate over a doubly-linked list of LIST_ENTRY structures in memory. It returns an iterator that yields the virtual addresses of each LIST_ENTRY structure in the list.

Source

pub fn construct_path( _vmi: VmiState<'_, Self>, path: &LinuxPath<'_, Driver>, root: &LinuxPath<'_, Driver>, ) -> Result<String, VmiError>

Constructs a file path string from path components in the kernel.

This method walks the dentry chain to build a complete path, handling mount points and filesystem boundaries appropriately. Both the path and root arguments should be pointers to struct path objects.

Trait Implementations§

Source§

impl<Driver> VmiOs for LinuxOs<Driver>
where Driver: VmiRead, Driver::Architecture: ArchAdapter<Driver>,

Source§

type Architecture = <Driver as VmiDriver>::Architecture

The architecture.
Source§

type Driver = Driver

The driver.
Source§

type Process<'a> = LinuxTaskStruct<'a, Driver>

The process type.
Source§

type Thread<'a> = LinuxThread

The thread type.
Source§

type Image<'a> = LinuxImage

The image type.
Source§

type Module<'a> = LinuxModule

The kernel module type.
Source§

type UserModule<'a> = LinuxUserModule

The user-mode module type.
Source§

type Region<'a> = LinuxVmAreaStruct<'a, Driver>

The memory region type.
Source§

type Mapped<'a> = LinuxMapped

The memory mapped region type.
Source§

fn kernel_image_base(_vmi: VmiState<'_, Self>) -> Result<Va, VmiError>

Retrieves the base address of the kernel image. Read more
Source§

fn kernel_information_string( _vmi: VmiState<'_, Self>, ) -> Result<String, VmiError>

Retrieves an implementation-specific string containing kernel information. Read more
Source§

fn kpti_enabled(_vmi: VmiState<'_, Self>) -> Result<bool, VmiError>

Checks if Kernel Page Table Isolation (KPTI) is enabled. Read more
Source§

fn modules<'a>( _vmi: VmiState<'a, Self>, ) -> Result<impl Iterator<Item = Result<Self::Module<'a>, VmiError>> + use<'a, Driver>, VmiError>

Returns an iterator over the loaded kernel modules. Read more
Source§

fn processes<'a>( vmi: VmiState<'a, Self>, ) -> Result<impl Iterator<Item = Result<Self::Process<'a>, VmiError>> + use<'a, Driver>, VmiError>

Returns an iterator over the processes. Read more
Source§

fn process( vmi: VmiState<'_, Self>, process: ProcessObject, ) -> Result<Self::Process<'_>, VmiError>

Returns the process corresponding to the given process object.
Source§

fn current_process( vmi: VmiState<'_, Self>, ) -> Result<Self::Process<'_>, VmiError>

Returns the currently executing process.
Source§

fn system_process( vmi: VmiState<'_, Self>, ) -> Result<Self::Process<'_>, VmiError>

Returns the system process object. Read more
Source§

fn thread( _vmi: VmiState<'_, Self>, _thread: ThreadObject, ) -> Result<Self::Thread<'_>, VmiError>

Returns the thread corresponding to the given thread object.
Source§

fn current_thread( _vmi: VmiState<'_, Self>, ) -> Result<Self::Thread<'_>, VmiError>

Returns the currently executing thread.
Source§

fn image( _vmi: VmiState<'_, Self>, _image_base: Va, ) -> Result<Self::Image<'_>, VmiError>

Returns the image corresponding to the given base address.
Source§

fn module( _vmi: VmiState<'_, Self>, _module: Va, ) -> Result<Self::Module<'_>, VmiError>

Returns the kernel module corresponding to the given base address.
Source§

fn user_module( _vmi: VmiState<'_, Self>, _module: Va, _root: Pa, ) -> Result<Self::UserModule<'_>, VmiError>

Returns the user-mode module corresponding to the given base address.
Source§

fn region( vmi: VmiState<'_, Self>, region: Va, ) -> Result<Self::Region<'_>, VmiError>

Returns the memory region corresponding to the given address. Read more
Source§

fn syscall_argument( vmi: VmiState<'_, Self>, index: u64, ) -> Result<u64, VmiError>

Retrieves a specific syscall argument according to the system call ABI. Read more
Source§

fn function_argument( vmi: VmiState<'_, Self>, index: u64, ) -> Result<u64, VmiError>

Retrieves a specific function argument according to the calling convention of the operating system. Read more
Source§

fn function_return_value(vmi: VmiState<'_, Self>) -> Result<u64, VmiError>

Retrieves the return value of a function. Read more
Source§

fn last_error(_vmi: VmiState<'_, Self>) -> Result<Option<u32>, VmiError>

Retrieves the last error value. Read more

Auto Trait Implementations§

§

impl<Driver> !Freeze for LinuxOs<Driver>

§

impl<Driver> !RefUnwindSafe for LinuxOs<Driver>

§

impl<Driver> !Sync for LinuxOs<Driver>

§

impl<Driver> Send for LinuxOs<Driver>
where PhantomData<Driver>: Send,

§

impl<Driver> Unpin for LinuxOs<Driver>
where PhantomData<Driver>: Unpin,

§

impl<Driver> UnsafeUnpin for LinuxOs<Driver>
where PhantomData<Driver>: UnsafeUnpin,

§

impl<Driver> UnwindSafe for LinuxOs<Driver>
where PhantomData<Driver>: UnwindSafe,

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

Source§

type ArchivedMetadata = ()

The archived version of the pointer metadata for this type.
Source§

fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata

Converts some archived metadata to the pointer metadata for itself.
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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> LayoutRaw for T

Source§

fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>

Returns the layout of the type.
Source§

impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
where T: SharedNiching<N1, N2>, N1: Niching<T>, N2: Niching<T>,

Source§

unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool

Returns whether the given value has been niched. Read more
Source§

fn resolve_niched(out: Place<NichedOption<T, N1>>)

Writes data to out indicating that a T is niched.
Source§

impl<T> Pointee for T

Source§

type Metadata = ()

The metadata type for pointers and references to this type.
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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.
Source§

impl<T> VmiOsExt for T
where T: VmiOs,

Source§

fn find_process<'a>( vmi: VmiState<'a, Self>, predicate: impl ProcessPredicate<Self>, ) -> Result<Option<Self::Process<'a>>, VmiError>

Returns the first process matching predicate, or Ok(None) if no live process matches.
Source§

fn filter_processes<'a>( vmi: VmiState<'a, Self>, predicate: impl ProcessPredicate<Self>, ) -> Result<impl Iterator<Item = Result<Self::Process<'a>, VmiError>>, VmiError>

Returns an iterator over the processes matching predicate.
Source§

fn find_module<'a>( vmi: VmiState<'a, Self>, predicate: impl ModulePredicate<Self>, ) -> Result<Option<Self::Module<'a>>, VmiError>

Returns the first kernel module matching predicate, or Ok(None) if no loaded module matches.
Source§

fn filter_modules<'a>( vmi: VmiState<'a, Self>, predicate: impl ModulePredicate<Self>, ) -> Result<impl Iterator<Item = Result<Self::Module<'a>, VmiError>>, VmiError>

Returns an iterator over the kernel modules matching predicate.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more