Skip to content

Ensure stack in two places that affect s390x #142047

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 6, 2025
Merged

Conversation

cuviper
Copy link
Member

@cuviper cuviper commented Jun 4, 2025

In our Fedora s390x test results, we found two tests that started hitting stack
overflows in the 1.87.0 update. It seems to be related in some part to our use
of PGO as well, probably inlining more into stack frames that were already
recursive. The main points of recursion that I identified were:

  • ui/parser/survive-peano-lesson-queue.rs in ThirBuildCx::mirror_exprs
  • ui/associated-consts/issue-93775.rs in Parser::parse_ty

A couple new ensure_sufficient_stack calls will solve these tests.

cuviper added 2 commits June 4, 2025 15:21
This solve a stack overflow found on Fedora s390x when building
`tests/ui/parser/survive-peano-lesson-queue.rs`. Note that the singular
`mirror_expr` method already has this stack check, but in this case the
plural method was the one recursing too deeply.
This solve a stack overflow found on Fedora s390x when building
`tests/ui/associated-consts/issue-93775.rs`.
@rustbot
Copy link
Collaborator

rustbot commented Jun 4, 2025

r? @oli-obk

rustbot has assigned @oli-obk.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jun 4, 2025
@workingjubilee
Copy link
Member

so completely randomly: how does stack work on s390x, @cuviper? is it a normal architecture from the perspective of Rust code, with a stack guard page and normal signals?

@oli-obk
Copy link
Contributor

oli-obk commented Jun 5, 2025

@bors r+ rollup

@bors
Copy link
Collaborator

bors commented Jun 5, 2025

📌 Commit af2a85b has been approved by oli-obk

It is now in the queue for this repository.

@bors bors 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 Jun 5, 2025
@cuviper
Copy link
Member Author

cuviper commented Jun 5, 2025

so completely randomly: how does stack work on s390x, @cuviper? is it a normal architecture from the perspective of Rust code, with a stack guard page and normal signals?

AFAIK it is normal in that regard, so these overflows still hit a SIGSEGV and executed rustc's handler, including the cycle-detecting backtrace which helped me see where we needed the ensure checks. The SystemZ backend just has different optimization tuning that can sometimes cause problems that we don't see on others, like inlining thresholds are probably the culprit here.

These particular test cases do fail on e.g. x86_64 as well if you tighten the default RUST_MIN_STACK, and they pass on s390x if you set a bigger stack. So it's kind of bad luck that only s390x failed in this way, and larger tests probably would have failed everywhere.

GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this pull request Jun 5, 2025
Ensure stack in two places that affect s390x

In our Fedora s390x test results, we found two tests that started hitting stack
overflows in the 1.87.0 update. It seems to be related in some part to our use
of PGO as well, probably inlining more into stack frames that were already
recursive. The main points of recursion that I identified were:

- `ui/parser/survive-peano-lesson-queue.rs` in `ThirBuildCx::mirror_exprs`
- `ui/associated-consts/issue-93775.rs` in `Parser::parse_ty`

A couple new `ensure_sufficient_stack` calls will solve these tests.
bors added a commit that referenced this pull request Jun 6, 2025
Rollup of 11 pull requests

Successful merges:

 - #125087 (Optimize `Seek::stream_len` impl for `File`)
 - #141982 (`tests/ui`: A New Order [5/N])
 - #142012 (Replace some `Option<Span>` with `Span` and use DUMMY_SP instead of None)
 - #142044 (compiler: Document the offset invariant of `OperandValue::Pair`)
 - #142047 (Ensure stack in two places that affect s390x)
 - #142058 (Clean `rustc_attr_parsing/src/lib.rs` documentation)
 - #142067 (canon_abi: make to_erased_extern_abi just a detail in formatting)
 - #142072 (doc: Fix inverted meaning in E0783.md)
 - #142084 (add myself to rotation)
 - #142091 (Fix AIX build)
 - #142092 (rustdoc: Support middle::ty associated const equality predicates again)

Failed merges:

 - #142042 (Make E0621 missing lifetime suggestion verbose)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit that referenced this pull request Jun 6, 2025
Rollup of 11 pull requests

Successful merges:

 - #125087 (Optimize `Seek::stream_len` impl for `File`)
 - #141982 (`tests/ui`: A New Order [5/N])
 - #142012 (Replace some `Option<Span>` with `Span` and use DUMMY_SP instead of None)
 - #142044 (compiler: Document the offset invariant of `OperandValue::Pair`)
 - #142047 (Ensure stack in two places that affect s390x)
 - #142058 (Clean `rustc_attr_parsing/src/lib.rs` documentation)
 - #142067 (canon_abi: make to_erased_extern_abi just a detail in formatting)
 - #142072 (doc: Fix inverted meaning in E0783.md)
 - #142084 (add myself to rotation)
 - #142091 (Fix AIX build)
 - #142092 (rustdoc: Support middle::ty associated const equality predicates again)

Failed merges:

 - #142042 (Make E0621 missing lifetime suggestion verbose)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit that referenced this pull request Jun 6, 2025
Rollup of 11 pull requests

Successful merges:

 - #125087 (Optimize `Seek::stream_len` impl for `File`)
 - #141982 (`tests/ui`: A New Order [5/N])
 - #142012 (Replace some `Option<Span>` with `Span` and use DUMMY_SP instead of None)
 - #142044 (compiler: Document the offset invariant of `OperandValue::Pair`)
 - #142047 (Ensure stack in two places that affect s390x)
 - #142058 (Clean `rustc_attr_parsing/src/lib.rs` documentation)
 - #142067 (canon_abi: make to_erased_extern_abi just a detail in formatting)
 - #142072 (doc: Fix inverted meaning in E0783.md)
 - #142084 (add myself to rotation)
 - #142091 (Fix AIX build)
 - #142092 (rustdoc: Support middle::ty associated const equality predicates again)

Failed merges:

 - #142042 (Make E0621 missing lifetime suggestion verbose)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 324681b into rust-lang:master Jun 6, 2025
10 checks passed
@rustbot rustbot added this to the 1.89.0 milestone Jun 6, 2025
rust-timer added a commit that referenced this pull request Jun 6, 2025
Rollup merge of #142047 - cuviper:s390x-stack, r=oli-obk

Ensure stack in two places that affect s390x

In our Fedora s390x test results, we found two tests that started hitting stack
overflows in the 1.87.0 update. It seems to be related in some part to our use
of PGO as well, probably inlining more into stack frames that were already
recursive. The main points of recursion that I identified were:

- `ui/parser/survive-peano-lesson-queue.rs` in `ThirBuildCx::mirror_exprs`
- `ui/associated-consts/issue-93775.rs` in `Parser::parse_ty`

A couple new `ensure_sufficient_stack` calls will solve these tests.
github-actions bot pushed a commit to rust-lang/miri that referenced this pull request Jun 7, 2025
Rollup of 11 pull requests

Successful merges:

 - rust-lang/rust#125087 (Optimize `Seek::stream_len` impl for `File`)
 - rust-lang/rust#141982 (`tests/ui`: A New Order [5/N])
 - rust-lang/rust#142012 (Replace some `Option<Span>` with `Span` and use DUMMY_SP instead of None)
 - rust-lang/rust#142044 (compiler: Document the offset invariant of `OperandValue::Pair`)
 - rust-lang/rust#142047 (Ensure stack in two places that affect s390x)
 - rust-lang/rust#142058 (Clean `rustc_attr_parsing/src/lib.rs` documentation)
 - rust-lang/rust#142067 (canon_abi: make to_erased_extern_abi just a detail in formatting)
 - rust-lang/rust#142072 (doc: Fix inverted meaning in E0783.md)
 - rust-lang/rust#142084 (add myself to rotation)
 - rust-lang/rust#142091 (Fix AIX build)
 - rust-lang/rust#142092 (rustdoc: Support middle::ty associated const equality predicates again)

Failed merges:

 - rust-lang/rust#142042 (Make E0621 missing lifetime suggestion verbose)

r? `@ghost`
`@rustbot` modify labels: rollup
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. 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.

5 participants