Skip to main content

Protector

Enum Protector 

Source
pub enum Protector {
    None,
    Buffers,
    Strong,
    All,
}
Expand description

Which functions get a stack protector, which is what the -fstack-protector family decides.

The question is about the locals a function has, so it is answered here and not in the back end: by the time a frame is laid out the types are gone and every local is a size and an alignment. What the back end then does about the answer is its own business, and it is carried to it as rucc_ir::AttrSet::STACK_PROTECT on the function.

The names are gcc’s, and so are the rules. A build that has been compiled with one of these for twenty years is entitled to the same set of protected functions from a compiler claiming to be compatible, because the ones left out are the ones an exploit goes looking for.

Variants§

§

None

None of them, which is -fno-stack-protector and what a command line that says nothing gets.

§

Buffers

A function with a local array of at least eight bytes, or one whose stack grows while it runs. -fstack-protector, which is the original and the narrowest.

§

Strong

Any of those, and any function with a local array at all, a local holding one, or a local whose address is taken. -fstack-protector-strong, which is what every distribution builds its packages with and therefore the one a real build line carries.

§

All

Every function that has a frame at all. -fstack-protector-all.

Trait Implementations§

Source§

impl Clone for Protector

Source§

fn clone(&self) -> Protector

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 Protector

Source§

impl Debug for Protector

Source§

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

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

impl Default for Protector

Source§

fn default() -> Protector

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

impl Eq for Protector

Source§

impl PartialEq for Protector

Source§

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

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

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

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Protector

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.