[−][src]Struct xgadget::gadget::Gadget
Gadget instructions (data) coupled with occurrence addresses for full and partial matches (metadata). Gadgets sortable by lowest occurrence address. Hash and equality consider only gadget instructions, not occurrence addresses (fast de-duplication via sets).
Fields
instrs: Vec<DecodedInstruction>
full_matches: BTreeSet<u64>
partial_matches: BTreeMap<u64, Vec<&'a Binary>>
Implementations
impl<'a> Gadget<'a>
[src]
pub fn new(
instrs: Vec<DecodedInstruction>,
full_matches: BTreeSet<u64>
) -> Gadget<'a>
[src]
instrs: Vec<DecodedInstruction>,
full_matches: BTreeSet<u64>
) -> Gadget<'a>
Assumes instructions are correctly sorted, address guaranteed to be sorted
pub fn last_instr(&self) -> Option<&DecodedInstruction>
[src]
Get tail
Trait Implementations
impl<'a> Clone for Gadget<'a>
[src]
impl<'_> Eq for Gadget<'_>
[src]
impl<'_> Hash for Gadget<'_>
[src]
SET DE-DUPLICATION PERFORMANCE (see http://cglab.ca/~abeinges/blah/hash-rs/):
-
SipHash 2-4 (default): Resistant to an advanced form of DDoS attack, but slow.
- Important for parsing untrusted inputs (e.g. network data), but not for our tool (it parses local binaries)
- We default to FxHash to run about 30% faster
- TODO (tnballo): HOWEVER an optional build config macro enables SipHash 2-4 (for parsing untrusted binaries, e.g. malware)
- That's paranoid, malware doesn't control hashing logic for our lib's decoding structs
-
Fowler-Noll-Vo, aka FNV: fastest option, but only for small key sizes. Our key, Veczydis::DecodedInstruction, is large and scales proportionally with the flag
--max-len
(gadget instr count).- Not a good choice.
-
FxHash: fast, non-cryptographic hash used in Firefox and maintained by the Rust Core team. Our default for approximately 30% speed gains via "drop-in" replacement.
fn hash<H: Hasher>(&self, state: &mut H)
[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl<'_> Ord for Gadget<'_>
[src]
fn cmp(&self, other: &Self) -> Ordering
[src]
#[must_use]fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]fn clamp(self, min: Self, max: Self) -> Self
[src]
impl<'_> PartialEq<Gadget<'_>> for Gadget<'_>
[src]
impl<'_> PartialOrd<Gadget<'_>> for Gadget<'_>
[src]
Auto Trait Implementations
impl<'a> RefUnwindSafe for Gadget<'a>
impl<'a> Send for Gadget<'a>
impl<'a> Sync for Gadget<'a>
impl<'a> Unpin for Gadget<'a>
impl<'a> UnwindSafe for Gadget<'a>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,