[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH net-next v2 11/15] net: skbuff: refuse to segment a nested frag_list


  • To: Josef Bacik <josef@xxxxxxxxxxxxxx>
  • From: Willem de Bruijn <willemdebruijn.kernel@xxxxxxxxx>
  • Date: Thu, 22 Oct 2026 23:07:16 -0400
  • Arc-authentication-results: i=1; mx.google.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20260327; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=hgV4FpDL0VDAwuHx+GSLC+BPtqKn4ASJs6Viz9YKJlE=; fh=3CKQEljtludsAruFLrms6jIE/S6hEszVJBxpFWIkCPM=; b=gihe/4EZySI+qvd3ZWHhzUBJWY/NUrHk8UJftn3s/oIqUu1eOThnRWupv9Qn3itskg ScpSNFSd+Ax6J/xh5/fWwifaE2MW0PlkdDAlRgLLdXcdZEn5R+RiyUUNFgiwjdMITRc1 JHHadPPGSzFWhD94qmZSvdkqOj7fMisByVDY3v1UPx1qBehDQeOvcX/6CiMJaceM2wky 7tec+hGQfZaG/37xHh1iHhb1OY+y7Dl/h5E7MjhSes/deG7JzTMpHYhxd0hbN2lMPtpu P8PimewbGXtXpM+v1K2D6XywaOTutXDhTfWqHNrK6wE+UJBVWdPTyzxh7uOcgbU994t3 fKlg==; darn=lists.xenproject.org
  • Arc-seal: i=1; a=rsa-sha256; t=1792724874; cv=none; d=google.com; s=arc-20260327; b=VsSgvb4DhumzRLcEeC5k7Aat3QePoxsFvcpBhlNKR89w0f7Ufnuai46D4NfGDJPhYl qC+PAd3TwGXDxb9rud2H7FwHByRdg1iP/Du4BRSahZlF2b+TfAw6n0z+IRR2/scVdMvS ZC0C7I3zvKAoVDuENkxMEvFRfuLvnTD2UDLgdRF4wzahVfDhzZx9xwvM48RPPwPpTIel ez1+MK2OlHVLpjfbe6rcR7M2QjtHUINi3rCrImOMbjfvtY6/VWdNAmoBX6Jy5JwFLE2K YVAagSQDEY8aQTcbItEp8CdcglMiukgy5gwHL5w6b7cIy1zxUzlnToRK5wI9g6PykSe9 6B1Q==
  • Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=20251104 header.d=gmail.com header.i="@gmail.com" header.h="Content-Transfer-Encoding:Content-Type:Cc:To:Subject:Message-ID:Date:From:In-Reply-To:References:MIME-Version"
  • Cc: "David S. Miller" <davem@xxxxxxxxxxxxx>, Eric Dumazet <edumazet@xxxxxxxxxx>, Jakub Kicinski <kuba@xxxxxxxxxx>, Paolo Abeni <pabeni@xxxxxxxxxx>, Simon Horman <horms@xxxxxxxxxx>, Andrew Lunn <andrew+netdev@xxxxxxx>, Juergen Gross <jgross@xxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Fernando Fernandez Mancera <fmancera@xxxxxxx>, Mina Almasry <almasrymina@xxxxxxxxxx>, David Laight <david.laight.linux@xxxxxxxxx>, netdev@xxxxxxxxxxxxxxx, xen-devel@xxxxxxxxxxxxxxxxxxxx, Willem de Bruijn <willemb@xxxxxxxxxx>
  • Delivery-date: Fri, 23 Oct 2026 03:08:13 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On Thu, Oct 22, 2026 at 8:44 PM Josef Bacik <josef@xxxxxxxxxxxxxx> wrote:
>
> On Wed, Oct 21, 2026 at 09:47:15PM -0400, Willem de Bruijn wrote:
> > This patch became quite a bit more complex because of my request.
> > More than I anticipated.
> >
> > Are you sure this first block is needed?
>
> No, it isn't.  I took it out and ran three KUnit cases with a nested
> frag_list under GSO_BY_FRAGS: a linear first member with the nested
> bytes counted in its len, the same without them counted, and a paged
> first member.  They all still get -EINVAL, from the check in the clone
> branch or the one in the frag walk.
>
> > this test for list_skb != NULL is new. Previously this code already
> > tested skb_headlen(list_skb) without it. Likely not needed for
> > anything new in this patch?
>
> Same answer, the cases above pass without it too.  With every member
> checked as it's taken, list_skb can only run out if head_skb->len is
> wrong for some other reason, which isn't what this patch is about.
>
> So done this way the patch comes down to the check you suggested in the
> frag walk, plus skb_has_frag_list(list_skb) added to the existing
> headlen check in the clone branch.  The second one is needed: with only
> the frag walk check, the frag_list_nested KUnit case still hits a NULL
> pointer dereference in skb_segment(), because the linear member is
> cloned, list_skb becomes NULL, and the next pass reads its headlen.
>
> The other option is to go back to the single walk up front from v1.
> It's an extra pass over the frag_list, but it's one check in one place.
> The difference in behaviour is without SG: there a nested frag_list
> whose member doesn't match gso_size goes through the copy path, which
> recurses, and a KUnit case for that gets correctly sized segments
> today.  The in-walk checks leave that alone and the up front walk would
> refuse it.  Nothing in the tree builds a nested frag_list either way.
>
> I lean towards the walk up front for v3 because it's simpler to read.
> Would you be ok with that, or do you prefer the two in-walk checks?

Given the complexity of skb_segment already, and how non-trivial
the added inline checks are, I'm also okay with the up front walk.

It only adds cost for GSO skbs that use a frag_list. Though that
may include some relatively common cases, such as BIG TCP.



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.