Article View: linux.kernel.netdev
Article #6629Re: [PATCH net-next v2 11/15] net: skbuff: refuse to segment a nested frag_list
From: Josef Bacik
Date: Thu, 22 Oct 2026 19:58
Date: Thu, 22 Oct 2026 19:58
43 lines
13467 bytes
13467 bytes
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? net-next is closed, so I'll resend the whole series once it reopens. Thanks, Josef
Technical Details
Message-ID:
<179269910950894.2.12425346173477603662@toxicpanda.com>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-350853-linux-kernel-netdev=dewy.ruReferences:
<20261021-b4-skbuff-bug-on-followups-v2-0-2aa780a03524@toxicpanda.com> <20261021-b4-skbuff-bug-on-followups-v2-11-2aa780a03524@toxicpanda.com> <willemdebruijn.kernel.11bad1f39601b@gmail.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-350853-linux-kernel-netdev=dewy.ru
From: josef@toxicpanda.com (Josef Bacik)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net-next v2 11/15] net: skbuff: refuse to segment a nested frag_list
Date: Thu, 22 Oct 2026 19:58:29 +0000
Organization: Usenet Network
Message-ID: <179269910950894.2.12425346173477603662@toxicpanda.com>
References: <20261021-b4-skbuff-bug-on-followups-v2-0-2aa780a03524@toxicpanda.com>
<20261021-b4-skbuff-bug-on-followups-v2-11-2aa780a03524@toxicpanda.com>
<willemdebruijn.kernel.11bad1f39601b@gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Injection-Info: usenet.network;
logging-data="375774"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:btdTUA6xeCZOTq6JOl/o7mjG7v8= sha256:4+bNJctleTfBuj4GYsaG+s64mJOnT/aajxgQq9UGCr0=
sha1:FYSzaECeOvK+o/wwcBvPQ3Sjn6E= sha256:mAANUopr52KRU0V3lUOFPJYCI3U+a0cwNwRKo6Dn5YI=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
by mail.dewy.ru (Postfix) with ESMTP id EDC051113A7; Fri, 23 Oct 2026 03:44:44 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -1.973
X-Spam-Status: No, score=-1.973 tagged_above=-9999 required=6.31
tests=[DATE_IN_PAST_03_06=1.076, DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1,
DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,
HEADER_FROM_DIFFERENT_DOMAINS=0.25, MAILING_LIST_MULTI=-1,
RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001,
URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
header.d=toxicpanda.com
X-Received: from mail.dewy.ru ([127.0.0.1])
by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
with ESMTP id l0aSuerxCNhB;
Fri, 23 Oct 2026 03:44:41 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-350853-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN>
X-Authentication-Results: OpenDMARC; dmarc=none (p=none dis=none) header.from=toxicpanda.com
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
by mail.dewy.ru (Postfix) with ESMTPS id 656D21112F7; Fri, 23 Oct 2026 03:44:33 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
by sea.lore.kernel.org (Postfix) with ESMTP id D4A433198A; Fri, 23 Oct 2026 00:44:27 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
t=1792716267;
b=Dep0rgTqZrAVWffKK+As+RtDd7jKaTmsRRRU1yOkzzf4fACnbwLR0nydbvJ1JvH5bQ++
qZ351krWSul/7JMk5TcN5QEozV9s/udfEG6gsCflaUoTU+D7IL3vXCK2JycsoyKNw6Jf8
4SUsQ5kUxrKwZV/ps1IyVtkVZAU0jViJ7skKsnRt1zmSWVsfX0QfHNHCE1S95X4YliTKH
bnJmO/k58YKkYgFi4APPm6neEfjRtMhQmep1Av41zCPXv8HCS4PPK0AdlOV51adnayC/m
ETBzsiDPSV7ymO4YXUftNriRjzL5jHmz7Fg/JGFI7lHQaBzB6xuK6p/HBlD24HOroWA==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1792716267;
h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature:
X-Google-DKIM-Signature:X-Forwarded-Encrypted:X-Gm-Message-State:
X-Gm-Gg:X-Received:Received:From:To:Cc:Subject:Date:Message-ID:
In-Reply-To:References:X-Mailing-List:List-Id:List-Post:List-Help:
List-Subscribe:List-Unsubscribe:List-Owner:Precedence:MIME-Version:
Content-Type:Content-Transfer-Encoding;
bh=jfhyo87AY7L5DeyPwopI2784pYBnvPIRPDiBBG8hjuE=;
b=xyy/s5u2iuZk1vfwWoD+yDr9BQSfQBL3kHkle9kMcbLqTSioM643UWNnY33YONzN2FX6
bbIa64kzwdPnF2K6bO9EMF8okNwapjIzxysJh7DNahrnCh0Bt0cjyH9ACIJUqJQUAEyJ4
wQB1HSAvUcgTNxCLikLTCb57fLj5Ha/+K0tOWxB+Yuq4QdhLvhuCEVXUOX62yDXx6WD2f
zOP0RUnY85FnOnUQH0ty6bPDg/xob7HN+NM2et0+a0+N/Wc8wbDJqZs4/wAOQmK6tJW8F
2qidL7+Ct+j6LSJIcL+Rjp9GxEmg+3oDKtFPwjXXQpYhlu3r9Hf5VXwaCywQeoOrI1A==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org;
dkim=pass header.d=toxicpanda.com header.i=@toxicpanda.com header.a=rsa-sha256 header.s=google header.b="bBvJBLv/";
dmarc=none header.from=toxicpanda.com;
spf=pass smtp.mailfrom=toxicpanda.com;
arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id ABCEE606A320;
Fri, 23 Oct 2026 00:44:27 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key, unprotected) header.d=toxicpanda.com header.i=@toxicpanda.com header.a=rsa-sha256 header.s=google header.b=bBvJBLv/
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.219.44
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
t=1792716266;
b=MLk+zfH/PkrUrRy06JHo6tylO8mN4sYUoGtMChB91CKdcibbZCfuq7fieIZePfOd/LXq
0vZGGjdNHc9n8uQNUPz9+R9A6RbzOz9WW+/AAeDsogdYPkJH+iz8GEd4E1Bj0jVSRoWvK
AaUqL2vtPpgyKiK69QCTzUBDTYyD3mdBJ0wWxfN0nApYFe5zQtw7IvVECa6auGwCFtCWd
oL3rKlNZDVtmGYgiKS5fwTK8kwSu3a4k1irSrswd1DrEP/9/QJn0oPmEosj9WUv0hcgOb
ZAlwSXMLh6vOJTQFBBYXO50yBP3xxd0CG4gEtL+LbdPF+S87KCYtr6R3ICs9EKzeWYg==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1792716266;
h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature:
X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received:
From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:
MIME-Version:Content-Type:Content-Transfer-Encoding;
bh=jfhyo87AY7L5DeyPwopI2784pYBnvPIRPDiBBG8hjuE=;
b=t2ObZDxjezBwFuUji23WlqeB5704st/qUML6P0wiakhe4caGcIZyYmjsA9bzajTKa26A
Kq+upyECkDxawfehY/bnk159PpbhU1qdnraLsMwxph3GFM1lFLCEnfkRNiGtGj+aWprrl
ReelYUeT8IIp++rCbzOqNM66ryZBh3jYkENREZuJmzgGzWKBNlDU//dWtSFV/GlMTrhrA
22E1y64ZxmSCddMyz2bLzZ6V1pUvk0J7gnn7bfO8fCgVFMzPO38cdx6r9bTff+nh88igG
IZ3Ow7kKYr/7k0AGC6Q1lImi6xcE0WZKZkVmdFN7QFV65WMmgHDkdeYyadB0nHMuNWg==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org;
dmarc=none header.from=toxicpanda.com;
spf=pass smtp.mailfrom=toxicpanda.com;
dkim=pass header.d=toxicpanda.com header.i=@toxicpanda.com header.a=rsa-sha256 header.s=google header.b="bBvJBLv/";
arc=none smtp.remote-ip=209.85.219.44
X-Received: from mail-qv1-f44.google.com (mail-qv1-f44.google.com [209.85.219.44])
(using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)
key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256)
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6B1AD606A319
for <netdev@vger.kernel.org>; Fri, 23 Oct 2026 00:44:26 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 6B1AD606A319
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=toxicpanda.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=toxicpanda.com
X-Received: by mail-qv1-f44.google.com with SMTP id 6a1803df08f44-9178aabd30dso4129316d6.1
for <netdev@vger.kernel.org>; Thu, 22 Oct 2026 17:44:26 -0700 (PDT)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=toxicpanda.com; s=google; t=1792716265; x=1793321065; darn=vger.kernel.org;
h=content-transfer-encoding:content-type:mime-version:references
:in-reply-to:message-id:date:subject:cc:to:from:from:to:cc:subject
:date:message-id:reply-to:content-type;
bh=jfhyo87AY7L5DeyPwopI2784pYBnvPIRPDiBBG8hjuE=;
b=bBvJBLv/e+ahVwqWQ2kIUSUi5CG5hRc1cP2R7M598nhfmTjUBmro9sBK6TYZo2F4MU
sJsnGjLPFQhpEaySiDfN5eRNhM576S4BD8RLT9mnN6JzohW9rOpxC0w429g5328xd2wS
52XIs2o8HoL5I2rKlfOmmn4yuEiDqMTs4LVq+pqyo9surZ1uMtJEt08EK5Mi6j7nUeH4
8pG6tPaii5fBq0LI/KMye8kw7mOsSXD5GPdLLhgcdlnxydIq4138UMgKIvd0VoQPuajU
uLeEbmwOYaMo+7bZZ8MWNcZX/pxX+TDf3NMIlhu0Q5TdxDczO+TaCbQfNDZ+UIJuCbJ1
YvZQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20260707; t=1792716265; x=1793321065;
h=content-transfer-encoding:content-type:mime-version:references
:in-reply-to:message-id:date:subject:cc:to:from:x-gm-gg
:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to
:content-type;
bh=jfhyo87AY7L5DeyPwopI2784pYBnvPIRPDiBBG8hjuE=;
b=ZsLB75nEBO64fUv8/YSVzfAEiFKtgKuGTwRAUyFdUYVqsda618jz3BAxL3kQ15TmHb
nAaVlhJ5clgrRWw9l1Scr3fZXZuM17y+lH+LScS9Byc7cpo7Ga0oJh/NDAPusLzaswd6
hV5u54Z74TMCjHaRbHRt1CeMxp2aC3ycmMIfFOVNGKAQvDOtdk0OvoanaMH4GV930sxn
o3Gp21jLjLjHIxsCKQImKozJ69uWqHjmMuc6gCiHkdvSNeiWQ3r78cNgqcCtuMw1cYRe
kgd5hnbb6BlB3Y07MyeYY6mqDnwruk/N8XDe1Q+piX/yuq8k86CDoXSgiHEx8w3jdk56
yrYw==
X-Forwarded-Encrypted: i=1; AKwUvBxEFh4AT0TynJJzQGX4UyuKVS2ExuyKSo6duzeSyKdYBVOEdFrAbhU3Irbv7s+Rg7M6xyW9U1c=@vger.kernel.org
X-Gm-Message-State: AFq9FYKeJL+NOHOpTl59DnRBtToyNS09Hf5veL0qN0w2AP/y+g1ikfSi
ZzGFmFFEYBCIPO3BgZGGuE132z3M0nnZ9v5HFANS7G4WOM8DXP7/d8I8/31fUU2jlHo=
X-Gm-Gg: AYBFou1sCC9K70ylmvcaSsW5GxsPY3B9kRm6nQASsT5QXHANWcdaKllLMWBf64PN7Tv
wQ4AcHS6rSjB3jRX4uJgoD84x4Wxoq/4FKVVy/UEEpPlslQJsoJCoF79Oblue8dsVNnolpyguRn
AOcliJKBip3ZH29rPUxR6gQv4mIbv4YVM8v88DmqEXiq8zBcsC8Wqk2xauj6uYtovc+3D66ongc
Ag3oHSbKD7n3eaGgRk2l1TA9ZCykpiAI8DqsofMAvs0pX28N84R/mISW4hI9qlp0AAhECMTkhli
4i3dngAQIZ/uWw6Jj5vXxsUyulNw7/tgcmHLCphzLnNVDD+P/HwHFDwCQU//W1AMZok6Ppoiiad
z7KJucWDQA4uR9OCcQzMbwVhsvl1o2W6d1vFKUBAw04+rYemTEDTfuo0QXnL4gH/PlctSgXVMlz
j2wokaUPEwGbcFMx3rkdF1GrXA8sUGWcHPt4MVYSx6AiXuOLA4M4JN4zPU2+4SiwldXHpALhrPx
pjwSXhzlyNw5jQUXHvOcNjFrkmGC7xVvOObungxDRYp2ZUAhMSkufqGixLeF+TMIkSMfa5FhhEP
jyqYqmzrpqlDwmJkTg==
X-Received: by 2002:a05:620a:6188:b0:93e:a8c5:132f with SMTP id af79cd13be357-93f6f788f5cmr211153385a.29.1792716265323;
Thu, 22 Oct 2026 17:44:25 -0700 (PDT)
X-Received: from toxicpanda.com ([153.61.196.242])
by smtp.gmail.com with ESMTPSA id af79cd13be357-93f70e81a80sm54979785a.1.2026.10.22.17.44.23
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Thu, 22 Oct 2026 17:44:24 -0700 (PDT)
X-Cc: "David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@kernel.org>, Jakub Kicinski <kuba@kernel.org>,
Paolo Abeni <pabeni@redhat.com>, Simon Horman <horms@kernel.org>,
Andrew Lunn <andrew+netdev@lunn.ch>, Juergen Gross <jgross@suse.com>,
Stefano Stabellini <sstabellini@kernel.org>,
Fernando Fernandez Mancera <fmancera@suse.de>,
Mina Almasry <almasrymina@google.com>,
David Laight <david.laight.linux@gmail.com>, netdev@vger.kernel.org,
xen-devel@lists.xenproject.org, Willem de Bruijn <willemb@google.com>
X-In-Reply-To: <willemdebruijn.kernel.11bad1f39601b@gmail.com>
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list