Commit 6afebd2c authored by Doron Roberts-Kedes's avatar Doron Roberts-Kedes Committed by Facebook Github Bot

folly::ConcurrentHashMapSIMD - fix use after free

Summary: The current order of retire and reclaim_nodes in clear() introduces a subtle bug which allows the hazptr library to destroy the Chunks array from reclaim_nodes, freeing the memory at chunks_, then continue reclaiming nodes which involves further access to chunks_.`

Reviewed By: magedm

Differential Revision: D14968860

fbshipit-source-id: 1bc8e543ae54c3d0e26affb1fd352c58cc5ce897
parent 662768f3
...@@ -1351,8 +1351,8 @@ class alignas(64) SIMDTable { ...@@ -1351,8 +1351,8 @@ class alignas(64) SIMDTable {
chunks_.store(newchunks, std::memory_order_release); chunks_.store(newchunks, std::memory_order_release);
size_ = 0; size_ = 0;
} }
chunks->retire(HazptrTableDeleter(ccount));
chunks->reclaim_nodes(ccount); chunks->reclaim_nodes(ccount);
chunks->retire(HazptrTableDeleter(ccount));
} }
void max_load_factor(float factor) { void max_load_factor(float factor) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment