-
Notifications
You must be signed in to change notification settings - Fork 13.9k
Closed
Labels
A-control-flow-integrityArea: Control Flow Integrity (CFI) security mitigationArea: Control Flow Integrity (CFI) security mitigationA-sanitizersArea: Sanitizers for correctness and code qualityArea: Sanitizers for correctness and code qualityC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.PG-exploit-mitigationsProject group: Exploit mitigationsProject group: Exploit mitigationsT-libsRelevant to the library team, which will review and decide on the PR/issue.Relevant to the library team, which will review and decide on the PR/issue.requires-nightlyThis issue requires a nightly compiler in some way.This issue requires a nightly compiler in some way.
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_dtorweakly links__cxa_thread_atexit_impland and the Rust compiler currently omits weakly function definitions and its metadata from LLVM IR.core::fmt::rt::Argumenttransmutingformatterinnewand indirectly branching to/calling it infmt.- Rust's "try catch" construct (i.e.,
std::panicking::r#try) use ofFnOnceexplicitly violating CFI . std::sys::unix::weak::syscallmacro 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.
Metadata
Metadata
Assignees
Labels
A-control-flow-integrityArea: Control Flow Integrity (CFI) security mitigationArea: Control Flow Integrity (CFI) security mitigationA-sanitizersArea: Sanitizers for correctness and code qualityArea: Sanitizers for correctness and code qualityC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.PG-exploit-mitigationsProject group: Exploit mitigationsProject group: Exploit mitigationsT-libsRelevant to the library team, which will review and decide on the PR/issue.Relevant to the library team, which will review and decide on the PR/issue.requires-nightlyThis issue requires a nightly compiler in some way.This issue requires a nightly compiler in some way.