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 {
287287 buffer overflow (even in the presence of undefined behavior).
288288
289289 This provides similar security guarantees to Clang's
290- `-fstack-protector= strong`.
290+ `-fstack-protector- strong`.
291291
292292 The exact rules are unstable and subject to change, but
293293 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:
687687 buffer overflow (even in the presence of undefined behavior).
688688
689689 This provides similar security guarantees to Clang's
690- ` -fstack-protector= strong ` .
690+ ` -fstack-protector- strong ` .
691691
692692 The exact rules are unstable and subject to change, but
693693 currently, it generates stack protectors for functions that,
@@ -697,6 +697,15 @@ Supported values for this option are:
697697 determined by static control flow).
698698 - ` all ` : Generate stack canaries in all functions
699699
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+
700709Stack protectors are not supported on many GPU targets, use of stack
701710protectors on these targets is an error.
702711
You can’t perform that action at this time.
0 commit comments