Skip to content

Disable CFI for weakly linked syscalls#138002

Merged
bors merged 2 commits intorust-lang:masterfrom
1c3t3a:fix-std-cfi-violation
Mar 12, 2025
Merged

Disable CFI for weakly linked syscalls#138002
bors merged 2 commits intorust-lang:masterfrom
1c3t3a:fix-std-cfi-violation

Conversation

@1c3t3a
Copy link
Copy Markdown
Member

@1c3t3a 1c3t3a commented Mar 4, 2025

Currently, when enabling CFI via -Zsanitizer=cfi and executing e.g. std::sys::random::getrandom, we can observe a CFI violation. This is the case for all consumers of the std::sys::pal::weak::syscall macro, as it is defining weak functions which don't show up in LLVM IR metadata. CFI fails for all these functions.

Similar to other such cases in
#115199, this change stops emitting the CFI typecheck for consumers of the macro via the #[no_sanitize(cfi)] attribute.

r? @rcvalle

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-control-flow-integrity Area: Control Flow Integrity (CFI) security mitigation A-sanitizers Area: Sanitizers for correctness and code quality O-unix Operating system: Unix-like PG-exploit-mitigations Project group: Exploit mitigations S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-libs Relevant to the library team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants