Netdev List
 help / color / mirror / Atom feed
* [PATCH net-next 0/4] net: skbuff: skb_segment() fixes for frag_lists without SG
@ 2026-11-13  0:21 Josef Bacik
  2026-11-13  0:21 ` [PATCH net-next 1/4] net: skbuff: don't clone a nested frag_list member Josef Bacik
                   ` (4 more replies)
  0 siblings, 5 replies; 8+ messages in thread
From: Josef Bacik @ 2026-11-13  0:21 UTC (permalink / raw)
  To: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Simon Horman, Andrew Lunn
  Cc: Willem de Bruijn, Fernando Fernandez Mancera, Mina Almasry,
	David Laight, netdev, Josef Bacik

Hello,

Sashiko's review of "net: skbuff: don't run off frag_list in
skb_segment()"[1] found two problems in the branch of skb_segment() that
clones a frag_list member.  Both only show without SG.  That series was
applied before I got to them, so these go on top.

Patch 1 is about a member that has a frag_list of its own.  The clone
loses the nested data and the next member goes out in its place.  My
patch made this worse: for some layouts it turned a NULL pointer
dereference into wrong data.  Nothing in the tree is known to build such
an skb.

Patch 2 is older and doesn't need a broken skb.  Without SG the copy
doesn't move the frag_list walk along, so a member that has already been
copied from can still be cloned.

Patch 3 makes the GSO KUnit test compare the payload of the segments.
It only looked at their lengths, which is how I missed the first problem.
Patch 4 adds the layouts that went wrong.

GSO_BY_FRAGS is left exactly as it is.  It needs a fix of its own, which
I'll send separately.

The bug that patch 2 fixes is in released kernels.  Both fixes change
the condition as that series left it, which is only in net-next, so I've
based all of this on net-next.

I tested this with the net_core KUnit tests at each patch, with each
check taken out in turn to see a case fail, and with a throwaway KUnit
case that segments 100000 random layouts and compares the payload.
Without SG, out of 10000 layouts each:

                      wrong payload   -EINVAL   right
  nested, net-next               61        78    9861
  nested, patch 1                 0         0   10000
  valid, net-next                79        39    9882
  valid, patch 2                  0         0   10000

The results with SG, and with GSO_BY_FRAGS with and without SG, are the
same before and after each patch.  I also ran SCTP over veth with
tx-sctp-segmentation off, and the tests from the earlier series under
KASAN.  Thanks,

Josef

[1] https://lore.kernel.org/all/20261104-b4-skbuff-bug-on-followups-v4-11-b7ffeb364f5d@toxicpanda.com/

---
Josef Bacik (4):
      net: skbuff: don't clone a nested frag_list member
      net: skbuff: don't clone a stale frag_list member
      net: compare the payload in the GSO KUnit test
      net: test more frag_list layouts without SG

 net/core/net_test.c | 199 +++++++++++++++++++++++++++++++++++++++++++++++-----
 net/core/skbuff.c   |  12 +++-
 2 files changed, 190 insertions(+), 21 deletions(-)
---
base-commit: 676f3aace662fbbc180b3898b190a372fa2a516b
change-id: 20261112-b4-skb-segment-clone-fixes-79ddc7ec0494


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2026-11-19  9:26 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-13  0:21 [PATCH net-next 0/4] net: skbuff: skb_segment() fixes for frag_lists without SG Josef Bacik
2026-11-13  0:21 ` [PATCH net-next 1/4] net: skbuff: don't clone a nested frag_list member Josef Bacik
2026-11-19  9:23   ` Paolo Abeni
2026-11-13  0:21 ` [PATCH net-next 2/4] net: skbuff: don't clone a stale " Josef Bacik
2026-11-19  9:26   ` Paolo Abeni
2026-11-13  0:21 ` [PATCH net-next 3/4] net: compare the payload in the GSO KUnit test Josef Bacik
2026-11-13  0:21 ` [PATCH net-next 4/4] net: test more frag_list layouts without SG Josef Bacik
2026-11-13  2:52 ` [PATCH net-next 0/4] net: skbuff: skb_segment() fixes for frag_lists " Mina Almasry

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox