summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFadi Hanna <fadim@microsoft.com>2019-10-03 12:08:01 -0700
committerHyungju Lee <leee.lee@samsung.com>2019-10-04 09:23:27 +0900
commit09394433e22fb55a642e8fe46beb2810f87be815 (patch)
treed421ddc3699214c9f7ac881950aa408591b38fc3
parent833a5cf6d566db939da70388081c545b4cc17880 (diff)
downloadcoreclr-accepted/tizen/unified/20191006.223635.tar.gz
coreclr-accepted/tizen/unified/20191006.223635.tar.bz2
coreclr-accepted/tizen/unified/20191006.223635.zip
Fix read ordering bug between buckets pointer and counter (#26997) (#27009)submit/tizen/20191004.002717accepted/tizen/unified/20191006.223635
* Fix read ordering bug between buckets pointer and counter Use VolaiteLoad to read counter
-rw-r--r--src/vm/ngenhash.inl5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/vm/ngenhash.inl b/src/vm/ngenhash.inl
index cc1f139b38..de16e38bc1 100644
--- a/src/vm/ngenhash.inl
+++ b/src/vm/ngenhash.inl
@@ -1263,8 +1263,11 @@ DPTR(VALUE) NgenHashTable<NGEN_HASH_ARGS>::FindVolatileEntryByHash(NgenHashValue
// Since there is at least one entry there must be at least one bucket.
_ASSERTE(m_cWarmBuckets > 0);
+ // Compute which bucket the entry belongs in based on the hash.
+ DWORD dwBucket = iHash % VolatileLoad(&m_cWarmBuckets);
+
// Point at the first entry in the bucket chain which would contain any entries with the given hash code.
- PTR_VolatileEntry pEntry = (GetWarmBuckets())[iHash % m_cWarmBuckets];
+ PTR_VolatileEntry pEntry = (GetWarmBuckets())[dwBucket];
// Walk the bucket chain one entry at a time.
while (pEntry)