Skip to content

CFI: Make lto and linker-plugin-lto work the same for compiler_builtins #145368

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

rcvalle
Copy link
Member

@rcvalle rcvalle commented Aug 13, 2025

Fix #142284 by also adding the compiler_builtins crate to the proper (i.e., non-rustc) LTO (i.e., -Clinker-plugin-lto) optimization pipelines.

@rustbot
Copy link
Collaborator

rustbot commented Aug 13, 2025

r? @jieyouxu

rustbot has assigned @jieyouxu.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added PG-exploit-mitigations Project group: Exploit mitigations S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Aug 13, 2025
@rustbot
Copy link
Collaborator

rustbot commented Aug 13, 2025

Some changes occurred in compiler/rustc_codegen_ssa

cc @WaffleLapkin

@rcvalle
Copy link
Member Author

rcvalle commented Aug 13, 2025

This PR continues the discussion on #142323 about fixing #142284 with @maurer fix.

@rcvalle rcvalle added A-control-flow-integrity Area: Control Flow Integrity (CFI) security mitigation A-sanitizers Area: Sanitizers for correctness and code quality labels Aug 13, 2025
@rcvalle
Copy link
Member Author

rcvalle commented Aug 13, 2025

r? dianqk

@rustbot rustbot assigned dianqk and unassigned jieyouxu Aug 13, 2025
@rcvalle
Copy link
Member Author

rcvalle commented Aug 13, 2025

I know there are some concerns with #118609, but it feels to me that this is the right fix (instead of avoiding indirect branches in the compiler_builtins crate). Optionally, we could enable it only when CFI is enabled for now and test it for some time for regressions.

Fix rust-lang#142284 by also adding the compiler_builtins crate to the proper
(i.e., non-rustc) LTO (i.e., -Clinker-plugin-lto) optimization pipelines.
@rcvalle rcvalle force-pushed the rust-cfi-fix-142284 branch from bb54ba9 to e3090b9 Compare August 13, 2025 18:43
@rustbot

This comment was marked as off-topic.

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 PG-exploit-mitigations Project group: Exploit mitigations S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

rustc-LLVM ERROR of ControlFlowIntegrit
5 participants