Re: [PATCH] test_bpf: Add an skb_segment test for a non linear frag_list whose head_frag=1 and gso_size was mangled

From: Fred Li
Date: Mon May 27 2024 - 10:07:58 EST


For kernel 6.6.8, when sg is true and skb_headlen(list_skb) != len, it also has
chance run into this BUG_ON() line 4548.
'''
4544 hsize = skb_headlen(head_skb) - offset;
4545
4546 if (hsize <= 0 && i >= nfrags && skb_headlen(list_skb) &&
4547 (skb_headlen(list_skb) == len || sg)) {
4548 BUG_ON(skb_headlen(list_skb) > len);
4549
4550 nskb = skb_clone(list_skb, GFP_ATOMIC);
'''

As commit 9e4b7a99a03a("net: gso: fix panic on frag_list with mixed head alloc types")
said. It walk the frag_list in skb_segment and clear NETIF_F_SG when there is non head_frag
skb.

But for frag_list only with one head_frag, NETIF_F_SG was not cleared, if skb_headlen(list_skb) != len,
in this case, maybe we can fix it with run into segment as commit 13acc94eff122(net: permit skb_segment on
head_frag frag_list skb).

Any suggestions for resolving this issue.

Thanks

Fred Li