diff options
author | Fadi Hanna <fadim@microsoft.com> | 2019-10-03 12:08:01 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-10-03 12:08:01 -0700 |
commit | e02a3e1c914f1a042c471a4195bc6e4428b0fb19 (patch) | |
tree | 779bdbaa412b8b549eefb47eafc8758f01318bd3 /src/vm | |
parent | b5d201599d9aff5c26327a2f65828ed635911382 (diff) | |
download | coreclr-e02a3e1c914f1a042c471a4195bc6e4428b0fb19.tar.gz coreclr-e02a3e1c914f1a042c471a4195bc6e4428b0fb19.tar.bz2 coreclr-e02a3e1c914f1a042c471a4195bc6e4428b0fb19.zip |
Fix read ordering bug between buckets pointer and counter (#26997) (#27009)
* Fix read ordering bug between buckets pointer and counter
Use VolaiteLoad to read counter
Diffstat (limited to 'src/vm')
-rw-r--r-- | src/vm/ngenhash.inl | 5 |
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) |