diff options
| author | Felix Hoffmann <f3lix.dev@gmx.de> | 2026-07-31 17:50:24 +0200 |
|---|---|---|
| committer | Peter Zijlstra <peterz@infradead.org> | 2026-08-04 12:29:45 +0200 |
| commit | 1c7efabfbaf796f11000a46094a69955a01ec6cc (patch) | |
| tree | 0726c6b12de799df92e3639ae7998857fd07bda7 /tools/perf/scripts/python/exported-sql-viewer.py | |
| parent | 0f289334af68a1331d4a2d2a95799ffa4ff8a046 (diff) | |
futex: Avoid private hash use-after-free on final put
futex_private_hash_put() drops the reference to fph before evaluating
fph->mm for wake_up_var(). futex_ref_put() enables preemption again before
returning. If that put drops the final reference and the task is preempted,
another task can pivot to the replacement hash and free the old hash after
an RCU grace period. The first task then reads fph->mm from the freed
allocation when it resumes.
KASAN reports a slab-use-after-free in futex_private_hash_put(), with the
read at offset 24 in a freed kmalloc-512 allocation. The allocation and
free stacks point to futex_hash_allocate() and the RCU free path,
respectively.
Load the mm pointer while the fph reference is still held and pass the
saved value to wake_up_var(). wake_up_var() uses the pointer as a waitqueue
key and does not dereference the mm through it.
Fixes: bd54df5ea7ca ("futex: Allow to resize the private local hash")
Signed-off-by: Felix Hoffmann <f3lix.dev@gmx.de>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: stable@vger.kernel.org
Link: https://patch.msgid.link/20260731155024.1150011-1-f3lix.dev@gmx.de
Diffstat (limited to 'tools/perf/scripts/python/exported-sql-viewer.py')
0 files changed, 0 insertions, 0 deletions
