Article View: linux.kernel.netdev
Article #11050Re: [PATCH net v2 1/3] net: virtio: validate outer protocol of UDP tunnel GSO packets
From: Willem de Bruijn
Date: Wed, 04 Nov 2026 15:32
Date: Wed, 04 Nov 2026 15:32
60 lines
13823 bytes
13823 bytes
Eric Dumazet wrote:
> virtio_net_hdr_tnl_to_skb() trusts the virtio header to describe a
> UDP tunnel over IPv4 or IPv6, but never checks that the frame actually
> carries such outer headers. Because VIRTIO_NET_HDR_F_NEEDS_CSUM is
> mandatory for tunnel GSO, __virtio_net_hdr_to_skb() skips the flow
> dissector, so virtio_net_hdr_match_proto() is never applied either.
>
> A guest (or a tap writer) can then inject a frame with an arbitrary
> outer ethertype, for example ETH_P_NSH, with SKB_GSO_UDP_TUNNEL set.
> The GSO stack then runs nsh_gso_segment() on top of the UDP tunnel
> segmentation, which assumes a different header layout. The result is
> segments with skb->data before skb->head, and a host crash in
> skb_under_panic() as soon as a later layer pushes a header:
>
> skbuff: skb_under_panic: ... put:4 ... dev:gretap1
> kernel BUG at net/core/skbuff.c:215!
> skb_push
> __gre_xmit
> gre_tap_xmit
> ...
> tun_get_user
>
> Validate the outer headers with the parsing helpers from Michael's
> series "net: resolve uncommon partial checksums at ingress":
>
> - locate the L3 header from the device type: Ethernet with optional
> VLAN tags, or the network header set by the caller. skb->protocol is
> not trusted when it disagrees with the frame.
> - require the outer L3 protocol to match the declared tunnel type.
> - require the outer UDP header exactly at outer_th_offset, after IPv4
> options or IPv6 extension headers, and reject fragments.
>
> Unlike the original helpers, ipv6_find_hdr() stops at an AH header,
> as Willem suggested in the review of that series.
>
> Fixes: a2fb4bc4e2a6 ("net: implement virtio helpers to handle UDP GSO tunneling.")
> Reported-by: Hassan Sultan <hassansultan@google.com>
> Suggested-by: Willem de Bruijn <willemb@google.com>
> Link: https://lore.kernel.org/netdev/93d0e37c99711bebdf60c120af03010455c2f2e2.1793276116.git.mst@redhat.com/
> Cc: Willem de Bruijn <willemb@google.com>
> Cc: Michael S. Tsirkin <mst@redhat.com>
> Co-developed-by: Michael S. Tsirkin <mst@redhat.com>
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> Signed-off-by: Eric Dumazet <edumazet@kernel.org>
Reviewed-by: Willem de Bruijn <willemb@google.com>
Thanks Eric!
My bot points out a preexisting issue with this udp tunnel feature.
_Not_ reason for changing this patch.
virtio_net_hdr_tnl_to_skb already does not support IFF_TUN, as it has
outer_l3min = ETH_HLEN + virtio_l3min(outer_isv6);
So the only reachable path with IFF_TUN is L3 with IPV4_OPT_LEN 16
(or greater) as indeed test patch 3/3 introduces.
Technical Details
Message-ID:
<willemdebruijn.kernel.332f86b4be346@gmail.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-356560-linux-kernel-netdev=dewy.ruReferences:
<20261104050131.629967-1-edumazet@kernel.org> <20261104050131.629967-2-edumazet@kernel.org>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-356560-linux-kernel-netdev=dewy.ru
From: willemdebruijn.kernel@gmail.com (Willem de Bruijn)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net v2 1/3] net: virtio: validate outer protocol of UDP
tunnel GSO packets
Date: Wed, 04 Nov 2026 10:32:47 -0500
Organization: Usenet Network
Message-ID: <willemdebruijn.kernel.332f86b4be346@gmail.com>
References: <20261104050131.629967-1-edumazet@kernel.org>
<20261104050131.629967-2-edumazet@kernel.org>
MIME-Version: 1.0
Content-Type: text/plain;
charset=utf-8
Content-Transfer-Encoding: 7bit
Injection-Info: usenet.network;
logging-data="3421916"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:ah62MSEqwdKUQ1Y6tYPM0HFrKtY= sha256:eNU3HEc15n2zjrrQLVNPYUyE4O5K321jXocNDnMTA6g=
sha1:ekKCW9/QAjw+2RHfjInPxHtoUGA= sha256:VedM0/sdu318zfCoee1maJrc4ATvtEqNllGliJF8OAE=
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 D8201112C3F; Wed, 4 Nov 2026 18:42:14 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.049
X-Spam-Status: No, score=-3.049 tagged_above=-9999 required=6.31
tests=[DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
DKIM_VALID_AU=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.001,
FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249,
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=gmail.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 uSmQbzKPKvrQ;
Wed, 4 Nov 2026 18:42:11 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-356560-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN>
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=gmail.com
X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114])
by mail.dewy.ru (Postfix) with ESMTPS id DCE77112C19; Wed, 4 Nov 2026 18:42:02 +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 95B79308D9; Wed, 4 Nov 2026 15:32:54 +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=1793806372;
b=0KH49y3IAn4MULI5O7BN81mmHSJo1WYeRiEXhMJQzXRdzU9wrxpNLBog+coweuVmABt6
OtL2rjrhbVeGDftuekLIGybrYQQMfn0eqNbESrc7byLFo8xRD6F+YmqbqGaub2dcAw66e
J0V4NaSSXplC1uF9H7LE6TuiNigV4uYsk7A5Vmle6UXfiid2Z/l5bY6oCMEVjmcK1T1Lu
oWRTqvBFDxQJwg3TNJ0vcTN/uD9LZQDwRqlsUWQOyviTtUpTAGr0plCwbRXgjSp7vkmDY
rZDR21JmEw0tYsGgRk2nhyTQi9FwCzZpU5QnpzibGnqSHeQorA/TFBJXsIBRiHKVUww==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1793806372;
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:Date:From:To:Cc:Message-ID:In-Reply-To:
References:Subject:X-Mailing-List:List-Id:List-Post:List-Help:
List-Subscribe:List-Unsubscribe:List-Owner:Precedence:MIME-Version:
Content-Type:Content-Transfer-Encoding;
bh=VSl8UTHuzcGlusp9eWKHTaKhrhlwdDdWaRoNG7GwWpE=;
b=0wG+1+o3CnCLrViiyeaI06tvnU7OskJrUjvs00EK/luv7Og5kAaOTZBzxBpyD9hpLbwn
V5AmZtCQg8CZjQsZtoweTuxMDuIDUBZcYip1XYSrMqaAh4cPehJYbaCfaFVOnTaDB6fVY
19zgndSqV1RGXDbGxD4J2PPGFVgBNDPmlaUCxp6RD9tDtAVsdZ9UJ/rUjVmusxo/4siRR
nEOPPprm6DrVBrI+N3nc9u6+ii+Z62Efd27hPLjIvYgCpewGqmPQ3DPWmk+ALa15ZHcdR
CC6taK616RwCB5FYCSkV37X60fIkh5lyVVrLouEJUiDLsR02kQdAeTT1F6rJNOqwoYA==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org;
dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=KoffEYmt;
dmarc=pass header.from=gmail.com;
spf=pass smtp.mailfrom=gmail.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 A0602606A329;
Wed, 4 Nov 2026 15:32:52 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key, unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=KoffEYmt
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.221.170
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
t=1793806371;
b=vvycRmdCGImeigecAU36I86cQEMcUkHJQZjicZcYrxlo+w7CKsRFNUN07v5f8l83l42Z
GFiv+ZTgRZIkCtW2Nh4ISQeTB3XK6pTy9ZMSKpI/Orp6+etQZqpgh6tRTVfN0WUaYjIn6
z6AGq60FvG6PPBXWizGUiT365VbEMQ3YgokoqmVzvMlOoBWlSG5eVu0M/L/c1J/WZhZLB
yMIGG5eB4oKjFAeluvPzLUOasMoDWE0hamqOHyOIMiKWsSRMyaZQ7eW6SB5y2Bghm4FIZ
FplrS2jyEJuJid6e01RDArap6uaoG7My7EAkQcnn/18G4KPd4snuH9e68PD53KS6qmg==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1793806371;
h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature:
X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received:
Date:From:To:Cc:Message-ID:In-Reply-To:References:Subject:
MIME-Version:Content-Type:Content-Transfer-Encoding;
bh=VSl8UTHuzcGlusp9eWKHTaKhrhlwdDdWaRoNG7GwWpE=;
b=Bev15GBsypFg/hVgvUQPXSOysEDVdElqfp5JQl3J5dQYoOUHUiPErxRSNRQcOFVGjgL/
qd726h6sPGEkIlFywC0akKCKSm2Mm1EmyY7SPvoB1UFOVPIX7Xmz3xXRsObFLgzKYj9gg
ZigvnbxHt/6pJShn4snlwdbDN5F+XKqsw4giXKWOk9iHT553PiF75YrF+gvt+UzMvghFD
xSSXtWZoJmDCpmB5PyUPZuFM1/D3JWBdc5HKsnCbFb/giyv+DFA3/gJr9c8yxGWFbDal/
M96usKOCmFUYbkXk8TKxrtmKPcgyk0m32Sx6Q4HsGQ9KBKMzNnMTDDjkWXk9G91EoQQ==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org;
dmarc=pass header.from=gmail.com;
spf=pass smtp.mailfrom=gmail.com;
dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=KoffEYmt;
arc=none smtp.remote-ip=209.85.221.170
X-Received: from mail-vk1-f170.google.com (mail-vk1-f170.google.com [209.85.221.170])
(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 26706606A326
for <netdev@vger.kernel.org>; Wed, 4 Nov 2026 15:32:50 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 26706606A326
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
X-Received: by mail-vk1-f170.google.com with SMTP id 71dfb90a1353d-5eaf169fe3dso247789e0c.3
for <netdev@vger.kernel.org>; Wed, 04 Nov 2026 07:32:50 -0800 (PST)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20260707; t=1793806370; x=1794411170; darn=vger.kernel.org;
h=content-transfer-encoding:content-type:mime-version:subject
:references:in-reply-to:message-id:cc:to:from:date:from:to:cc
:subject:date:message-id:reply-to:content-type;
bh=VSl8UTHuzcGlusp9eWKHTaKhrhlwdDdWaRoNG7GwWpE=;
b=KoffEYmtSTtqgY3zwfXbmYHgTOoBv+dyJ/ZeA088MydpOb9jS7rlPrYFM/CiwfZJSw
ul0qdToy8eDpq6plk1f0dGznO8XToih25glvtXW07nJiHOZqBNPAazRjcWeOn8Y0XeZf
dKbZ1LpvwLEDidgwNSvQ97gW3zoo/szcFcQif1+3/PNQcs+NKcyktvfzeUrKYALOHZgn
OWtIvK7lxuNJVWdUIs1zMRvZZdrE9JnLmcJwb8YpXsbiDSIGcgsbpczU9RJAlSBBMSCe
g/S7d5qiwIl1dEixRh2lDKzLflTC53jGwdLSjdwA1X6fAJyauPedSRDYAgBETNKe31zQ
RL/Q==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20260707; t=1793806370; x=1794411170;
h=content-transfer-encoding:content-type:mime-version:subject
:references:in-reply-to:message-id:cc:to:from:date:x-gm-gg
:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to
:content-type;
bh=VSl8UTHuzcGlusp9eWKHTaKhrhlwdDdWaRoNG7GwWpE=;
b=hbiZFCoIXh2OvSgx/aXMypEmtOFi8D4xARnIvTrdjyvx6AIfhuBUNRF4xPWhXvw3kw
KgXnU7fFliD9dUIdeSXMr3BvAfHKEKiDcOIWNxD37i99GXp1A3/EVzDEkjG6CA1+QJq3
qPucQgwKYKNUVpi2HFQLdvAVIZ5YgjoEsNT7HZ+6IX7Z6ka9jvEpMIdKsS9CP818V7rH
wLZ+eseBcojYDdDA3q0SLi6ZZxR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j+G5LVSYnD8/j7H/4jvVeQiuTmgH/OoY=
X-Received: by 2002:a05:6122:3a14:b0:5ea:e324:7c19 with SMTP id 71dfb90a1353d-5ec68528589mr6692053e0c.3.1793806369972;
Wed, 04 Nov 2026 07:32:49 -0800 (PST)
X-Received: from gmail.com (223.230.150.34.bc.googleusercontent.com. [34.150.230.223])
by smtp.gmail.com with ESMTPSA id 71dfb90a1353d-5eca89b81b3sm1906332e0c.2.2026.11.04.07.32.48
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Wed, 04 Nov 2026 07:32:48 -0800 (PST)
X-Cc: Eric Dumazet <edumazet@kernel.org>,
Simon Horman <horms@kernel.org>,
Willem de Bruijn <willemb@google.com>,
"Michael S. Tsirkin" <mst@redhat.com>,
Eugenio PΓ©rez <eperezma@redhat.com>,
Hassan Sultan <hassansultan@google.com>,
virtualization@lists.linux.dev
X-In-Reply-To: <20261104050131.629967-2-edumazet@kernel.org>
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