Article View: linux.kernel.netdev
Article #15042[PATCH net 0/2] nsh: limit recursion in nsh_gso_segment()
From: Eric Dumazet
Date: Thu, 12 Nov 2026 10:19
Date: Thu, 12 Nov 2026 10:19
38 lines
8822 bytes
8822 bytes
Sashiko found that nsh_gso_segment() can call itself, through
skb_mac_gso_segment(), once per stacked NSH header. Nothing limits the
depth, and a 64KB GSO packet made of 8-byte NSH headers overflows the
kernel stack. It was reported while reviewing an unrelated virtio
series [1].
Such a packet can be sent with a packet socket using PACKET_VNET_HDR,
when the nsh module is loaded.
Patch 1 uses the recursion counter added in commit 006c8b834aed ("net:
gso: limit recursive IP-in-IP segmentation"), with the same limit as
IPv4 and IPv6.
Patch 2 adds a selftest: it panics an unfixed kernel, and passes with
patch 1.
[1] https://lore.kernel.org/netdev/179443691180.2199510.148246238688217560@kernel.org/
Eric Dumazet (2):
nsh: limit recursion in nsh_gso_segment()
selftests: net: add a test for NSH GSO
include/net/gso.h | 2 +-
net/nsh/nsh.c | 7 ++
tools/testing/selftests/net/.gitignore | 1 +
tools/testing/selftests/net/Makefile | 2 +
tools/testing/selftests/net/config | 1 +
tools/testing/selftests/net/nsh_gso.c | 126 +++++++++++++++++++++++++
tools/testing/selftests/net/nsh_gso.sh | 71 ++++++++++++++
7 files changed, 209 insertions(+), 1 deletion(-)
create mode 100644 tools/testing/selftests/net/nsh_gso.c
create mode 100755 tools/testing/selftests/net/nsh_gso.sh
base-commit: 145480b28ca82e9fae789427cc4569e596515a32
--
2.53.0
Technical Details
Message-ID:
<20261112102001.3744643-1-edumazet@kernel.org>Path:
mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!nntp.comgw.net!eternal-september.org!feeder.eternal-september.org!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-361703-linux-kernel-netdev=dewy.ruShow Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!nntp.comgw.net!eternal-september.org!feeder.eternal-september.org!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-361703-linux-kernel-netdev=dewy.ru From: edumazet@kernel.org (Eric Dumazet) Newsgroups: linux.kernel.netdev Subject: [PATCH net 0/2] nsh: limit recursion in nsh_gso_segment() Date: Thu, 12 Nov 2026 11:19:59 +0100 Organization: Usenet Network Message-ID: <20261112102001.3744643-1-edumazet@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="1060066"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:LEEpEprNwjsG0I/ub2Mu9WdRfcY= sha256:UJVc8ABTMGXfSn3ppEEka7mgpRhAgQyxOUpdcHZ+PVQ= sha1:cGWIlOn9CWrjg5ktBDG7Ugx2tVQ= sha256:Ar0AE2IAtqxo0NujR7uVsfnTm/8ox+mdNfO53xh2Ws8= 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 46ADA1141B8; Thu, 12 Nov 2026 13:26:31 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.401 X-Spam-Status: No, score=-3.401 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=kernel.org 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 g2keQaWATABY; Thu, 12 Nov 2026 13:26:25 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-361703-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114]) by mail.dewy.ru (Postfix) with ESMTPS id D3F931141AE; Thu, 12 Nov 2026 13:26:14 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by tor.lore.kernel.org (Postfix) with ESMTP id 2BA80476F7; Thu, 12 Nov 2026 10:20:11 +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=1794478808; b=wiLLSRLZcNc8QZAYCDlSL9MdMh9hcgu3J0XThrauEIlElRcCRGYmMSwNKQRcsvtBG+J3 xSPSBiHgzy2PW4YsV7F/UnriZ009mSxD++44RUzikSWPM5duCUyGhCjzfoHkHTHYwG3+H VAXenHxylbhbNMBTGIFgKPbaXrxg2bdQyX04D/b51kvwbuyb8fMoJ98mzY64Bcwlmj+HR /n/8xscQ1bd8OntYLl4IROa3nJS5ulzB7FtW0qXPuIAtLoIQICmKsbn0wClv/rgphckb5 7RCv9/pNuZrwzevrIXzAiHSgkydQeXKvET4Mpu+EMbLhKLWCuzJ6ZyCxqGpGAKLGunA== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794478808; h=X-Original-To:Received:Received:DKIM-Signature:From:To:Cc:Subject: Date:Message-ID:X-Mailer:X-Mailing-List:List-Id:List-Post:List-Help: List-Subscribe:List-Unsubscribe:List-Owner:Precedence:MIME-Version: Content-Transfer-Encoding; bh=sF7y7ODXiFCQ/wwsbAodrtj1P3nmUKeBBn5BI0VTc0E=; b=1Tn7uF2Vrg9tMYw8Pq56YZ4Quo4G0S3R+Rr0U85Ecs546rBdHtX+co0C6BraCw8FhI3b SVJGgSfJ3SWNC8kBrac1tOCc1d/jdaVyCymcX47QLlYP6YL1hKpzhIvrIXP5Xp275/lWz 0nwHhMFGQlTAHTsyhxdg72pI9DCDmGK88+8T2rzvG2d2HhI3Wld/6otFsL+4n5ObLT2eJ gf9fQziOqmUyIXJje/uM2B2P8nNvN3FhZ7XnB5iNOnIYvTS0Z6eQVIGsqOAcs3hmk7osB WiLg4PUlKlF4X7KCDjKA7G+KL33cTDYgv0ISIlTxrrd4rPV5Q/2iXO0Cn3Wq8221xPg== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=U6U2JQgE; 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 51A61606A333; Thu, 12 Nov 2026 10:20:08 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=U6U2JQgE X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1794478807; b=XtlWPBza1eGoZD/K7Szh6Dicl2WKeP7h8Ks1elkJQb2Tad/YgXzExDNtuaZTRNdw9ypB YiIBernN8SWdreGahiVVbfYTa7vtuW8duaCOT3Z7fHVsdUPs6j/DPs4qda/KPco+UEVLZ lS/K6M/+IDPNrJgTBSKBN/xo6QUteLCR2zjG1JV68z8mMjw825Qup5Qi5b7l8raJQJfkA qayNgw8loEvq4vvfhz8o9JkyfhKOfmh1nYbaG3tsylr/hs7v/cTBEF2FSUa6QX2QZkWiB REzA7mo2G8W7AY+Kf2jAKl+j6t1Wz1KsF9ODP0nTSLnnNqQDeiDJeA2mN59kWR5WwcA== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794478807; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: MIME-Version:Content-Transfer-Encoding; bh=sF7y7ODXiFCQ/wwsbAodrtj1P3nmUKeBBn5BI0VTc0E=; b=HlNBHeUoF7VRjfTWTfFHMLRB+387ycL/0adI2CcRPTUudN4vMbtkzjZ21UQVbIjk2VY6 BRzWOPlWXmZC/sC9YWqZW+geU+ZSKTJ4AucUXsHmq/s3SHfpTBtEuSbWik20yw/qGMLIA UMjecrHJssHMHhhF2V+mNC5WJQQMbMA26MWqgRfwOvdD20YIlsvDISB070xbMsIBkSqZL CWRjITOKnawqorP1GC0/l98r+1uWAKW5pG9/8znacRNuBVshkZlOCcSmb2BG8Mf3zq+6E OoW4IhLEV+2WoRCzhnlaKVQ6YqmsVu0AooqrmNv9NTrLafHYyt8JMhEjSZil/cokWIA== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=U6U2JQgE; arc=none smtp.remote-ip=100.103.45.18 X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6E3C3606A31C for <netdev@vger.kernel.org>; Thu, 12 Nov 2026 10:20:07 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3FA9F1F00A08; Thu, 12 Nov 2026 10:20:05 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1794478807; bh=sF7y7ODXiFCQ/wwsbAodrtj1P3nmUKeBBn5BI0VTc0E=; h=From:To:Cc:Subject:Date; b=U6U2JQgErZA2G6OwqLJGOF9Q/A1561fMpL4ZOBI8Lh+R5rSU7U4f2h5NG2YiuWlli RBDL+3sBIZTQYffAoxZLXHIxMcCvU88yBJXGqhDQ469ACO2JJ5vcPTiW+A0BsYBLlp vebM2HkbY4JQYdFA3ipkcT1aCOwGmSuKUGsrc+99mSdpESRH/Wr7SoqCdrQYZQocAn lVFCdddmcuVQT6d+t+HXlxpnu9knuHbj/kG3M5J7zXMKUuRLMeRJQmjB1RymYL3ySf D0TqvC1jsdXHMXM5oyCJxa/C5AFCsUywb4n6qQy8qyXQIeaWwwNvYEbKthq/YkFERp uJW2A5L+ZZZXg== X-Cc: Willem de Bruijn <willemb@google.com>, Simon Horman <horms@kernel.org>, netdev@vger.kernel.org, edumazet@kernel.org X-Mailer: git-send-email 2.53.0 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