Re: BUG_ON in skb_segment, after bpf_skb_change_proto was applied
From: Shmulik Ladkani <hidden>
Date: 2019-09-03 17:03:19
On Tue, 3 Sep 2019 12:23:54 -0400 Willem de Bruijn [off-list ref] wrote:
This is a lot more code change. Especially for stable fixes that need to be backported, a smaller patch is preferable.
Indeed. Thanks for the feedback.
My suggestion only tested the first frag_skb length. If a list can be created where the first frag_skb is head_frag but a later one is not, it will fail short. I kind of doubt that. By default skb_gro_receive builds GSO skbs that can be segmented along the original gso_size boundaries. We have so far only observed this issue when messing with gso_size.
The rationale was based on inputs specified in 43170c4e0ba7, where a GRO skb has a fraglist with different amounts of payloads.
We can easily refine the test to fall back on to copying only if skb_headlen(list_skb) != mss.
I'm concerned this is too generic; innocent skbs may fall victim to our skb copy fallback. Probably those mentioned in 43170c4e0ba7.
Alternatively, only on SKB_GSO_DODGY is fine, too. I suggest we stick with the two-liner.
OK. So lets refine your original codition, testing only the first frag_skb, but also ensuring SKB_GSO_DODGY *and* 'skb_headlen(list_skb) != mss' (we know existing code DOES work OK for unchanged gso_size, even if frags have linear, non head_frag, data). This hits the known, reproducable case of the mentioned BUG_ON, and is tightly scoped to that case. If that's agreed, I'll submit a proper patch. Best, Shmulik