diff options
| author | Alexei Starovoitov <ast@kernel.org> | 2026-04-05 18:37:32 -0700 |
|---|---|---|
| committer | Alexei Starovoitov <ast@kernel.org> | 2026-04-05 18:37:41 -0700 |
| commit | 24dbbf8a2343d4063c370a1f25645eabc50d68c9 (patch) | |
| tree | 151644c9a12e571bd9257619b9cbd4fb1774506c /tools/perf/scripts/python/stackcollapse.py | |
| parent | 6a14beefab457f267b8cedc6ac697a9562ec1244 (diff) | |
| parent | f64eb44ce9067d37e6334a940518dcf1254e83fe (diff) | |
Merge branch 'bpf-fix-torn-writes-in-non-prealloc-htab-with-bpf_f_lock'
Mykyta Yatsenko says:
====================
bpf: Fix torn writes in non-prealloc htab with BPF_F_LOCK
A torn write issue was reported in htab_map_update_elem() with
BPF_F_LOCK on hash maps. The BPF_F_LOCK fast path performs
a lockless lookup and copies the value under the element's embedded
spin_lock. A concurrent delete can free the element via
bpf_mem_cache_free(), which allows immediate reuse. When
alloc_htab_elem() recycles the same memory, it writes the value with
plain copy_map_value() without taking the spin_lock, racing with the
stale lock holder and producing torn writes.
Patch 1 fixes alloc_htab_elem() to use copy_map_value_locked() when
BPF_F_LOCK is set.
Patch 2 adds a selftest that reliably detects the torn writes on an
unpatched kernel.
Reported-by: Aaron Esau <aaron1esau@gmail.com>
Signed-off-by: Mykyta Yatsenko <yatsenko@meta.com>
====================
Link: https://patch.msgid.link/20260401-bpf_map_torn_writes-v1-0-782d071c55e7@meta.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'tools/perf/scripts/python/stackcollapse.py')
0 files changed, 0 insertions, 0 deletions
