pub struct LinuxTaskStruct<'a, Driver>where
Driver: VmiRead,
Driver::Architecture: ArchAdapter<Driver>,{ /* private fields */ }Expand description
A Linux task struct.
The task_struct is the process descriptor in the Linux kernel,
representing a task (process or thread).
§Implementation Details
Corresponds to task_struct.
Implementations§
Source§impl<'a, Driver> LinuxTaskStruct<'a, Driver>where
Driver: VmiRead,
Driver::Architecture: ArchAdapter<Driver>,
impl<'a, Driver> LinuxTaskStruct<'a, Driver>where
Driver: VmiRead,
Driver::Architecture: ArchAdapter<Driver>,
Sourcepub fn new(vmi: VmiState<'a, LinuxOs<Driver>>, process: ProcessObject) -> Self
pub fn new(vmi: VmiState<'a, LinuxOs<Driver>>, process: ProcessObject) -> Self
Creates a new Linux task struct.
Sourcepub fn flags(&self) -> Result<u32, VmiError>
pub fn flags(&self) -> Result<u32, VmiError>
Returns the process flags.
Process flags in Linux include information about the process state, such as whether it’s exiting, a kernel thread, etc.
§Implementation Details
Corresponds to task_struct.flags.
Sourcepub fn mm(&self) -> Result<Option<LinuxMmStruct<'a, Driver>>, VmiError>
pub fn mm(&self) -> Result<Option<LinuxMmStruct<'a, Driver>>, VmiError>
Returns the memory descriptor (mm_struct) of the user-mode process.
The mm_struct contains the memory management information for a process.
Kernel threads don’t have an mm_struct and return None.
§Implementation Details
Corresponds to task_struct->mm.
Sourcepub fn active_mm(&self) -> Result<LinuxMmStruct<'a, Driver>, VmiError>
pub fn active_mm(&self) -> Result<LinuxMmStruct<'a, Driver>, VmiError>
Returns the active memory context (mm_struct) of the process.
Used by kernel threads to reference the last used mm_struct before
entering kernel mode.
If a kernel thread (mm() is None) needs memory access,
it temporarily borrows active_mm from the last scheduled user-space
process.
When the kernel thread exits, the original mm_struct is restored.
§Implementation Details
Corresponds to task_struct->active_mm.
Sourcepub fn fs(&self) -> Result<Option<LinuxFsStruct<'a, Driver>>, VmiError>
pub fn fs(&self) -> Result<Option<LinuxFsStruct<'a, Driver>>, VmiError>
Returns the filesystem context (fs_struct) of the process.
fs_struct contains:
All threads in the same process share the same fs_struct, unless
explicitly changed.
Kernel threads don’t have an fs_struct and return None.
§Implementation Details
Corresponds to task_struct->fs.
Sourcepub fn d_path(
&self,
path: &LinuxPath<'_, Driver>,
) -> Result<Option<String>, VmiError>
pub fn d_path( &self, path: &LinuxPath<'_, Driver>, ) -> Result<Option<String>, VmiError>
Constructs the absolute path from a path structure.
Takes into account the process’s filesystem root when constructing the absolute path.
Returns the resolved path as a string if successful, or None if the path
could not be resolved (e.g., if the root is null).
§Implementation Details
Concatenates task_struct->fs->root with the path structure to construct
the absolute path.
Sourcepub fn image_path(&self) -> Result<Option<String>, VmiError>
pub fn image_path(&self) -> Result<Option<String>, VmiError>
Returns the path of the executable image for a process.
Returns the executable path as a string, or None for special processes
like kernel threads or those in the process of exiting.
§Implementation Details
Corresponds to d_path(task->mm->exe_file->f_path).
Trait Implementations§
Source§impl<'a, Driver> VmiOsProcess<'a, Driver> for LinuxTaskStruct<'a, Driver>where
Driver: VmiRead,
Driver::Architecture: ArchAdapter<Driver>,
impl<'a, Driver> VmiOsProcess<'a, Driver> for LinuxTaskStruct<'a, Driver>where
Driver: VmiRead,
Driver::Architecture: ArchAdapter<Driver>,
Source§fn architecture(&self) -> Result<VmiOsImageArchitecture, VmiError>
fn architecture(&self) -> Result<VmiOsImageArchitecture, VmiError>
Source§fn translation_root(&self) -> Result<Pa, VmiError>
fn translation_root(&self) -> Result<Pa, VmiError>
Source§fn user_translation_root(&self) -> Result<Pa, VmiError>
fn user_translation_root(&self) -> Result<Pa, VmiError>
Source§fn regions(
&self,
) -> Result<impl Iterator<Item = Result<<Self::Os as VmiOs>::Region<'a>, VmiError>> + use<'a, Driver>, VmiError>
fn regions( &self, ) -> Result<impl Iterator<Item = Result<<Self::Os as VmiOs>::Region<'a>, VmiError>> + use<'a, Driver>, VmiError>
Source§fn lookup_region(
&self,
_address: Va,
) -> Result<Option<<Self::Os as VmiOs>::Region<'a>>, VmiError>
fn lookup_region( &self, _address: Va, ) -> Result<Option<<Self::Os as VmiOs>::Region<'a>>, VmiError>
Source§fn user_modules(
&self,
) -> Result<impl Iterator<Item = Result<<Self::Os as VmiOs>::UserModule<'a>, VmiError>> + use<'a, Driver>, VmiError>
fn user_modules( &self, ) -> Result<impl Iterator<Item = Result<<Self::Os as VmiOs>::UserModule<'a>, VmiError>> + use<'a, Driver>, VmiError>
Source§fn lookup_user_module(
&self,
_address: Va,
) -> Result<Option<<Self::Os as VmiOs>::UserModule<'a>>, VmiError>
fn lookup_user_module( &self, _address: Va, ) -> Result<Option<<Self::Os as VmiOs>::UserModule<'a>>, VmiError>
Source§impl<Driver> VmiVa for LinuxTaskStruct<'_, Driver>where
Driver: VmiRead,
Driver::Architecture: ArchAdapter<Driver>,
impl<Driver> VmiVa for LinuxTaskStruct<'_, Driver>where
Driver: VmiRead,
Driver::Architecture: ArchAdapter<Driver>,
Auto Trait Implementations§
impl<'a, Driver> !Freeze for LinuxTaskStruct<'a, Driver>
impl<'a, Driver> !RefUnwindSafe for LinuxTaskStruct<'a, Driver>
impl<'a, Driver> !Send for LinuxTaskStruct<'a, Driver>
impl<'a, Driver> !Sync for LinuxTaskStruct<'a, Driver>
impl<'a, Driver> !UnwindSafe for LinuxTaskStruct<'a, Driver>
impl<'a, Driver> Unpin for LinuxTaskStruct<'a, Driver>
impl<'a, Driver> UnsafeUnpin for LinuxTaskStruct<'a, Driver>
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Source§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Source§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
out indicating that a T is niched.impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<'a, Driver, T> VmiOsProcessExt<'a, Driver> for Twhere
Driver: VmiDriver,
T: VmiOsProcess<'a, Driver>,
impl<'a, Driver, T> VmiOsProcessExt<'a, Driver> for Twhere
Driver: VmiDriver,
T: VmiOsProcess<'a, Driver>,
Source§fn find_region(
&self,
predicate: impl RegionPredicate<Self::Os>,
) -> Result<Option<<Self::Os as VmiOs>::Region<'a>>, VmiError>
fn find_region( &self, predicate: impl RegionPredicate<Self::Os>, ) -> Result<Option<<Self::Os as VmiOs>::Region<'a>>, VmiError>
predicate, or
Ok(None) if no region in the process matches.Source§fn filter_regions(
&self,
predicate: impl RegionPredicate<Self::Os>,
) -> Result<impl Iterator<Item = Result<<Self::Os as VmiOs>::Region<'a>, VmiError>>, VmiError>
fn filter_regions( &self, predicate: impl RegionPredicate<Self::Os>, ) -> Result<impl Iterator<Item = Result<<Self::Os as VmiOs>::Region<'a>, VmiError>>, VmiError>
predicate.Source§fn find_user_module(
&self,
predicate: impl UserModulePredicate<Self::Os>,
) -> Result<Option<<Self::Os as VmiOs>::UserModule<'a>>, VmiError>
fn find_user_module( &self, predicate: impl UserModulePredicate<Self::Os>, ) -> Result<Option<<Self::Os as VmiOs>::UserModule<'a>>, VmiError>
predicate, or
Ok(None) if no user module in the process matches.Source§fn filter_user_modules(
&self,
predicate: impl UserModulePredicate<Self::Os>,
) -> Result<impl Iterator<Item = Result<<Self::Os as VmiOs>::UserModule<'a>, VmiError>>, VmiError>
fn filter_user_modules( &self, predicate: impl UserModulePredicate<Self::Os>, ) -> Result<impl Iterator<Item = Result<<Self::Os as VmiOs>::UserModule<'a>, VmiError>>, VmiError>
predicate.