Skip to content

Commit

Permalink
Fix a mutex abandon case with WaitHandle.WaitAll in the PAL (dotnet/c…
Browse files Browse the repository at this point in the history
…oreclr#25452)

Fixes https://github.com/dotnet/coreclr/issues/25108
- Upon a `WaitAll` when all waits are already satisfied, the abandoned flag is overwritten with the abandoned state of the last wait object in the array
- So if the first wait object is an abandoned mutex and the second wait object is a signaled event, the `WaitAll` succeeds and does not report that anything was abandoned
- Fixed to accumulate into the flag instead of overwriting it

Commit migrated from dotnet/coreclr@e0a9df5
  • Loading branch information
kouvel authored Jun 29, 2019
1 parent 28d5b53 commit a2a49a3
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/coreclr/src/pal/src/synchmgr/wait.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -531,15 +531,19 @@ DWORD CorUnix::InternalWaitForMultipleObjectsEx(
iSignaledObjIndex = -1;
for (i=0;i<(int)nCount;i++)
{
bool fValue;
palErr = ppISyncWaitCtrlrs[i]->CanThreadWaitWithoutBlocking(&fValue, &fAbandoned);
bool fValue, fWaitObjectAbandoned = false;
palErr = ppISyncWaitCtrlrs[i]->CanThreadWaitWithoutBlocking(&fValue, &fWaitObjectAbandoned);
if (NO_ERROR != palErr)
{
ERROR("ISynchWaitController::CanThreadWaitWithoutBlocking() failed for "
"%d-th object [handle=%p error=%u]\n", i, lpHandles[i], palErr);
pThread->SetLastError(ERROR_INTERNAL_ERROR);
goto WFMOExIntReleaseControllers;
}
if (fWaitObjectAbandoned)
{
fAbandoned = true;
}
if (fValue)
{
iSignaledObjCount++;
Expand Down

0 comments on commit a2a49a3

Please sign in to comment.