summaryrefslogtreecommitdiff
path: root/scripts/basic/split-include.c
diff options
context:
space:
mode:
authorChris Mason <mason@kernel.org>2026-11-01 19:05:33 +0000
committerAlexei Starovoitov <ast@kernel.org>2026-11-02 00:10:40 +0000
commita9d08fe60fa728ce0e3a99085241e8e790fb14c6 (patch)
tree6d9fdee5ef29cfcc905db58a78803934c8a229f4 /scripts/basic/split-include.c
parent95f1d5e4abb79fe85a54f7a46b41f297ce533c31 (diff)
downloadlinux-a9d08fe60fa728ce0e3a99085241e8e790fb14c6.tar.gz
linux-a9d08fe60fa728ce0e3a99085241e8e790fb14c6.zip
bpf: Move the transport header with the moved headers
bpf_skb_net_hdr_pop() removes len bytes at offset off. bpf_skb_net_hdr_push() does the opposite. skb->data off before | A | removed | B | after | A | B | skb->data off mac_header and network_header move with A. transport_header moves only when it is equal to network_header. inner_transport_header never moves. This is correct only for a header in B. In bpf_lwt_seg6_adjust_srh() transport_header is in A. bpf_skb_adjust_room() can remove both transport headers. With an incorrect header offset, the stack can drop the skb or read outside of it. Also move transport_header with A when it is in A. Set it to offset off when it is in the removed bytes. In BPF_ADJ_ROOM_MAC mode it is then equal to network_header. Do not unset it, because skb_gso_validate_mac_len() uses it without a check. After a removal, set inner_transport_header to off when it is not in B and skb->encapsulation is set. A has only outer headers. Fixes: fe94cc290f53 ("bpf: Add IPv6 Segment Routing helpers") Fixes: 868d523535c2 ("bpf: add bpf_skb_adjust_room encap flags") Signed-off-by: Chris Mason <mason@kernel.org> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Link: https://patch.msgid.link/20261101190535.1454146-26-alexei.starovoitov@gmail.com
Diffstat (limited to 'scripts/basic/split-include.c')
0 files changed, 0 insertions, 0 deletions