Skip to content

Commit

Permalink
Enable ThreadAbort with CET enabled via the QueueUserAPC2 (#70803)
Browse files Browse the repository at this point in the history
This change makes ThreadAbort work when CET is enabled. Instead of
thread redirection, it uses the new user mode APC mechanism to get a
thread to a handler and then throws the ThreadAbortException from there
if the thread was interrupted at a safe location.

I have verified it works using mdbg tests and also by manual testing in
the Visual Studio 2022 using a test app that creates an instance of
classes with properties containing infinite loop, wait on a lock, wait
on a handle, infinite loop inside of a lock and infinite loop in
finally.
For the testing, I've enabled this separately from the CET so that the
missing support for CET in the debugger code doesn't cause troubles.

So we could enable this without CET enabled too, but I'd prefer doing
that separately.
  • Loading branch information
janvorli authored Jun 16, 2022
1 parent 3c33b42 commit 3fc61eb
Show file tree
Hide file tree
Showing 2 changed files with 290 additions and 278 deletions.
1 change: 1 addition & 0 deletions src/coreclr/vm/threads.h
Original file line number Diff line number Diff line change
Expand Up @@ -2215,6 +2215,7 @@ class Thread
{
SuspendForGC,
SuspendForDebugger,
ThreadAbort,
};

bool InjectActivation(ActivationReason reason);
Expand Down
Loading

0 comments on commit 3fc61eb

Please sign in to comment.