pub struct ProtectedFixedSizeStack(/* private fields */);
Expand description
A more secure, but slightly slower version of FixedSizeStack
.
Allocates stack space using virtual memory, whose pages will only be mapped to physical memory if they are used.
The additional guard page is made protected and inaccessible. Now if a stack overflow occurs it should (hopefully) hit this guard page and cause a segmentation fault instead letting the memory being overwritten silently.
As a general rule it is recommended to use this struct to create stack memory.
Implementations§
Source§impl ProtectedFixedSizeStack
impl ProtectedFixedSizeStack
Sourcepub fn new(size: usize) -> Result<ProtectedFixedSizeStack, StackError>
pub fn new(size: usize) -> Result<ProtectedFixedSizeStack, StackError>
Allocates a new stack of at least size
bytes + one additional guard page.
size
is rounded up to a multiple of the size of a memory page and
does not include the size of the guard page itself.
Trait Implementations§
Source§impl Debug for ProtectedFixedSizeStack
impl Debug for ProtectedFixedSizeStack
Source§impl Default for ProtectedFixedSizeStack
impl Default for ProtectedFixedSizeStack
Source§fn default() -> ProtectedFixedSizeStack
fn default() -> ProtectedFixedSizeStack
Returns the “default value” for a type. Read more
Source§impl Deref for ProtectedFixedSizeStack
impl Deref for ProtectedFixedSizeStack
Auto Trait Implementations§
impl Freeze for ProtectedFixedSizeStack
impl RefUnwindSafe for ProtectedFixedSizeStack
impl Send for ProtectedFixedSizeStack
impl !Sync for ProtectedFixedSizeStack
impl Unpin for ProtectedFixedSizeStack
impl UnwindSafe for ProtectedFixedSizeStack
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more