summaryrefslogtreecommitdiff
path: root/tools/perf/scripts/python/bin/stackcollapse-record
diff options
context:
space:
mode:
authorXu Yunxiang <xyx2021@mail.ustc.edu.cn>2026-09-21 05:04:21 +0800
committerAndrii Nakryiko <andrii@kernel.org>2026-09-21 15:00:59 -0700
commit79a9172f3ab4ad8392c5e5c8944b9b7710ade620 (patch)
treeb892737bb4f2589e534fab493372e0f848540bfb /tools/perf/scripts/python/bin/stackcollapse-record
parenta11212910cf09b2fe8db9afa41ef60c4f81879c5 (diff)
downloadlinux-next-79a9172f3ab4ad8392c5e5c8944b9b7710ade620.tar.gz
linux-next-79a9172f3ab4ad8392c5e5c8944b9b7710ade620.zip
bpf: Reject non-negative offsets in stack_slot_obj_get_spi()
bpf_get_spi() computes (-off - 1) / BPF_REG_SIZE using C division, which truncates toward zero. For off == 0, this produces spi 0, the same index used by the valid stack slot at fp-8. stack_slot_obj_get_spi() currently checks alignment and the resulting spi bounds, but does not reject the non-negative offset itself. It can therefore validate a PTR_TO_STACK register holding fp+0 against an iterator stored at fp-8 even though the runtime receives the actual fp+0 pointer. An effectful iterator kfunc can then interpret memory outside the BPF stack as iterator state. Reject non-negative offsets before converting the offset to an spi. All valid stack objects begin at a negative offset from the frame pointer. Fixes: 06accc8779c1 ("bpf: add support for open-coded iterator loops") Signed-off-by: Xu Yunxiang <xyx2021@mail.ustc.edu.cn> Signed-off-by: Andrii Nakryiko <andrii@kernel.org> Reviewed-by: Sun Jian <sun.jian.kdev@gmail.com> Link: https://lore.kernel.org/bpf/20260920210423.345636-2-xyx2021@mail.ustc.edu.cn
Diffstat (limited to 'tools/perf/scripts/python/bin/stackcollapse-record')
0 files changed, 0 insertions, 0 deletions