-
Notifications
You must be signed in to change notification settings - Fork 5k
[release/9.0-staging] Fix crash during Async Break when APC and CET are enabled #114932
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
[release/9.0-staging] Fix crash during Async Break when APC and CET are enabled #114932
Conversation
There was a problem hiding this 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 backports changes to support special user mode APC handling in thread suspension and debugging paths.
- Introduces new thread state flags (TS_SSToExitApcCall and TS_SSToExitApcCallDone) and helper methods to manage APC-related thread suspension.
- Adds an overload for HandleSuspensionForInterruptedThread and updates debugger and controller logic to handle single-stepping out of APC calls.
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
src/coreclr/vm/threadsuspend.cpp | Added APC handling in thread suspension, new method MarkForSuspensionAndWait, and overload for HandleSuspensionForInterruptedThread. |
src/coreclr/vm/threads.h | Updated thread state flags, friend declarations, and protected member methods. |
src/coreclr/vm/dbginterface.h, debugger.h, debugger.cpp | Introduced SingleStepToExitApcCall support for APC callbacks during debugging. |
src/coreclr/debug/ee/controller.cpp | Modified exception dispatch to manage APC exit using the new thread state flags. |
Comments suppressed due to low confidence (1)
src/coreclr/vm/threadsuspend.cpp:4241
- Ensure that the new FEATURE_SPECIAL_USER_MODE_APC code paths, including the APC exit handling, are adequately covered by regression tests to verify both normal and debugger-assisted scenarios.
#ifdef FEATURE_SPECIAL_USER_MODE_APC
Tagging subscribers to this area: @mangod9 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm. we will take for consideration in 9.0.x
@thaystg friendly reminder that code complete is on Monday May 12th (2:00 PM Pacific) for the June Release. If you'd like to get this change included in that release, please merge this PR before the deadline. |
/ba know failures. |
/ba-g unrelated failures |
/ba known failures. |
Backport of #111408 to release/9.0-staging
/cc @thaystg
Customer Impact
Crashes during debugging when pausing in VS2022/.NET9 #110552
When a customer tries to pause an app that is running under the debugger, it may crash the app. This was very easy to reproduce using the sample provided in the issue.
CET + APC enabled caused a lot of issues and this is one of them. I think we should fix it because this is probably affecting a lot of customers that didn't open an issue because it's not easy to share a repro sample.
Regression
Testing
Manually tested.
Risk
Medium risk, we are changing how we pause the threads in an Async Pause asked by the customer while debugging.