[NativeAOT] Adjust SSP to match RSP of the throw site#119167
[NativeAOT] Adjust SSP to match RSP of the throw site#119167jkotas merged 1 commit intodotnet:mainfrom
Conversation
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
There was a problem hiding this comment.
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 |
|
Tagging subscribers to this area: @agocke, @MichalStrehovsky, @jkotas |
|
/azp run runtime-nativeaot-outerloop |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
/backport to release/10.0 |
|
Started backporting to release/10.0: https://github.com/dotnet/runtime/actions/runs/17307854868 |
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