Repository navigation
Conversation
|
Azure Pipelines: Successfully started running 3 pipeline(s). 12 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
Contributor
|
Tagging subscribers to this area: @agocke |
Co-authored-by: jkotas <6668460+jkotas@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix alternate signal stack leak during thread shutdown
Fix PAL alternate signal stack leak after application reconfiguration
Nov 2, 2026
jkotas
marked this pull request as ready for review
November 2, 2026 23:27
litheon
approved these changes
Nov 3, 2026
janvorli
reviewed
Nov 3, 2026
Co-authored-by: jkotas <6668460+jkotas@users.noreply.github.com>
jkotas
approved these changes
Nov 3, 2026
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The cleanup change lacks Unix regression coverage with signal handling enabled to verify PAL mapping release and preservation of foreign mappings and registrations across unchanged, disabled, and replacement stack registrations.
1 open issue
What changed in this PR
Fixes the CoreCLR PAL alternate signal stack leak described in #136853 when application code replaces or disables the stack registration before thread teardown.
Changes:
- Tracks the PAL-owned allocation size alongside its pointer.
- Unmaps the owned allocation independently of the current registration.
- Disables the registered stack only when it matches the PAL-owned stack, preserving foreign stacks.
| File | Description |
|---|---|
src/coreclr/pal/src/thread/thread.cpp |
Records allocation size and separates owned-memory cleanup from stack registration. |
src/coreclr/pal/src/include/pal/thread.hpp |
Adds and initializes the alternate stack allocation-size field. |
Review effort: Balanced
jkotas
enabled auto-merge (squash)
November 3, 2026 17:58
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Thread teardown leaks the PAL-allocated alternate signal stack when application code replaces or disables its registration.
Fixes #136853