bpf: only adjust gso_size on bytestream protocols
authorWillem de Bruijn <willemb@google.com>
Thu, 7 Feb 2019 19:54:16 +0000 (14:54 -0500)
committerAlexei Starovoitov <ast@kernel.org>
Mon, 11 Feb 2019 03:57:34 +0000 (19:57 -0800)
commitb90efd2258749e04e1b3f71ef0d716f2ac2337e0
tree80309f233c9c0c374e9c8b9832f21fc44b8590c4
parentd623876646be119439999a229a2c3ce30fd197fb
bpf: only adjust gso_size on bytestream protocols

bpf_skb_change_proto and bpf_skb_adjust_room change skb header length.
For GSO packets they adjust gso_size to maintain the same MTU.

The gso size can only be safely adjusted on bytestream protocols.
Commit d02f51cbcf12 ("bpf: fix bpf_skb_adjust_net/bpf_skb_proto_xlat
to deal with gso sctp skbs") excluded SKB_GSO_SCTP.

Since then type SKB_GSO_UDP_L4 has been added, whose contents are one
gso_size unit per datagram. Also exclude these.

Move from a blacklist to a whitelist check to future proof against
additional such new GSO types, e.g., for fraglist based GRO.

Fixes: bec1f6f69736 ("udp: generate gso with UDP_SEGMENT")
Signed-off-by: Willem de Bruijn <willemb@google.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
include/linux/skbuff.h
net/core/filter.c