UnsafeFFITracker

Struct UnsafeFFITracker 

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

Enhanced memory tracker for unsafe/FFI operations

Implementations§

Source§

impl UnsafeFFITracker

Source

pub fn new() -> Self

Create a new enhanced tracker

Source

pub fn track_unsafe_allocation( &self, ptr: usize, size: usize, unsafe_location: String, ) -> TrackingResult<()>

Track an unsafe Rust allocation

Source

pub fn track_ffi_allocation( &self, ptr: usize, size: usize, library_name: String, function_name: String, ) -> TrackingResult<()>

Track an FFI allocation

Source

pub fn track_enhanced_deallocation(&self, ptr: usize) -> TrackingResult<()>

Track a deallocation with safety checks

Source

pub fn record_boundary_event( &self, ptr: usize, event_type: BoundaryEventType, from_context: String, to_context: String, ) -> TrackingResult<()>

Record a cross-boundary event

Source

pub fn create_or_update_passport( &self, ptr: usize, operation: &str, context: &str, ) -> TrackingResult<()>

Create or update memory passport for cross-boundary tracking

Source

pub fn update_ownership( &self, ptr: usize, new_owner_context: String, new_owner_function: String, ) -> TrackingResult<()>

Update ownership information for a memory allocation

Source

pub fn validate_passport(&self, ptr: usize) -> TrackingResult<bool>

Validate memory passport integrity

Source

pub fn get_safety_violations(&self) -> TrackingResult<Vec<SafetyViolation>>

Get all safety violations

Source

pub fn get_enhanced_allocations( &self, ) -> TrackingResult<Vec<EnhancedAllocationInfo>>

Get enhanced allocations

Source

pub fn detect_leaks( &self, threshold_ms: u128, ) -> TrackingResult<Vec<SafetyViolation>>

Detect potential memory leaks

Source§

impl UnsafeFFITracker

Source

pub fn register_c_library( &self, library_name: String, library_path: Option<String>, library_version: Option<String>, ) -> TrackingResult<()>

Register a C library for tracking

Source

pub fn track_c_function_call( &self, library_name: &str, function_name: &str, allocation_size: usize, execution_time_ns: u64, ) -> TrackingResult<()>

Track a C function call with detailed information

Source

pub fn install_enhanced_libc_hook( &self, function_name: String, hook_method: HookInstallationMethod, ) -> TrackingResult<()>

Install an enhanced LibC hook

Source

pub fn create_and_register_passport( &self, ptr: usize, origin_context: &str, security_clearance: SecurityClearance, ) -> TrackingResult<String>

Create and register a memory passport for cross-boundary tracking

Source

pub fn stamp_passport( &self, ptr: usize, operation: &str, location: &str, authority: &str, ) -> TrackingResult<()>

Update memory passport with new stamp

Source

pub fn transfer_passport_ownership( &self, ptr: usize, new_owner_context: &str, new_owner_function: &str, ) -> TrackingResult<()>

Transfer memory passport ownership

Source

pub fn revoke_passport(&self, ptr: usize, reason: &str) -> TrackingResult<()>

Revoke a memory passport (when memory is freed)

Source

pub fn get_c_library_stats( &self, ) -> TrackingResult<HashMap<String, CLibraryInfo>>

Get C library statistics

Source

pub fn get_libc_hook_info( &self, ) -> TrackingResult<HashMap<String, EnhancedLibCHookInfo>>

Get LibC hook information

Source

pub fn get_memory_passports( &self, ) -> TrackingResult<HashMap<usize, MemoryPassport>>

Get memory passport information

Source

pub fn analyze_cross_boundary_risks( &self, ) -> TrackingResult<Vec<SafetyViolation>>

Analyze cross-boundary risks with detailed assessment

Source

pub fn process_boundary_event( &self, ptr: usize, event_type: BoundaryEventType, from_context: &str, to_context: &str, transfer_size: usize, ) -> TrackingResult<BoundaryEventAnalysis>

Process boundary events with comprehensive analysis

Source

pub fn get_boundary_event_statistics( &self, ) -> TrackingResult<BoundaryEventStatistics>

Get comprehensive boundary event statistics

Source

pub fn get_stats(&self) -> UnsafeFFIStats

Get statistics for unsafe and FFI operations

Source

pub fn integrate_with_safety_analyzer( &self, safety_analyzer: &SafetyAnalyzer, ) -> TrackingResult<()>

Integrate with SafetyAnalyzer for enhanced reporting

Source

pub fn integrate_with_passport_tracker( &self, passport_tracker: &MemoryPassportTracker, ) -> TrackingResult<()>

Integrate with MemoryPassportTracker for FFI boundary tracking

Source

pub fn perform_comprehensive_safety_analysis( &self, ) -> TrackingResult<ComprehensiveSafetyReport>

Perform comprehensive safety analysis using integrated components

Trait Implementations§

Source§

impl Default for UnsafeFFITracker

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

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> 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, 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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

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