Struct BreakpointController

Source
pub struct BreakpointController<Driver>
where Driver: VmiDriver, <Driver::Architecture as Architecture>::EventReason: EventReason<Architecture = Driver::Architecture>,
{ /* private fields */ }
Expand description

Uses software breakpoint instructions (like INT3 on x86) to implement breakpoints.

When a breakpoint is inserted, the memory page is marked as execute-only - meaning the guest can execute code from the page but cannot read or modify it without triggering an exception. This effectively hides the breakpoint from the guest.

When a VCPU executes the breakpoint instruction, a VmiEvent is generated with a reason indicating a software breakpoint. The user can verify if this event came from a breakpoint manager using BreakpointManager::contains_by_event or BreakpointManager::get_by_event.

If a VCPU tries to read from or write to a page containing breakpoints, a VmiEvent is generated with a memory access reason.

Read access exceptions can typically be handled by (fast-)single-stepping the instruction in an unmodified default_view.

Write exceptions need careful consideration as they could overwrite breakpoint instructions - you can either ignore them or remove the affected breakpoint from the manager.

Implementations§

Source§

impl<Driver> BreakpointController<Driver>
where Driver: VmiDriver, <Driver::Architecture as Architecture>::EventReason: EventReason<Architecture = Driver::Architecture>,

Source

pub fn is_breakpoint( vmi: &VmiCore<Driver>, event: &VmiEvent<Driver::Architecture>, ) -> Result<bool, VmiError>

Checks if the given event was caused by a software breakpoint.

Trait Implementations§

Source§

impl<Driver> TapController for BreakpointController<Driver>
where Driver: VmiDriver, <Driver::Architecture as Architecture>::EventReason: EventReason<Architecture = Driver::Architecture>,

Source§

type Driver = Driver

VMI driver type.
Source§

fn new() -> Self

Creates a new TapController.
Source§

fn check_event( &self, event: &VmiEvent<Driver::Architecture>, ) -> Option<(View, Gfn)>

Checks if the given event was caused by a breakpoint.
Source§

fn insert_breakpoint( &mut self, vmi: &VmiCore<Driver>, pa: Pa, view: View, ) -> Result<(), VmiError>

Inserts a breakpoint at the given physical address.
Source§

fn remove_breakpoint( &mut self, vmi: &VmiCore<Driver>, pa: Pa, view: View, ) -> Result<(), VmiError>

Removes a breakpoint at the given physical address.
Source§

fn monitor( &mut self, vmi: &VmiCore<Driver>, gfn: Gfn, view: View, ) -> Result<(), VmiError>

Monitors the given guest frame number.
Source§

fn unmonitor( &mut self, vmi: &VmiCore<Driver>, gfn: Gfn, view: View, ) -> Result<(), VmiError>

Unmonitors the given guest frame number.

Auto Trait Implementations§

§

impl<Driver> Freeze for BreakpointController<Driver>

§

impl<Driver> RefUnwindSafe for BreakpointController<Driver>

§

impl<Driver> Send for BreakpointController<Driver>
where <<Driver as VmiDriver>::Architecture as Architecture>::EventReason: Sized, Driver: Send,

§

impl<Driver> Sync for BreakpointController<Driver>
where <<Driver as VmiDriver>::Architecture as Architecture>::EventReason: Sized, Driver: Sync,

§

impl<Driver> Unpin for BreakpointController<Driver>
where <<Driver as VmiDriver>::Architecture as Architecture>::EventReason: Sized, Driver: Unpin,

§

impl<Driver> UnwindSafe for BreakpointController<Driver>
where <<Driver as VmiDriver>::Architecture as Architecture>::EventReason: Sized, 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> 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> 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> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. 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.
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
Source§

impl<T> ErasedDestructor for T
where T: 'static,