diff options
| author | Josef Bacik <josef@toxicpanda.com> | 2026-10-17 16:37:17 +0000 |
|---|---|---|
| committer | Alexei Starovoitov <ast@kernel.org> | 2026-10-17 21:58:22 +0000 |
| commit | 6186c9711ac6fb984f6c2093c52bf4e827cc50b1 (patch) | |
| tree | 27ec5206acef2b2c14161b5580b498a717ed9cba /tools/perf/scripts/python/bin/stackcollapse-report | |
| parent | 22f100bd013458836c3d0eaf8050b854d7534a66 (diff) | |
bpf: Fix NULL deref in the sk_storage map iterator
bpf_sk_storage_map_seq_find_next() hands out an element only if its
local_storage pointer is set. __bpf_sk_storage_map_seq_show() then reads
the pointer a second time and dereferences it without a test.
Since bpf_local_storage_destroy() unlinks the elements with
bpf_selem_unlink_nofail(), the pointer is reset to NULL when the socket
which owns the element is destroyed, so it can change between the two
reads. Reading the iterator while sockets with an element in the map are
closed ends in a NULL pointer dereference. The sockets need not belong to
the reader: where a program gives every new socket an element, an
unprivileged user who opens and closes sockets is enough.
Skip such an element, as the TCP and UDP iterators skip a socket which
has been unhashed.
Fixes: 0be08389c7f2 ("bpf: Switch to bpf_selem_unlink_nofail in bpf_local_storage_{map_free, destroy}")
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://patch.msgid.link/20261017163745.3341787-16-alexei.starovoitov@gmail.com
Diffstat (limited to 'tools/perf/scripts/python/bin/stackcollapse-report')
0 files changed, 0 insertions, 0 deletions
