Skip to content

Commit d78075d

Browse files
authored
Rollup merge of #105452 - rcvalle:rust-cfi-3, r=bjorn3
Add cross-language LLVM CFI support to the Rust compiler This PR 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 #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!
2 parents ba75201 + d866751 commit d78075d

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

core/src/ffi/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,7 @@ mod c_long_definition {
202202
// would be uninhabited and at least dereferencing such pointers would
203203
// be UB.
204204
#[doc = include_str!("c_void.md")]
205+
#[cfg_attr(not(bootstrap), lang = "c_void")]
205206
#[repr(u8)]
206207
#[stable(feature = "core_c_void", since = "1.30.0")]
207208
pub enum c_void {

0 commit comments

Comments
 (0)