File tree Expand file tree Collapse file tree 2 files changed +11
-2
lines changed
compiler/rustc_codegen_llvm/src
src/doc/rustc/src/codegen-options Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -287,7 +287,7 @@ impl CodegenBackend for LlvmCodegenBackend {
287
287
buffer overflow (even in the presence of undefined behavior).
288
288
289
289
This provides similar security guarantees to Clang's
290
- `-fstack-protector= strong`.
290
+ `-fstack-protector- strong`.
291
291
292
292
The exact rules are unstable and subject to change, but
293
293
currently, it generates stack protectors for functions that,
Original file line number Diff line number Diff line change @@ -687,7 +687,7 @@ Supported values for this option are:
687
687
buffer overflow (even in the presence of undefined behavior).
688
688
689
689
This provides similar security guarantees to Clang's
690
- ` -fstack-protector= strong ` .
690
+ ` -fstack-protector- strong ` .
691
691
692
692
The exact rules are unstable and subject to change, but
693
693
currently, it generates stack protectors for functions that,
@@ -697,6 +697,15 @@ Supported values for this option are:
697
697
determined by static control flow).
698
698
- ` all ` : Generate stack canaries in all functions
699
699
700
+ rustc does not have a mode equivalent to Clang's (or GCC's)
701
+ plain ` -fstack-protector ` - ` -fstack-protector ` is an older heuristic
702
+ designed for C, that only protects functions that allocate a
703
+ ` char buf[N]; ` buffer on the stack, making it prone to buffer overflows
704
+ from length miscalculations. This heuristic is poorly suited for Rust
705
+ code. Even in C codebases, ` -fstack-protector-strong ` is nowadays
706
+ preferred because plain ` -fstack-protector ` misses many stack
707
+ buffer overflows.
708
+
700
709
Stack protectors are not supported on many GPU targets, use of stack
701
710
protectors on these targets is an error.
702
711
You can’t perform that action at this time.
0 commit comments