Add cross-language LLVM CFI support to the Rust compiler#105452
Add cross-language LLVM CFI support to the Rust compiler#105452bors merged 2 commits intorust-lang:masterfrom
Conversation
|
r? @cjgillot (rustbot has picked a reviewer for you, use r? to override) |
There was a problem hiding this comment.
I believe this misses #[repr(transparent)] support.
There was a problem hiding this comment.
Is it in transform_ty? How exactly does that function relate to encode_ty and why is it split?
There was a problem hiding this comment.
Yes, it's handled in transform_ty, and its tests are here: https://github.com/rust-lang/rust/blob/master/src/test/codegen/sanitizer-cfi-emit-type-metadata-id-itanium-cxx-abi.rs#L116-L132. transform_ty coalesces types that have the same encoding into a single entity (e.g., c_void into unit), normalizes, and generalizes types before handing them to encode_ty. It greatly simplifies the encoding and compression/substitution logic.
8bc3f3d to
de462bc
Compare
|
r? @bjorn3 |
This comment has been minimized.
This comment has been minimized.
4e6f11d to
afdeab8
Compare
This comment has been minimized.
This comment has been minimized.
|
☔ The latest upstream changes (presumably #105763) made this pull request unmergeable. Please resolve the merge conflicts. |
This comment has been minimized.
This comment has been minimized.
|
@bors r+ |
|
⌛ Testing commit 77b4492 with merge 7e6abfbb80091195d39f4313f2955859588661f7... |
|
💔 Test failed - checks-actions |
|
@bors retry python setuptools issue |
This comment has been minimized.
This comment has been minimized.
|
@bors r- fails the rollup #111162 (comment) |
This commit adds cross-language LLVM Control Flow Integrity (CFI) support to the Rust compiler by adding the `-Zsanitizer-cfi-normalize-integers` option to be used with Clang `-fsanitize-cfi-icall-normalize-integers` for normalizing integer types (see https://reviews.llvm.org/D139395). It provides forward-edge control flow protection for C or C++ and Rust -compiled code "mixed binaries" (i.e., for when C or C++ and Rust -compiled code share the same virtual address space). For more information about LLVM CFI and cross-language LLVM CFI support for the Rust compiler, see design document in the tracking issue rust-lang#89653. Cross-language LLVM CFI can be enabled with -Zsanitizer=cfi and -Zsanitizer-cfi-normalize-integers, and requires proper (i.e., non-rustc) LTO (i.e., -Clinker-plugin-lto).
This commit updates the documentation for the LLVM Control Flow Integrity (CFI) support in the Rust compiler.
|
@bors r=bjorn3 |
| /// Allow conditional compilation depending on rust version | ||
| (active, cfg_version, "1.45.0", Some(64796), None), | ||
| /// Allows to use the `#[cfi_encoding = ""]` attribute. | ||
| (active, cfi_encoding, "1.69.0", Some(89653), None), |
There was a problem hiding this comment.
Should be CURRENT_RUSTC_VERSION?
This PR adds cross-language LLVM Control Flow Integrity (CFI) support to the Rust compiler by adding the
-Zsanitizer-cfi-normalize-integersoption to be used with Clang-fsanitize-cfi-icall-normalize-integersfor normalizing integer types (see https://reviews.llvm.org/D139395).It provides forward-edge control flow protection for C or C++ and Rust -compiled code "mixed binaries" (i.e., for when C or C++ and Rust -compiled code share the same virtual address space). For more information about LLVM CFI and cross-language LLVM CFI support for the Rust compiler, see design document in the tracking issue #89653.
Cross-language LLVM CFI can be enabled with -Zsanitizer=cfi and -Zsanitizer-cfi-normalize-integers, and requires proper (i.e., non-rustc) LTO (i.e., -Clinker-plugin-lto).
Thank you again, @bjorn3, @nikic, @samitolvanen, and the Rust community for all the help!