pub struct Property {
pub features: u32,
pub needed: u32,
}Expand description
What a file says it was built to have checked, which is what -fcf-protection= asks for.
Design: spec/11-asm-objects-debug.md section 11.3, and spec/04-driver-and-cli.md section 4.7
for the flag.
A machine’s control flow checks are turned on for a whole process or not at all, never for one function, so a program made of one object built with them and one built without has to be run one way or the other. What everybody settled on is that each object records what it was built for, the linker keeps only what every input agreed on, and the loader turns on what is left. So an object that records nothing turns the check off for every object it is linked with, which is why this is written even when the flag changed no instruction in the file.
One number rather than a pair of flags, because that is what the record holds: a word of bits whose meaning is the machine’s, and a linker that has never heard of a bit still knows to drop it when one input does not have it.
Fields§
§features: u32The bits of the x86 feature word, which are Self::IBT and Self::SHSTK.
needed: u32The bits of the word that says what the file needs of the link, which is
Self::INDIRECT_EXTERN_ACCESS and nothing else yet. That one is about the code rather
than the command line: gcc writes it once nodirect_extern_access was said of a name the
file defines or uses.
Implementations§
Source§impl Property
impl Property
Sourcepub const X86_FEATURES: u32 = 0xc000_0002
pub const X86_FEATURES: u32 = 0xc000_0002
Which property the feature word is, which is the key the record is written under.
Sourcepub const IBT: u32 = 1
pub const IBT: u32 = 1
Indirect branch tracking: every indirect call and jump in the file arrives at a landing pad, so the machine may fault on one that does not.
Sourcepub const SHSTK: u32 = 2
pub const SHSTK: u32 = 2
The shadow stack: every return in the file goes where a second copy of the return address says it should, so the machine may fault when the two disagree.
Sourcepub const NEEDED: u32 = 0xb000_8000
pub const NEEDED: u32 = 0xb000_8000
Which property the word of needs is, GNU_PROPERTY_1_NEEDED. Not the machine’s, so it is
the same key on every machine, though only x86 writes it.
Sourcepub const INDIRECT_EXTERN_ACCESS: u32 = 1
pub const INDIRECT_EXTERN_ACCESS: u32 = 1
The file reaches a name another object defines only through the global offset table, so the linker must not copy a protected variable into an executable it is part of, and the loader must not bind a protected name in a library to a copy somewhere else.
Trait Implementations§
impl Copy for Property
impl Eq for Property
impl StructuralPartialEq for Property
Auto Trait Implementations§
impl Freeze for Property
impl RefUnwindSafe for Property
impl Send for Property
impl Sync for Property
impl Unpin for Property
impl UnsafeUnpin for Property
impl UnwindSafe for Property
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.