-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Use holding thread id in AwareLock to avoid orphaned lock crash #107168
Conversation
d832f90
to
76fc67d
Compare
@@ -436,6 +436,7 @@ class AwareLock | |||
|
|||
ULONG m_Recursion; | |||
PTR_Thread m_HoldingThread; | |||
DWORD m_HoldingThreadId; |
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.
It would be nice to remove m_HoldingThread
altogether. It would probably need a change to get the Thread pointer from the thread ID in the DAC. Maybe this could be cleaned up in a separate PR, for now at least the field shouldn't be dereferenced.
76fc67d
to
9de4e06
Compare
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.
Just a minor comment, otherwise LGTM, thanks!
In GetThreadOwningMonitorLock, in case there's a sync block, the method only checks for pThread to be equal to NULL to return false, otherwise it assumes pThread actually points to a thread. However, it can be the case that pThread is -1 for orphaned locks and should return false as well (the calling thread doesn't own the lock).
Fixes #44071.