CFI: core and std have explict CFI violations · Issue #115199 · rust-lang/rust (original) (raw)
Navigation Menu
- Explore
- Pricing
Provide feedback
Saved searches
Use saved searches to filter your results more quickly
Appearance settings
Description
Even though the user can now rebuild both core
and std
with CFI enabled (see #90546) using Cargo build-std feature (which is recommended), both have explicit CFI violations that prevent the compiled program from functioning with CFI enabled.
So far, I've identified three CFI violations:
std::sys::unix:thread_local_dtor::register_dtor
weakly links__cxa_thread_atexit_impl
and and the Rust compiler currently omits weakly function definitions and its metadata from LLVM IR.core::fmt::rt::Argument
transmutingformatter
innew
and indirectly branching to/calling it infmt
.- Rust's "try catch" construct (i.e.,
std::panicking::r#try
) use ofFnOnce
explicitly violating CFI . std::sys::unix::weak::syscall
macro weakly links functions and the Rust compiler currently omits weakly function definitions and its metadata from LLVM IR.
I'm not sure if those are all CFI violations, but all core and std tests pass after disabling CFI in those locations with the no_sanitize
attribute.