Document that CFI diverges from Rust wrt. ABI-compatibility rules#155361
Open
Darksonn wants to merge 8 commits intorust-lang:mainfrom
Open
Document that CFI diverges from Rust wrt. ABI-compatibility rules#155361Darksonn wants to merge 8 commits intorust-lang:mainfrom
Darksonn wants to merge 8 commits intorust-lang:mainfrom
Conversation
Collaborator
|
r? @scottmcm rustbot has assigned @scottmcm. Use Why was this reviewer chosen?The reviewer was selected based on:
|
RalfJung
reviewed
Apr 16, 2026
This was too confusing. This section is about Rust-to-Rust calls, so it sounds like it's referring to how core::ffi::c_int and similar behave, but that is not the case (it's about how C does it, which differs from what core::ffi::c_int does), and either way it is off-topic for Rust-to-Rust calls.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
View all comments
The CFI sanitizer is a sanitizer that checks that no ABI-incompatible function calls are made at runtime, but there is currently an unfortunate divergence between the Rust ABI-compatibility rules and what the CFI sanitizer checks. Thus, document that this divergence exists.
There are proposals for how we can align the ABI rules to eliminate this discrepancy, and I would like to follow through with those, but for now I think we can at least document that the discrepancy exists.
For further discussion please see Re-evaluate ABI compatibility rules in light of CFI and Can CFI be made compatible with type erasure schemes? and
fn_cast!macro.cc @rcvalle @samitolvanen @maurer @bjorn3 @RalfJung
Rendered: