summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFadi Hanna <fadim@microsoft.com>2019-10-02 11:06:04 -0700
committerAlexander Soldatov/AI Compiler Lab /SRR/Staff Engineer/삼성전자 <soldatov.a@samsung.com>2019-10-07 12:00:00 +0300
commit3296ac40de1a0be7e24f1c5c1511fb5cd615bbde (patch)
treea1f239135321a631b4ea694612b7473784a18320
parent8576ccc6bc33d359c65d8f04eb8a105256301315 (diff)
downloadcoreclr-3296ac40de1a0be7e24f1c5c1511fb5cd615bbde.tar.gz
coreclr-3296ac40de1a0be7e24f1c5c1511fb5cd615bbde.tar.bz2
coreclr-3296ac40de1a0be7e24f1c5c1511fb5cd615bbde.zip
Fix read ordering bug between buckets pointer and 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..43d03f9753 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 % 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)