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.
PtrToStack
A pointer into the stack.
Fields
offset: StackOffsetPtrToMemory
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.
PtrToStruct
A pointer to a struct with the specified 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.
PtrToEndArray
A pointer to the kernel memory that represents the first non accessible byte of a
PtrToArray with the same id.
NullOr
A pointer that might be null and must be validated before being referenced.
Releasable
An object that must be passed to a method with an associated ReleaseParameter before the
end of the program.
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
MapValueParameter
A function parameter that must be a value of a map.
Fields
MemoryParameter
A function parameter that must be a pointer to memory.
Fields
size: MemoryParameterSizeThe index in the arguments list that contains a scalar value containing the size of the memory.
AliasParameter
A function return value that is the same type as a parameter.
Fields
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.
ReleasableParameter
A function return value that must be passed to a method with an associated
ReleaseParameter before the end of the program.
ReleaseParameter
A function parameter that will release the value.
Implementations§
Source§impl Type
impl Type
Sourcepub const UNINITIALIZED: Self
pub const UNINITIALIZED: Self
An uninitialized value.
Sourcepub const UNKNOWN_SCALAR: Self
pub const UNKNOWN_SCALAR: Self
A Type where the data is usable by userspace, but the value is not known by the verifier.
Sourcepub fn is_subtype(&self, super_type: &Type) -> bool
pub fn is_subtype(&self, super_type: &Type) -> bool
Return true if self is a subtype of super_type.
Sourcepub fn is_non_zero(&self) -> bool
pub fn is_non_zero(&self) -> bool
Return true is self is guaranteed to be non-zero
Trait Implementations§
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.
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 thanType::ScalarValue(ScalarValueData({ unknown_mask: u64::MAX, .. }))(an unknown scalar value).