]> git.lizzy.rs Git - rust.git/commit - src/tools/rust-analyzer
Auto merge of #89652 - rcvalle:rust-cfi, r=nagisa
authorbors <bors@rust-lang.org>
Wed, 27 Oct 2021 09:19:42 +0000 (09:19 +0000)
committerbors <bors@rust-lang.org>
Wed, 27 Oct 2021 09:19:42 +0000 (09:19 +0000)
commita8f6e614f86be429b5862f30e023063f619aeed2
tree329266e75828737d5cd8f66a7b27bb02379f9308
parent47aeac648ed56095688c1c20972c9b72bd0da7ce
parentc5708caf6a858b76b5519f81d2061ef85d9976b6
Auto merge of #89652 - rcvalle:rust-cfi, r=nagisa

Add LLVM CFI support to the Rust compiler

This PR adds LLVM Control Flow Integrity (CFI) support to the Rust compiler. It initially provides forward-edge control flow protection for Rust-compiled code only by aggregating function pointers in groups identified by their number of arguments.

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) will be provided in later work as part of this project by defining and using compatible type identifiers (see Type metadata in the design document in the tracking issue #89653).

LLVM CFI can be enabled with -Zsanitizer=cfi and requires LTO (i.e., -Clto).

Thank you, `@eddyb` and `@pcc,` for all the help!
compiler/rustc_codegen_llvm/src/builder.rs
compiler/rustc_codegen_llvm/src/llvm/ffi.rs
compiler/rustc_codegen_ssa/src/mir/block.rs
compiler/rustc_session/src/options.rs
compiler/rustc_span/src/symbol.rs
compiler/rustc_symbol_mangling/src/lib.rs
compiler/rustc_target/src/spec/mod.rs