diff options
author | Jan Vorlicek <janvorli@microsoft.com> | 2015-11-19 09:16:34 +0100 |
---|---|---|
committer | Jan Vorlicek <janvorli@microsoft.com> | 2015-11-19 09:25:27 +0100 |
commit | 4a8bdea12fca5d5889ce1e264d27cabc1e10ebf8 (patch) | |
tree | a2cf963bfa09ff79452225d4e30d2c0b3cbed0b2 /src | |
parent | 76942bb17c28084b0fdad8b6836fb433d9302789 (diff) | |
download | coreclr-4a8bdea12fca5d5889ce1e264d27cabc1e10ebf8.tar.gz coreclr-4a8bdea12fca5d5889ce1e264d27cabc1e10ebf8.tar.bz2 coreclr-4a8bdea12fca5d5889ce1e264d27cabc1e10ebf8.zip |
Fix issue with threadpool and wait for multiple objects on Linux
There is a method ThreadpoolMgr::ShiftWaitArray which uses memcpy to do
a move a segment of the waitPointer and waitHandle arrays one position
down, so the source and destination ranges overlap. However, it uses
memcpy, which on Linux copies items starting from the last one. So
the arrays get corrupted after the memcpy, containing multiple copies
of the last element and not containig some elements that were expected
to move.
The fix is to use memmove which should be used when the source and
destination memory regions overlap.
Diffstat (limited to 'src')
-rw-r--r-- | src/vm/win32threadpool.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/vm/win32threadpool.h b/src/vm/win32threadpool.h index 22fd6e05b4..f29c0bd954 100644 --- a/src/vm/win32threadpool.h +++ b/src/vm/win32threadpool.h @@ -1191,10 +1191,10 @@ public: ULONG count) { LIMITED_METHOD_CONTRACT; - memcpy(&threadCB->waitHandle[DestIndex], + memmove(&threadCB->waitHandle[DestIndex], &threadCB->waitHandle[SrcIndex], count * sizeof(HANDLE)); - memcpy(&threadCB->waitPointer[DestIndex], + memmove(&threadCB->waitPointer[DestIndex], &threadCB->waitPointer[SrcIndex], count * sizeof(LIST_ENTRY)); } |