diff options
| author | Emil Tsalapatis <emil@etsalapatis.com> | 2026-09-22 17:20:22 +0000 |
|---|---|---|
| committer | Alexei Starovoitov <ast@kernel.org> | 2026-09-22 19:34:04 +0000 |
| commit | a6c1edfbe240e4377038a0e1d233ad81fde9a21b (patch) | |
| tree | a734563898f8c367c7306b244d7b0e19e3614243 /tools/perf/scripts/python | |
| parent | dec0c209a6808fe6de2e4787538e02786a16a4ef (diff) | |
| download | linux-next-a6c1edfbe240e4377038a0e1d233ad81fde9a21b.tar.gz linux-next-a6c1edfbe240e4377038a0e1d233ad81fde9a21b.zip | |
bpf: Reject pkt arguments in mutating subprogs
The verifier tracks changes in how PTR_TO_PACKET registers'
bounds are modified across subprog boundaries. PTR_TO_PACKET
registers are actually passed as PTR_TO_MEM, which is assumed
valid for the entire call. This is not the case with packet memory,
where a pskb_* call may invalidate its memory region.
Reject BPF code that passes PTR_TO_PACKET pointers to subprogs that
may mutate a packet. We cannot pass the pointer as a true PTR_TO_PACKET
because we would also need to somehow pass the PTR_TO_PACKET_META
or PTR_TO_PACKET_END to the subprog. Since we cannot avoid representing
the pointer in the subprog as PTR_TO_MEM, only permit it if the
subprog is guaranteed not to mutate the packet.
Fixes: 80f281664f5a ("bpf: Support pointers in global func args")
Reported-by: Nicholas Carlini <nicholas@carlini.com>
Suggested-by: Nicholas Carlini <nicholas@carlini.com>
Signed-off-by: Emil Tsalapatis <emil@etsalapatis.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://patch.msgid.link/20260922172028.6269-6-emil@etsalapatis.com
Diffstat (limited to 'tools/perf/scripts/python')
0 files changed, 0 insertions, 0 deletions
