Skip to content
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

CFI: f32 and f64 are encoded incorrectly for cross-language CFI #115150

Closed
rcvalle opened this issue Aug 23, 2023 · 0 comments · Fixed by #115151
Closed

CFI: f32 and f64 are encoded incorrectly for cross-language CFI #115150

rcvalle opened this issue Aug 23, 2023 · 0 comments · Fixed by #115151
Assignees
Labels
C-bug Category: This is a bug. PG-exploit-mitigations Project group: Exploit mitigations requires-nightly This issue requires a nightly compiler in some way. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@rcvalle
Copy link
Member

rcvalle commented Aug 23, 2023

I missed changing the encoding for f32 and f64 when I introduced the integer normalization option in #105452 as integer normalization does not include floating point. f32 and f64 should be always encoded as f and d since they are both FFI safe when their representation are the same (i.e., IEEE 754) for both the Rust compiler and Clang.

@rcvalle rcvalle added the PG-exploit-mitigations Project group: Exploit mitigations label Aug 23, 2023
@rcvalle rcvalle self-assigned this Aug 23, 2023
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Aug 23, 2023
@rcvalle rcvalle removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Aug 23, 2023
@rcvalle rcvalle added T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. requires-nightly This issue requires a nightly compiler in some way. C-bug Category: This is a bug. labels Aug 25, 2023
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Aug 25, 2023
…piler-errors

Fix CFI: f32 and f64 are encoded incorrectly for cross-language CFI

Fix rust-lang#115150 by encoding f32 and f64 correctly for cross-language CFI. I missed changing the encoding for f32 and f64 when I introduced the integer normalization option in rust-lang#105452 as integer normalization does not include floating point. `f32` and `f64` should be always encoded as `f` and `d` since they are both FFI safe when their representation are the same (i.e., IEEE 754) for both the Rust compiler and Clang.
@bors bors closed this as completed in 5d6e2d7 Aug 25, 2023
maurer pushed a commit to maurer/rust that referenced this issue Apr 1, 2024
Fix rust-lang#115150 by encoding f32 and f64 correctly for cross-language CFI. I
missed changing the encoding for f32 and f64 when I introduced the
integer normalization option in rust-lang#105452 as integer normalization does
not include floating point. `f32` and `f64` should be always encoded as
`f` and `d` since they are both FFI safe when their representation are
the same (i.e., IEEE 754) for both the Rust compiler and Clang.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. PG-exploit-mitigations Project group: Exploit mitigations requires-nightly This issue requires a nightly compiler in some way. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants