summaryrefslogtreecommitdiff
path: root/src/vm
diff options
context:
space:
mode:
authorJan Vorlicek <janvorli@microsoft.com>2015-11-19 09:16:34 +0100
committerJan Vorlicek <janvorli@microsoft.com>2015-11-19 09:25:27 +0100
commit4a8bdea12fca5d5889ce1e264d27cabc1e10ebf8 (patch)
treea2cf963bfa09ff79452225d4e30d2c0b3cbed0b2 /src/vm
parent76942bb17c28084b0fdad8b6836fb433d9302789 (diff)
downloadcoreclr-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/vm')
-rw-r--r--src/vm/win32threadpool.h4
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));
}