FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

[debugger] Fix crash during Async Break when APC and CET are enabled by thaystg · Pull Request #111408 · dotnet/runtime · GitHub

Repository navigation

[debugger] Fix crash during Async Break when APC and CET are enabled - #111408

Merged
thaystg merged 13 commits into
dotnet:mainfrom
thaystg:dev/thays/fix_110552
Apr 4, 2025
Merged

thaystg merged 13 commits into
dotnet:mainfrom
thaystg:dev/thays/fix_110552

Conversation

thaystg commented Jan 14, 2025 •
edited
Loading

Copy link
Copy Markdown
Member

When we are running an APC Callback we are not allowed to SetIP because when APC Callback is resuming it will check if the IP is not changed if CET is enabled.
To avoid this problem we use the APC to suspend the thread, but then we enable the single step and continue the thread execution, this will exit the apc callback and pause in the single step, so we are allowed to SetIP to FuncEvalHijack to run FuncEvals.

Fixes #110552

Comment thread src/coreclr/vm/threadsuspend.cpp Outdated
Comment thread src/coreclr/vm/threadsuspend.cpp Outdated
Comment thread src/coreclr/vm/threadsuspend.cpp Outdated
Comment thread src/coreclr/vm/threadsuspend.cpp Outdated
Comment thread src/coreclr/pal/inc/pal.h Outdated
FlushProcessWriteBuffers();

typedef void (*PAL_ActivationFunction)(CONTEXT *context);
typedef void (*PAL_ActivationFunction)(CONTEXT *context, bool fromDebugger);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

A nit - can you please keep this function pointer unchanged and add the following function instead?

void HandleSuspensionForInterruptedThread(CONTEXT *interruptedContext)
{
    HandleSuspensionForInterruptedThread(interruptedContext, false);
}

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

done

janvorli left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

LGTM, thank you!

Comment thread src/coreclr/vm/threadsuspend.cpp Outdated
Comment thread src/coreclr/debug/ee/debugger.cpp Outdated

thaystg commented Apr 22, 2025

Copy link
Copy Markdown
Member Author

/backport to release/9.0-staging

Copy link
Copy Markdown
Contributor

Started backporting to release/9.0-staging: https://github.com/dotnet/runtime/actions/runs/14604017925

Copy link
Copy Markdown
Contributor

@thaystg backporting to "release/9.0-staging" failed, the patch most likely resulted in conflicts:

$ git am --3way --empty=keep --ignore-whitespace --keep-non-patch changes.patch

Applying: Trying to fix crash while funceval after an async break
Applying: Fix call func eval after an async break
error: sha1 information is lacking or useless (src/coreclr/pal/src/exception/signal.cpp).
error: could not build fake ancestor
hint: Use 'git am --show-current-patch=diff' to see the failed patch
hint: When you have resolved this problem, run "git am --continue".
hint: If you prefer to skip this patch, run "git am --skip" instead.
hint: To restore the original branch and stop patching, run "git am --abort".
hint: Disable this message with "git config set advice.mergeConflict false"
Patch failed at 0002 Fix call func eval after an async break
Error: The process '/usr/bin/git' failed with exit code 128

Please backport manually!

github-actions Bot locked and limited conversation to collaborators May 23, 2025
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 subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Crashes during debugging when pausing in VS2022/.NET9

4 participants


Back | FazBrowse Home | New Git URL