Skip to content

Commit 68dbb45

Browse files
rcvallejyn514
authored andcommitted
Add documentation for LLVM CFI support
This commit adds initial documentation for LLVM Control Flow Integrity (CFI) support to the Rust compiler (see rust-lang/rust#89652 and rust-lang/rust#89653).
1 parent b060087 commit 68dbb45

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

src/sanitizers.md

+10-5
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ The rustc compiler contains support for following sanitizers:
55
* [AddressSanitizer][clang-asan] a faster memory error detector. Can
66
detect out-of-bounds access to heap, stack, and globals, use after free, use
77
after return, double free, invalid free, memory leaks.
8+
* [ControlFlowIntegrity][clang-cfi] LLVM Control Flow Integrity (CFI) provides
9+
forward-edge control flow protection.
810
* [Hardware-assisted AddressSanitizer][clang-hwasan] a tool similar to
911
AddressSanitizer but based on partial hardware assistance.
1012
* [LeakSanitizer][clang-lsan] a run-time memory leak detector.
@@ -14,15 +16,16 @@ The rustc compiler contains support for following sanitizers:
1416
## How to use the sanitizers?
1517

1618
To enable a sanitizer compile with `-Z sanitizer=...` option, where value is one
17-
of `address`, `hwaddress`, `leak`, `memory` or `thread`. For more details on how
18-
to use sanitizers please refer to the sanitizer flag in [the unstable
19+
of `address`, `cfi`, `hwaddress`, `leak`, `memory` or `thread`. For more details
20+
on how to use sanitizers please refer to the sanitizer flag in [the unstable
1921
book](https://doc.rust-lang.org/unstable-book/).
2022

2123
## How are sanitizers implemented in rustc?
2224

23-
The implementation of sanitizers relies almost entirely on LLVM. The rustc is
24-
an integration point for LLVM compile time instrumentation passes and runtime
25-
libraries. Highlight of the most important aspects of the implementation:
25+
The implementation of sanitizers (except CFI) relies almost entirely on LLVM.
26+
The rustc is an integration point for LLVM compile time instrumentation passes
27+
and runtime libraries. Highlight of the most important aspects of the
28+
implementation:
2629

2730
* The sanitizer runtime libraries are part of the [compiler-rt] project, and
2831
[will be built][sanitizer-build] on [supported targets][sanitizer-targets]
@@ -104,12 +107,14 @@ To enable a sanitizer on a new target which is already supported by LLVM:
104107

105108
* [Sanitizers project page](https://github.com/google/sanitizers/wiki/)
106109
* [AddressSanitizer in Clang][clang-asan]
110+
* [ControlFlowIntegrity in Clang][clang-cfi]
107111
* [Hardware-assisted AddressSanitizer][clang-hwasan]
108112
* [LeakSanitizer in Clang][clang-lsan]
109113
* [MemorySanitizer in Clang][clang-msan]
110114
* [ThreadSanitizer in Clang][clang-tsan]
111115

112116
[clang-asan]: https://clang.llvm.org/docs/AddressSanitizer.html
117+
[clang-cfi]: https://clang.llvm.org/docs/ControlFlowIntegrity.html
113118
[clang-hwasan]: https://clang.llvm.org/docs/HardwareAssistedAddressSanitizerDesign.html
114119
[clang-lsan]: https://clang.llvm.org/docs/LeakSanitizer.html
115120
[clang-msan]: https://clang.llvm.org/docs/MemorySanitizer.html

0 commit comments

Comments
 (0)