summaryrefslogtreecommitdiff
path: root/tools/perf/scripts
diff options
context:
space:
mode:
authorJosef Bacik <josef@toxicpanda.com>2026-10-17 23:09:50 +0000
committerAlexei Starovoitov <ast@kernel.org>2026-10-18 00:36:44 +0000
commita6f8a67c13ddd5fcfee0fae61ec5787ee6729ab3 (patch)
treec98dd42f405d645d538ecfc7c68c0c55234cacb1 /tools/perf/scripts
parentab08863c58b1a96ff8378e373cb3d277cbe65b68 (diff)
bpf: Refuse packet slices for packet-changing helpers
The helpers which may change packet data do not take a packet pointer as a memory argument: they have no pkt_access. They make the skb writable, or make room in it, before they read what the argument points to, and that can reallocate the head which it points into. A slice from bpf_dynptr_slice() of the dynptr of the skb points into the same head, but it is a PTR_TO_MEM, and the verifier lets it pass. bpf_lwt_push_encap(), bpf_lwt_seg6_store_bytes() and bpf_lwt_seg6_action() then read the old head, which has been freed. bpf_skb_store_bytes() follows the head by now, but a slice is no better than a packet pointer there. Refuse a slice of a packet where a packet pointer is refused for that reason. All other helpers take slices as before. bpf_dynptr_write() and bpf_dynptr_copy() can be used to copy inside of a packet. Fixes: 2012c867c800 ("bpf: verifier: Accept dynptr mem as mem in helpers") Signed-off-by: Josef Bacik <josef@toxicpanda.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Link: https://patch.msgid.link/20261017230950.802052-17-alexei.starovoitov@gmail.com
Diffstat (limited to 'tools/perf/scripts')
0 files changed, 0 insertions, 0 deletions