diff options
| author | Chris Mason <mason@kernel.org> | 2026-11-01 19:05:22 +0000 |
|---|---|---|
| committer | Alexei Starovoitov <ast@kernel.org> | 2026-11-02 00:10:39 +0000 |
| commit | 3f9780d62dd1112ca15b5ae73568d29d42ccc950 (patch) | |
| tree | 15c53de933aeb7b116722792aef971346b31b73b /scripts/basic | |
| parent | 2962329f7c86fc51c177d4049c0f15a95ebd270c (diff) | |
| download | linux-3f9780d62dd1112ca15b5ae73568d29d42ccc950.tar.gz linux-3f9780d62dd1112ca15b5ae73568d29d42ccc950.zip | |
bpf, cgroup: Keep the skb network offset signed
cgroup_skb progs see a packet from its network header. While they run,
__cgroup_bpf_run_filter_skb() moves skb->data there. It assumes that the
network header is not after skb->data. It negates skb_network_offset(skb)
and pushes skb->data by this offset. The offset is an unsigned int.
But ip6mr_cache_report() and bpf_lwt_xmit_reroute() can pass an skb that
has data before the network header. Then the offset wraps. On a 64-bit
kernel skb->data is then far below skb->head.
skb->len has 32 bits and wraps to the correct value, thus only skb->data is
wrong. A read of packet data faults or gets other memory.
Keep the offset in an int. Pull skb->data when the network header is after
it. Otherwise push it, as today.
Fixes: 3007098494be ("cgroup: add support for eBPF programs")
Signed-off-by: Chris Mason <mason@kernel.org>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://patch.msgid.link/20261101190535.1454146-15-alexei.starovoitov@gmail.com
Diffstat (limited to 'scripts/basic')
0 files changed, 0 insertions, 0 deletions
