Skip to content

Commit d866751

Browse files
committed
Add cross-language LLVM CFI support to the Rust compiler
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 #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).
1 parent 5262752 commit d866751

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
@@ -199,6 +199,7 @@ mod c_long_definition {
199199
// would be uninhabited and at least dereferencing such pointers would
200200
// be UB.
201201
#[doc = include_str!("c_void.md")]
202+
#[cfg_attr(not(bootstrap), lang = "c_void")]
202203
#[repr(u8)]
203204
#[stable(feature = "core_c_void", since = "1.30.0")]
204205
pub enum c_void {

0 commit comments

Comments
 (0)