JumpTable

Struct JumpTable 

Source
pub struct JumpTable {
    pub lib: PathBuf,
    pub map: AddressMap,
    pub aslr_reference: u64,
    pub new_base_address: u64,
    pub ifunc_count: u64,
}

Fields§

§lib: PathBuf

The dylib containing the patch. This should be a valid path so you can just pass it to LibLoading

On wasm you will need to fetch() this file and then pass it to the WebAssembly.instantiate() function

§map: AddressMap

old -> new does not take into account the base address of the patch when loaded into memory - need dlopen for that

These are intended to be *const () pointers but need to be u64 for the hashmap. On 32-bit platforms you will need to cast to usize before using them.

§aslr_reference: u64

the address of the base address of the old original binary

machos: this is the address of the _mh_execute_header symbol usually at 0x100000000 and loaded near 0x100000000 linux: this is the address of the __executable_start symbol usually at 0x0 but loaded around 0x555555550000 windows: this is the address of the ImageBase field of the PE header wasm: not useful since there’s no ASLR

While we can generally guess that these values are, it’s possible they are different and thus reading them dynamically is worthwhile.

§new_base_address: u64

the address of the base address of the new binary

machos: this is the address of the _mh_execute_header symbol usually at 0x100000000 and loaded near 0x100000000 linux: this is the address of the __executable_start symbol usually at 0x0 but loaded around 0x555555550000 windows: this is the address of the ImageBase field of the PE header wasm: not useful since there’s no ASLR

While we can generally guess that these values are, it’s possible they are different and thus reading them dynamically is worthwhile.

§ifunc_count: u64

The amount of ifuncs this will register. This is used by WASM to know how much space to allocate for the ifuncs in the ifunc table

Trait Implementations§

Source§

impl Clone for JumpTable

Source§

fn clone(&self) -> JumpTable

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for JumpTable

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for JumpTable

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for JumpTable

Source§

fn eq(&self, other: &JumpTable) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for JumpTable

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for JumpTable

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. 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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,