bpf: Add lookup_and_delete_elem for BPF_MAP_STACK_TRACE
authorTao Chen <chen.dylane@linux.dev>
Thu, 25 Sep 2025 17:50:28 +0000 (01:50 +0800)
committerAndrii Nakryiko <andrii@kernel.org>
Thu, 25 Sep 2025 23:12:14 +0000 (16:12 -0700)
commit17f0d1f6321caa95699b8f96baf12e654d7b8d60
treed1f316df789f191f7979ee675b68ec96e9a266fa
parent105eb5dc74109a9f53c2f26c9a918d9347a73595
bpf: Add lookup_and_delete_elem for BPF_MAP_STACK_TRACE

The stacktrace map can be easily full, which will lead to failure in
obtaining the stack. In addition to increasing the size of the map,
another solution is to delete the stack_id after looking it up from
the user, so extend the existing bpf_map_lookup_and_delete_elem()
functionality to stacktrace map types.

Signed-off-by: Tao Chen <chen.dylane@linux.dev>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20250925175030.1615837-1-chen.dylane@linux.dev
include/linux/bpf.h
kernel/bpf/stackmap.c
kernel/bpf/syscall.c