]> git.ipfire.org Git - thirdparty/linux.git/commit
bpf: Factor out stack_map build ID helpers
authorIhor Solodrai <ihor.solodrai@linux.dev>
Mon, 25 May 2026 22:39:46 +0000 (15:39 -0700)
committerAndrii Nakryiko <andrii@kernel.org>
Thu, 28 May 2026 21:58:13 +0000 (14:58 -0700)
commitfc99547a8bda22a6a489284641385d8dcfb3ecd8
tree57f0c57f6ccd58f4f97c3f871ab23d40a44dd9a2
parenta4a5d4ee061240a1d39053db0a87f841d43277c0
bpf: Factor out stack_map build ID helpers

Factor out helpers from stack_map_get_build_id_offset() in
preparation for adding a sleepable build ID resolution path:
stack_map_build_id_set_ip(), stack_map_build_id_offset(), and
stack_map_build_id_set_valid().

While here, refactor stack_map_get_build_id_offset():
  * use continue-driven control flow in the main loop and remove
    build_id_valid label
  * update prev_vma and prev_build_id on the fall-back-to-IP branch so
    the cache reflects the actual VMA seen on the previous IP [1]
  * guard fetch_build_id() with vma_is_anonymous() [2] to skip parse
    attempts that would otherwise fail the ELF magic check

[1] https://lore.kernel.org/bpf/CAEf4Bzac9uWWqBvzH0iFzKvJcq3vxscZ3pKm0sUHmN-F-z9wVQ@mail.gmail.com/
[2] https://lore.kernel.org/bpf/226398c1ff3f2b686c0aeb010408d85fb15df13f9ff60a045bee31e79b9e41e9@mail.kernel.org/

Signed-off-by: Ihor Solodrai <ihor.solodrai@linux.dev>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Acked-by: Mykyta Yatsenko <yatsenko@meta.com>
Link: https://lore.kernel.org/bpf/20260525223948.1920986-2-ihor.solodrai@linux.dev
kernel/bpf/stackmap.c