Skip to content

Conversation

jkotas
Copy link
Member

@jkotas jkotas commented Aug 28, 2025

This fixes unbounded shadow stack growth that leads to stack overflow exception when exceptions are thrown and caught in a loop.

Fixes #118913
Fixes #107418

This fixes unbounded shadow stack growth that leads to stack overflow
exception when exceptions are thrown and caught in a loop.

Fixes dotnet#118913
Fixes dotnet#107418
@Copilot Copilot AI review requested due to automatic review settings August 28, 2025 06:01
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes unbounded shadow stack growth in NativeAOT that was causing stack overflow exceptions when exceptions are thrown and caught in loops. The fix adjusts the Shadow Stack Pointer (SSP) to properly match the Regular Stack Pointer (RSP) at the throw site, preventing stack accumulation during exception handling.

  • Adds SSP adjustment logic to align with RSP at throw sites
  • Removes exclusion of previously failing test case that is now fixed

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/tests/issues.targets Removes test exclusion for NativeAOT ControlFlowGuard issue that is now resolved
src/coreclr/nativeaot/Runtime/amd64/ExceptionHandling.asm Adds SSP adjustment logic in RhpThrowEx and RhpRethrow functions to prevent unbounded shadow stack growth

Copy link
Contributor

Tagging subscribers to this area: @agocke, @MichalStrehovsky, @jkotas
See info in area-owners.md if you want to be subscribed.

@jkotas jkotas requested review from VSadov and janvorli August 28, 2025 06:03
@jkotas
Copy link
Member Author

jkotas commented Aug 28, 2025

/azp run runtime-nativeaot-outerloop

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Copy link
Member

@janvorli janvorli left a comment

Choose a reason for hiding this comment

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

LGTM, thank you!

@jkotas jkotas merged commit 246d180 into dotnet:main Aug 28, 2025
125 of 127 checks passed
@jkotas jkotas deleted the issue-118913 branch August 28, 2025 20:31
@jkotas
Copy link
Member Author

jkotas commented Aug 28, 2025

/backport to release/10.0

Copy link
Contributor

Started backporting to release/10.0: https://github.com/dotnet/runtime/actions/runs/17307854868

@github-actions github-actions bot locked and limited conversation to collaborators Sep 28, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

2 participants