Type

Enum Type 

Source
pub enum Type {
Show 19 variants ScalarValue(U64ScalarValueData), ConstPtrToMap { id: u64, schema: MapSchema, }, PtrToStack { offset: StackOffset, }, PtrToMemory { id: MemoryId, offset: U64ScalarValueData, buffer_size: u64, }, PtrToStruct { id: MemoryId, offset: U64ScalarValueData, descriptor: Arc<StructDescriptor>, }, PtrToArray { id: MemoryId, offset: U64ScalarValueData, }, PtrToEndArray { id: MemoryId, }, NullOr { id: MemoryId, inner: Box<Type>, }, Releasable { id: MemoryId, inner: Box<Type>, }, ScalarValueParameter, ConstPtrToMapParameter, MapKeyParameter { map_ptr_index: u8, }, MapValueParameter { map_ptr_index: u8, }, MemoryParameter { size: MemoryParameterSize, input: bool, output: bool, }, AliasParameter { parameter_index: u8, }, NullOrParameter(Box<Type>), StructParameter { id: MemoryId, }, ReleasableParameter { id: MemoryId, inner: Box<Type>, }, ReleaseParameter { id: MemoryId, },
}

Variants§

§

ScalarValue(U64ScalarValueData)

A number.

§

ConstPtrToMap

A pointer to a map object.

Fields

§id: u64
§schema: MapSchema
§

PtrToStack

A pointer into the stack.

Fields

§

PtrToMemory

A pointer to the kernel memory. The full buffer is buffer_size bytes long. The pointer is situated at offset from the start of the buffer.

Fields

§offset: U64ScalarValueData
§buffer_size: u64
§

PtrToStruct

A pointer to a struct with the specified StructDescriptor.

Fields

§offset: U64ScalarValueData
§descriptor: Arc<StructDescriptor>
§

PtrToArray

A pointer to the kernel memory. The full buffer size is determined by an instance of PtrToEndArray with the same id. The pointer is situadted at offset from the start of the buffer.

Fields

§offset: U64ScalarValueData
§

PtrToEndArray

A pointer to the kernel memory that represents the first non accessible byte of a PtrToArray with the same id.

Fields

§

NullOr

A pointer that might be null and must be validated before being referenced.

Fields

§inner: Box<Type>
§

Releasable

An object that must be passed to a method with an associated ReleaseParameter before the end of the program.

Fields

§inner: Box<Type>
§

ScalarValueParameter

A function parameter that must be a ScalarValue when called.

§

ConstPtrToMapParameter

A function parameter that must be a ConstPtrToMap when called.

§

MapKeyParameter

A function parameter that must be a key of a map.

Fields

§map_ptr_index: u8

The index in the arguments list that contains a ConstPtrToMap for the map this key is associated with.

§

MapValueParameter

A function parameter that must be a value of a map.

Fields

§map_ptr_index: u8

The index in the arguments list that contains a ConstPtrToMap for the map this key is associated with.

§

MemoryParameter

A function parameter that must be a pointer to memory.

Fields

§size: MemoryParameterSize

The index in the arguments list that contains a scalar value containing the size of the memory.

§input: bool

Whether this memory is read by the function.

§output: bool

Whether this memory is written by the function.

§

AliasParameter

A function return value that is the same type as a parameter.

Fields

§parameter_index: u8

The index in the argument list of the parameter that has the type of this return value.

§

NullOrParameter(Box<Type>)

A function return value that is either null, or the given type.

§

StructParameter

A function parameter that must be a pointer to memory with the given id.

Fields

§

ReleasableParameter

A function return value that must be passed to a method with an associated ReleaseParameter before the end of the program.

Fields

§inner: Box<Type>
§

ReleaseParameter

A function parameter that will release the value.

Fields

Implementations§

Source§

impl Type

Source

pub const UNINITIALIZED: Self

An uninitialized value.

Source

pub const UNKNOWN_SCALAR: Self

A Type where the data is usable by userspace, but the value is not known by the verifier.

Source

pub fn is_subtype(&self, super_type: &Type) -> bool

Return true if self is a subtype of super_type.

Source

pub fn is_non_zero(&self) -> bool

Return true is self is guaranteed to be non-zero

Trait Implementations§

Source§

impl Clone for Type

Source§

fn clone(&self) -> Type

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 Type

Source§

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

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

impl Default for Type

Source§

fn default() -> Self

A new instance of Type where no bit has been written yet.

Source§

impl From<u64> for Type

Source§

fn from(value: u64) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for Type

Source§

fn eq(&self, other: &Type) -> 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 PartialOrd for Type

Defines a partial ordering on Type instances, capturing the notion of how “broad” a type is in terms of the set of potential values it represents.

The ordering is defined such that t1 > t2 if a proof that an eBPF program terminates in a state where a register or memory location has type t1 is also a proof that the program terminates in a state where that location has type t2.

In other words, a “broader” type represents a larger set of possible values, and proving termination with a broader type implies termination with any narrower type.

Examples:

  • Type::ScalarValue(ScalarValueData({ unknown_mask: 0, .. })) (a known scalar value) is less than Type::ScalarValue(ScalarValueData({ unknown_mask: u64::MAX, .. })) (an unknown scalar value).
Source§

fn partial_cmp(&self, other: &Self) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

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

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

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

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

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

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

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

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl StructuralPartialEq for Type

Auto Trait Implementations§

§

impl Freeze for Type

§

impl RefUnwindSafe for Type

§

impl Send for Type

§

impl Sync for Type

§

impl Unpin for Type

§

impl UnwindSafe for Type

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.