Skip to content

Remove -Z stack-protector=basic - #165812

Merged
rust-bors[bot] merged 1 commit into
rust-lang:mainfrom
arielb1:remove-stack-protector-basic
Nov 11, 2026
Merged

rust-bors[bot] merged 1 commit into
rust-lang:mainfrom
arielb1:remove-stack-protector-basic

Conversation

@arielb1

@arielb1 arielb1 commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

This is a part of the stack-protector stabilization (pulled out from #165704)

The -Z stack-protector=basic mode (-fstack-protector) uses heuristics that are specifically designed to catch old-C-style string manipulation. This is not a good fit to Rust, which does not perform much unsafe C-style string manipulation. As far as I can tell, nobody has been asking for it, and few people are using it even in today's C - modern distros (e.g. Debian) tend to use -fstack-protector-strong.

Therefore, -Z stack-protector=basic has been removed. If anyone is interested in it, they are welcome to add it back as an unstable option.

r? @jieyouxu

@rustbot

rustbot commented Nov 11, 2026

Copy link
Copy Markdown
Collaborator

Some changes occurred in tests/codegen-llvm/stack-protector.rs

cc @rust-lang/project-exploit-mitigations, @rcvalle

rustc_codegen_gcc is developed in its own repository. If possible, consider making this change to rust-lang/rustc_codegen_gcc instead.

cc @antoyo, @GuillaumeGomez

Some changes occurred in tests/ui/stack-protector

cc @rust-lang/project-exploit-mitigations, @rcvalle

This PR modifies bootstrap.example.toml.

If appropriate, please update CONFIG_CHANGE_HISTORY in src/bootstrap/src/utils/change_tracker.rs.

@rustbot rustbot added A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. PG-exploit-mitigations Project group: Exploit mitigations labels Nov 11, 2026
@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Nov 11, 2026

@jieyouxu jieyouxu left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. Looks good, just a nit

View changes since this review

This is a part of the stack-protector stabilization

The `-Z stack-protector=basic` mode (`-fstack-protector`) uses heuristics that are specifically designed
to catch old-C-style string manipulation. This is not a good fit to Rust, which does not perform much
unsafe C-style string manipulation. As far as I can tell, nobody has been asking for it,
and few people are using it even in today's C - modern distros (e.g. Debian) tend to use
`-fstack-protector-strong`.

Therefore, `-Z stack-protector=basic` has been **removed**. If anyone is interested in it, they
are welcome to add it back as an unstable option.
@arielb1
arielb1 force-pushed the remove-stack-protector-basic branch from 66d256f to 1a97ea1 Compare November 11, 2026 13:24

@jieyouxu jieyouxu left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rust-bors

rust-bors Bot commented Nov 11, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 1a97ea1 has been tentatively approved by jieyouxu

It will be put into the queue for this repository once PR CI succeeds.

@rust-bors rust-bors Bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Nov 11, 2026
rust-bors Bot pushed a commit that referenced this pull request Nov 11, 2026
…uwer

Rollup of 6 pull requests

Successful merges:

 - #165805 (Replace `match_span_kind` macro with `SpanKind`)
 - #165746 (std: don't overflow when rounding up huge thread stack sizes on unix)
 - #165807 (Fix 'simga' typo in char.to_lowercase documentation)
 - #165809 (Update to ar_archive_writer 0.5.5)
 - #165812 (Remove `-Z stack-protector=basic`)
 - #165815 (Adjust `unsized.rs` debuginfo test expected output for cdb `10.0.28000.2957`)
@rust-bors
rust-bors Bot merged commit a5449da into rust-lang:main Nov 11, 2026
14 checks passed
@rustbot rustbot added this to the 1.102.0 milestone Nov 11, 2026
rust-bors Bot pushed a commit that referenced this pull request Nov 11, 2026
Rollup merge of #165812 - arielb1:remove-stack-protector-basic, r=jieyouxu

Remove `-Z stack-protector=basic`

This is a part of the stack-protector stabilization (pulled out from #165704)

The `-Z stack-protector=basic` mode (`-fstack-protector`) uses heuristics that are specifically designed to catch old-C-style string manipulation. This is not a good fit to Rust, which does not perform much unsafe C-style string manipulation. As far as I can tell, nobody has been asking for it, and few people are using it even in today's C - modern distros (e.g. Debian) tend to use `-fstack-protector-strong`.

Therefore, `-Z stack-protector=basic` has been **removed**. If anyone is interested in it, they are welcome to add it back as an unstable option.

r? @jieyouxu
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. PG-exploit-mitigations Project group: Exploit mitigations S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants