Skip to main content

SecurePolicy

Struct SecurePolicy 

Source
pub struct SecurePolicy;
Expand description

Zero-Sized Type (ZST) representing a secure allocation policy with memory poisoning and zero-initialization.

Trait Implementations§

Source§

impl AllocPolicy for SecurePolicy

Source§

const ENABLE_POISONING: bool = true

If true, write poison bytes to memory on allocation and deallocation to detect heap corruption.
Source§

const ZERO_INITIALIZE: bool = true

If true, zero-initialize all memory allocations.
Source§

const RANDOMIZE_ALLOCATION: bool = true

If true, randomize the allocation order of blocks in a page.
Source§

const POLICY_NAME: &'static str = "secure"

Human-readable name for this policy. Zero-cost — inlined by the compiler.
Source§

const MITIGATION_FLAGS: u32

Combined bitmask of active mitigations for this policy.
Source§

const POISON_FREE_BYTE: u8 = 0xDE

Byte pattern to write into memory when it is freed.
Source§

const POISON_ALLOC_BYTE: u8 = 0xAD

Byte pattern to write into memory when it is allocated.
Source§

const ENABLE_FREE_LIST_ENCRYPTION: bool = false

If true, encrypt free list next pointers using the per-segment XOR key.
Source§

const DELAY_PAGE_WAKE: bool = false

If true, a full page does not become active until at least capacity / WAKE_DENOMINATOR blocks are freed from it.
Source§

const WAKE_DENOMINATOR: u16 = 4

Denominator for the page-wake hysteresis.
Source§

const SEGMENT_POOL_WARM_THRESHOLD: usize = 0

Minimum warm segments kept in the pool after a purge_lazy call.
Source§

const GWP_SAMPLE_RATE: u32 = 0

Probabilistic guard-page sampling rate (GWP-ASan hook). 0 disables. Inspired by snmalloc 0.7.2 gwp_asan.h.
Source§

const MAX_ALLOC_SIZE_LIMIT: usize = 0

Maximum allocation size this policy will serve without a panic/error. Read more
Source§

const POLICY_FINGERPRINT: u64 = _

Compile-time configuration fingerprint. Read more
Source§

impl Clone for SecurePolicy

Source§

fn clone(&self) -> SecurePolicy

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Copy for SecurePolicy

Source§

impl Debug for SecurePolicy

Source§

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

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

impl Default for SecurePolicy

Source§

fn default() -> SecurePolicy

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

impl Eq for SecurePolicy

Source§

impl PartialEq for SecurePolicy

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl PolicySlotSelection<CudaDeviceBackend> for SecurePolicy

Source§

fn with_allocator<R>( f: impl FnOnce(&mut ThreadAllocator<CudaDeviceBackend>) -> R, ) -> Option<R>

Runs f with access to the allocator cache selected for this policy.
Source§

unsafe fn with_allocator_unguarded<R>( f: impl FnOnce(&mut ThreadAllocator<CudaDeviceBackend>) -> R, ) -> Option<R>

Runs f with access to the selected policy cache without arming the re-entrancy gate. Read more
Source§

fn get_allocator_ptr() -> *mut c_void

Returns the initialized allocator pointer for this policy’s TLS slot.
Source§

fn get_allocator_ptr_raw() -> *mut c_void

Returns the raw allocator pointer for this policy’s TLS slot without forcing lazy initialization.
Source§

impl PolicySlotSelection<CudaGddrBackend> for SecurePolicy

Source§

fn with_allocator<R>( f: impl FnOnce(&mut ThreadAllocator<CudaGddrBackend>) -> R, ) -> Option<R>

Runs f with access to the allocator cache selected for this policy.
Source§

unsafe fn with_allocator_unguarded<R>( f: impl FnOnce(&mut ThreadAllocator<CudaGddrBackend>) -> R, ) -> Option<R>

Runs f with access to the selected policy cache without arming the re-entrancy gate. Read more
Source§

fn get_allocator_ptr() -> *mut c_void

Returns the initialized allocator pointer for this policy’s TLS slot.
Source§

fn get_allocator_ptr_raw() -> *mut c_void

Returns the raw allocator pointer for this policy’s TLS slot without forcing lazy initialization.
Source§

impl PolicySlotSelection<CudaHbmBackend> for SecurePolicy

Source§

fn with_allocator<R>( f: impl FnOnce(&mut ThreadAllocator<CudaHbmBackend>) -> R, ) -> Option<R>

Runs f with access to the allocator cache selected for this policy.
Source§

unsafe fn with_allocator_unguarded<R>( f: impl FnOnce(&mut ThreadAllocator<CudaHbmBackend>) -> R, ) -> Option<R>

Runs f with access to the selected policy cache without arming the re-entrancy gate. Read more
Source§

fn get_allocator_ptr() -> *mut c_void

Returns the initialized allocator pointer for this policy’s TLS slot.
Source§

fn get_allocator_ptr_raw() -> *mut c_void

Returns the raw allocator pointer for this policy’s TLS slot without forcing lazy initialization.
Source§

impl PolicySlotSelection<CudaHostPinnedBackend> for SecurePolicy

Source§

fn with_allocator<R>( f: impl FnOnce(&mut ThreadAllocator<CudaHostPinnedBackend>) -> R, ) -> Option<R>

Runs f with access to the allocator cache selected for this policy.
Source§

unsafe fn with_allocator_unguarded<R>( f: impl FnOnce(&mut ThreadAllocator<CudaHostPinnedBackend>) -> R, ) -> Option<R>

Runs f with access to the selected policy cache without arming the re-entrancy gate. Read more
Source§

fn get_allocator_ptr() -> *mut c_void

Returns the initialized allocator pointer for this policy’s TLS slot.
Source§

fn get_allocator_ptr_raw() -> *mut c_void

Returns the raw allocator pointer for this policy’s TLS slot without forcing lazy initialization.
Source§

impl PolicySlotSelection<CudaUnifiedBackend> for SecurePolicy

Source§

fn with_allocator<R>( f: impl FnOnce(&mut ThreadAllocator<CudaUnifiedBackend>) -> R, ) -> Option<R>

Runs f with access to the allocator cache selected for this policy.
Source§

unsafe fn with_allocator_unguarded<R>( f: impl FnOnce(&mut ThreadAllocator<CudaUnifiedBackend>) -> R, ) -> Option<R>

Runs f with access to the selected policy cache without arming the re-entrancy gate. Read more
Source§

fn get_allocator_ptr() -> *mut c_void

Returns the initialized allocator pointer for this policy’s TLS slot.
Source§

fn get_allocator_ptr_raw() -> *mut c_void

Returns the raw allocator pointer for this policy’s TLS slot without forcing lazy initialization.
Source§

impl PolicySlotSelection<MemoryBackendWrapper> for SecurePolicy

Source§

fn with_allocator<R>( f: impl FnOnce(&mut ThreadAllocator<MemoryBackendWrapper>) -> R, ) -> Option<R>

Runs f with access to the allocator cache selected for this policy.
Source§

unsafe fn with_allocator_unguarded<R>( f: impl FnOnce(&mut ThreadAllocator<MemoryBackendWrapper>) -> R, ) -> Option<R>

Runs f with access to the selected policy cache without arming the re-entrancy gate. Read more
Source§

fn get_allocator_ptr() -> *mut c_void

Returns the initialized allocator pointer for this policy’s TLS slot.
Source§

fn get_allocator_ptr_raw() -> *mut c_void

Returns the raw allocator pointer for this policy’s TLS slot without forcing lazy initialization.
Source§

impl StructuralPartialEq for SecurePolicy

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 = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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.