Skip to content

Commit ee08dd8

Browse files
authored
Rollup merge of #111722 - mrcnski:stack-protector-doc, r=rcvalle
Document stack-protector option Only updated `exploit-mitigations.md` to reflect that the option exists. Removed the alternatives mentioned as they are not actually implemented yet. As this is an unstable feature, should it be added to `unstable-book` also? [Example](https://doc.rust-lang.org/beta/unstable-book/compiler-flags/sanitizer.html). I didn't do that because I couldn't find the tracking issue for stack-protector. (There should be one to track stabilization of the feature, I think?) cc `@rcvalle`
2 parents 221039b + a4d6d9a commit ee08dd8

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

src/doc/rustc/src/exploit-mitigations.md

+9-8
Original file line numberDiff line numberDiff line change
@@ -115,9 +115,9 @@ equivalent.
115115
<tr>
116116
<td>Stack smashing protection
117117
</td>
118-
<td>No
118+
<td>Yes
119119
</td>
120-
<td>
120+
<td>Nightly
121121
</td>
122122
</tr>
123123
<tr>
@@ -432,18 +432,16 @@ saved return instruction pointer, and checking if this value has changed
432432
when returning from a function. This is also known as “Stack Protector” or
433433
“Stack Smashing Protector (SSP)”.
434434

435-
The Rust compiler does not support stack smashing protection. However, more
436-
comprehensive alternatives to stack smashing protection exist, such as
437-
shadow and safe stack (see backward-edge control flow protection).
435+
The Rust compiler supports stack smashing protection on nightly builds[42].
438436

439437
![Screenshot of IDA Pro listing cross references to __stack_chk_fail in hello-rust.](images/image3.png "Cross references to __stack_chk_fail in hello-rust.")
440438
Fig. 14. IDA Pro listing cross references to `__stack_chk_fail` in
441439
hello-rust.
442440

443441
To check if stack smashing protection is enabled for a given binary, search
444-
for cross references to `__stack_chk_fail`. The only cross references to
445-
`__stack_chk_fail` in hello-rust are from the statically-linked libbacktrace
446-
library (see Fig. 14).
442+
for cross references to `__stack_chk_fail`. The presence of these
443+
cross-references in Rust-compiled code (e.g., `hello_rust::main`) indicates
444+
that the stack smashing protection is enabled (see Fig. 14).
447445

448446

449447
### Forward-edge control flow protection
@@ -697,3 +695,6 @@ defaults (unrelated to `READ_IMPLIES_EXEC`).
697695

698696
41. “ControlFlowIntegrity.” The Rust Unstable Book.
699697
[https://doc.rust-lang.org/unstable-book/compiler-flags/sanitizer.html#controlflowintegrity](../unstable-book/compiler-flags/sanitizer.html#controlflowintegrity).
698+
699+
42. bbjornse. “add codegen option for using LLVM stack smash protection #84197.”
700+
GitHub. <https://github.com/rust-lang/rust/pull/84197>

src/doc/rustc/src/images/image3.png

-52.1 KB
Loading

0 commit comments

Comments
 (0)