Commit c87e47e
Fix invalid memory address caused by hashtable shrinking during safe iteration (#2753)
Safe iterators pause rehashing, but don't pause auto shrinking. This
allows stale bucket references which then cause use after free (in this
case, via compactBucketChain on a deleted bucket).
This problem is easily reproducible via atomic slot migration, where we
call delKeysInSlot which relies on calling delete within a safe
iterator. After the fix, it no longer causes a crash.
Since all cases where rehashing is paused expect auto shrinking to also
be paused, I am making this happen automatically as part of pausing
reshashing.
---------
Signed-off-by: Jacob Murphy <[email protected]>
(cherry picked from commit 1cf0df9)
Signed-off-by: cherukum-amazon <[email protected]>1 parent 3f243ff commit c87e47e
1 file changed
+9
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1231 | 1231 | | |
1232 | 1232 | | |
1233 | 1233 | | |
1234 | | - | |
| 1234 | + | |
| 1235 | + | |
| 1236 | + | |
1235 | 1237 | | |
1236 | 1238 | | |
| 1239 | + | |
1237 | 1240 | | |
1238 | 1241 | | |
1239 | 1242 | | |
1240 | 1243 | | |
1241 | 1244 | | |
| 1245 | + | |
1242 | 1246 | | |
1243 | 1247 | | |
1244 | 1248 | | |
| |||
1630 | 1634 | | |
1631 | 1635 | | |
1632 | 1636 | | |
| 1637 | + | |
| 1638 | + | |
| 1639 | + | |
1633 | 1640 | | |
1634 | 1641 | | |
1635 | 1642 | | |
| |||
1638 | 1645 | | |
1639 | 1646 | | |
1640 | 1647 | | |
1641 | | - | |
| 1648 | + | |
1642 | 1649 | | |
1643 | 1650 | | |
1644 | 1651 | | |
| |||
1816 | 1823 | | |
1817 | 1824 | | |
1818 | 1825 | | |
1819 | | - | |
1820 | 1826 | | |
1821 | 1827 | | |
1822 | 1828 | | |
| |||
1928 | 1934 | | |
1929 | 1935 | | |
1930 | 1936 | | |
1931 | | - | |
1932 | 1937 | | |
1933 | 1938 | | |
1934 | 1939 | | |
| |||
0 commit comments