Article View: linux.kernel.netdev
Article #11983Re: [PATCH net v3 2/8] net: virtio: do not use dev->type to find the outer L3 header
From: Willem de Bruijn
Date: Fri, 06 Nov 2026 04:18
Date: Fri, 06 Nov 2026 04:18
42 lines
13198 bytes
13198 bytes
Eric Dumazet wrote:
> virtio_net_l3_start() decides from skb->dev->type whether the frame
> starts with an Ethernet header. tun decides it from the IFF_TAP and
> IFF_TUN flags, and TUNSETLINK can set the type of a down tun device
> to any value, without changing the flags.
>
> On an IFF_TAP device set to ARPHRD_NONE, the outer protocol checks
> look at the IP header at the network header (ETH_HLEN), and never read
> the Ethernet header. eth_type_trans() then sets skb->protocol from an
> unchecked h_proto, for instance ETH_P_NSH, and the packet can reach
> the skb_under_panic() addressed by the previous patch.
>
> On an IFF_TUN device set to ARPHRD_ETHER, the checks validate an
> Ethernet header that tun then treats as the start of the L3 header.
>
> Checking in tun that the device type matches the framing is not
> enough: the type is read again later, and a concurrent TUNSETLINK can
> change it in between, since tun_get_user() only drops packets of a
> down device after these checks.
>
> Add a has_eth argument to virtio_net_hdr_tnl_to_skb(), passed down to
> virtio_net_l3_start(), so the device type is no longer used:
>
> - virtio_net always receives Ethernet frames.
> - tun_get_user() passes whether the device is IFF_TAP.
> - tun_xdp_one() always calls eth_type_trans() on its frames.
>
> Fixes: 288f30435132 ("tun: enable gso over UDP tunnel support.")
> Reported-by: Sashiko <sashiko-bot@kernel.org>
> Closes: https://lore.kernel.org/netdev/sashiko-outbox-198573@kernel.org/
> Link: https://lore.kernel.org/netdev/179387332014.488856.9111956413610107951@kernel.org/
> Signed-off-by: Eric Dumazet <edumazet@kernel.org>
Reviewed-by: Willem de Bruijn <willemb@google.com>
Makes sense, and easier to review stand-alone.
But if having to respin, squash into 1/8?
Also, to avoid having to respin too often could (now that they're
public and archived) leave the self-tests for a later series.
Technical Details
Message-ID:
<willemdebruijn.kernel.2494b56c7bdc2@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-357729-linux-kernel-netdev=dewy.ruReferences:
<20261105115715.1466924-1-edumazet@kernel.org> <20261105115715.1466924-3-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-357729-linux-kernel-netdev=dewy.ru
From: willemdebruijn.kernel@gmail.com (Willem de Bruijn)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net v3 2/8] net: virtio: do not use dev->type to find the
outer L3 header
Date: Thu, 05 Nov 2026 23:18:47 -0500
Organization: Usenet Network
Message-ID: <willemdebruijn.kernel.2494b56c7bdc2@gmail.com>
References: <20261105115715.1466924-1-edumazet@kernel.org>
<20261105115715.1466924-3-edumazet@kernel.org>
MIME-Version: 1.0
Content-Type: text/plain;
charset=utf-8
Content-Transfer-Encoding: 7bit
Injection-Info: usenet.network;
logging-data="3791195"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:uxujERtnw0O/U8A7z6AEheDrRo8= sha256:J49baOR45lvcrj76m3jnM5tUeQMdkxu3z7Nxv35nOac=
sha1:jtTw6fxA2PGZOARIXN5NgfNMBiY= sha256:9JDNTlRlhuXSVmapSWydXIChnA4lBzMA8I6GV+fcS2I=
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 5738411314C; Fri, 6 Nov 2026 07:19:16 +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 xdrRU7j5Mov2;
Fri, 6 Nov 2026 07:19:12 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-357729-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 sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
by mail.dewy.ru (Postfix) with ESMTPS id 4B5FF112E19; Fri, 6 Nov 2026 07:19:01 +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 D4DAD29067; Fri, 6 Nov 2026 04:18:51 +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=1793938731;
b=Vjw0Q99N7AyfXqtHoVLZE3a7YxfQQ7qwHBh5FHWiz4f2KIYYbTuYbhLUzBFFpUCCTREE
nfbq3ZPXCoahNhnP3TLCV4d1DvGwvP2XaScuu9XOyVh53Cra3bybr58PNU0MwhvR6g9/S
FPfkzESPA9M1DNtaxiNGzGqlNov19ZTXFIPSWuT2QVcXqXEZG6UX1BNwuLYv6IiCUFuGr
Frkqf1Q8z1NXOg3F8qCfWgdKE2SLMMCWMtJr8t0KqK40ON7ja3jMwoe4Bq/MXfEN/iaTi
YgNUk3286EcA+EJ4FsZD0rhhlm9Yu3yRmhP7fE/UYA6nQzG86kwXMO1sOnzjrtj57cA==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1793938731;
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=qkRXBwd9VuNyjRdV31nMFJ+5eNrq3IUMvPVOYqoi14Q=;
b=quo8cTBNOZEFQ5qv+9aUGsKJh4Ajd9KsGSvLMOC2/Pv7NA7ZTrcpMi8Ym1VVk2zIxdwo
NzVbz+4ld/1WTOEddTnRnu4MazX3lKjvz9stVSEgtovVpBsK6klp9f9+Td534zdZHtlaH
NL9Lo7ZGHYUEsR2McICM1T6iKD8gwzpEAsTo32AzVBU20oGFDVJzKscgqFz7qnkah61wU
364wHbAnJJF7VoI0F+npZY6OiiGikEpPLXqS6ckihdHwYrVA/B/Q2uhSyPhertiGuf3r9
TLLrZq7ld3CX/Bio7j5M67oxsnGYb9Bh+kyZ0S1sVVfxArKMLr5Tbp/Xt5m/vk1Bkhw==
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=V90FeVQk;
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 A9BD4606A329;
Fri, 6 Nov 2026 04:18:51 +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=V90FeVQk
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.221.176
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
t=1793938730;
b=txE7UnvSQLe/Qm3NxzNEYsAYknwL+MTvJw40tx/kDcP1BRQLIv+WgT3CAd1VwAA/A114
yzbTxX1lj+IpqkmTe4d/hvJo1Fv9NfHZWM/ZbswPVfuDVY+OB5JL/1QoKqKh+85bnV8Nj
coRZKSpvgY5QvH/nqIVR+LzldTxkedXfVmtL0qkk8QWa02chT3aV/Xawe3+KUiDgLCy1A
s0H9S0HpdQUsQKz7qtbgzxSoq+9c0wtz3CeDZDsKCQtthCjp1ncNl+gAvlxahnX1a5Wbz
RR+Z3I9nCxCLAwc+07wEjMjYupomTg5uGc4W8GAr5wxCk7JmXpp1/CJasUGSfoKx73Q==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1793938730;
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=qkRXBwd9VuNyjRdV31nMFJ+5eNrq3IUMvPVOYqoi14Q=;
b=gMepD1eFEKsSFCHYHjty9z6yode102RET6+IhLKbizD0rbRBR6T927fzRWYi0jS4T2hS
iLmNDbFZasVM9T5bPpL7W2o3/75IYZ7y1c+ZGR8VVHLlLeFj8xIA7gichi7hfG3LLCGkR
cSXlKPjmKcz2o/eKl9v0nRWF++6VewWScJ93rHL3k+KyNYCFE3NaDllOXpsb9GtABZQeJ
cmvKqpHDU+xyS3wH5GKd/lL1WTA3eVq6FjtDO6/V66z3LjsGsVD9bj+5VOkmxHMCAbqTR
uL5Pg05EHW3mPTyis9x/e99cZURVMycr5L6KebbuiYVC6fMy1HN/ifGhCvVsAHvMomQ==
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=V90FeVQk;
arc=none smtp.remote-ip=209.85.221.176
X-Received: from mail-vk1-f176.google.com (mail-vk1-f176.google.com [209.85.221.176])
(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 BCF6A606A328
for <netdev@vger.kernel.org>; Fri, 6 Nov 2026 04:18:49 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org BCF6A606A328
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-f176.google.com with SMTP id 71dfb90a1353d-5eaa5e03c47so1283302e0c.0
for <netdev@vger.kernel.org>; Thu, 05 Nov 2026 20:18:49 -0800 (PST)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20260707; t=1793938729; x=1794543529; 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=qkRXBwd9VuNyjRdV31nMFJ+5eNrq3IUMvPVOYqoi14Q=;
b=V90FeVQkMj2BLV4zQCiILHXjn/g8I/gaWkVwa1xE6z95gmA3+otHlguHrKYyYK3e+h
iGm0un6Mt3sySEkdsHg2tE4O+kow5pqBZ2jxrtesOMyzJFhFMVXJ66XPLEG0l1jktTHU
jTqNxXVhmQiVWDLk/VEAe0QucuyFVY1BWFCP8c7ZI6Dd7YgAMuiM9OgdWkuJaIzSt1+5
X4Z+UZGRGMDj7HD94zLvOltmUuADE8cU5Pz5UdRQzGy4jc2cubC5hSS4BzZT4Y97yomx
zEpB19L9lZlBkRPyRQiNZyGXUIpTEYeO3OeoAQ6LaFprsfRHn1Jsyoa3CVJksKc9jKtJ
RzVw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20260707; t=1793938729; x=1794543529;
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=qkRXBwd9VuNyjRdV31nMFJ+5eNrq3IUMvPVOYqoi14Q=;
b=uSvsZ4crqx+dVOeF5oUIoy6Vs/aF+SkxCk9A2SsNz+HG3bMmlhOzC0lfx7mu2Gksus
LDGt+hQLvCEPxSV5lGjeh10E8QUHPVAyVPFDdtDVwtnLIS1dEZzHylRFXzvQ+BmYptST
PhNk6OhnLgzproedDVX3SOFnhfQipWgiTdEb++bKLlQZb7zcjxcErVIU5sddWpXWrypg
2eP6qdG+yS2k2kTZ/srYyWlwLPYrFaG9U7q1hAK0rCIrd+umKFFopInS0j/CLWMPD1nx
fY9GKCJsN04RromNlhhFssl0aGTxX5PeomJ/px48gzGxvWGwkoTLjUZnBPUcOBTjcc5s
Te0w==
X-Forwarded-Encrypted: i=1; AKwUvBxCg24FPr8d7uGvPXehgjb/E7gwPu7KTif4rOMhBvTAiGSBxLBVxmtcJWgebpk6ttrTdriKtT0=@vger.kernel.org
X-Gm-Message-State: APuU4Z/A2EV+I7KNzhPFbmhgiP2GoXdy+PfcS4WlKWMTbpY8/9AwpWSy
vncOpo1tPXMOXoYyYHJjSAM55nxs1pJhB4PtpHrTaUu5KQtzHEesaLwO
X-Gm-Gg: AYBFou35hw1JjDCkDBdBqZ4MVhpqQA5or1llq7LSYGN+0G9we6hgBFE7XrGFQz+Sah0
KqMewjesbB/8Lp42h3BSSg0QciV/NjZfI6T2Y7AXf8DYs4gcVOwuPAixBgKuFz56rYR7I8QBd3K
NXhw6uM+R+ABI7k+xImSvuGwYClevMmqJrkkhvHWMg03YNGnc8rE/TNMi6FOmL4wgpyRwXgEWSi
wLwD0r8I034Ad8Djgg0utpQTtf3YXD1ZtzuvYGnVPnExXAthe2g7r0QSK65fjUCfuF6k+t3wSb/
2rs/KOek8cdiFigVFsS82DDk5VL8wsnxkeqOhyLpbg2p+hboGgjMP/6iWBmlkRVXCtGmcF7cvLK
Al2nep08kA92AiagylEu3RAq+bwvTWOlrIvVluW13/P/pTEWnEkGYrPit+xbKsM2wOG6RgusQJM
QDJWDIJszWs1d4C43gnMY0auNk286JFb4sUW8R3aNUccwvEBRsQYejn2XmYlYotfmnZY1FFBcpi
9IxoDYueCHWPlSl9rCGNm4C1sUtL6435qGz3LOCUsF7gQipbA45NvT6BCmPdY8s0b+5EvDxd2w8
c+XLlYvMu4LriZvd/w60aq3z2tyjTmxgFvTdbCHIVLyrb+LvYfS78pVd0BEbRtP3WAMYuXvhBwh
w/I5dpcdLm3f++R4+lKXnRhtOPd1RQ1y6KbBpKuAZSnySFeyhswvWjK1xJRESntDLazOqFmLSm1
DENhwTVvt2RostzAVN
X-Received: by 2002:a05:6102:9d7:b0:7c3:874d:60bb with SMTP id ada2fe7eead31-7d2a14b652amr651881137.5.1793938728631;
Thu, 05 Nov 2026 20:18:48 -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 ada2fe7eead31-7d2a8b52ca9sm427837137.9.2026.11.05.20.18.47
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Thu, 05 Nov 2026 20:18: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>,
Jason Wang <jasowangio@gmail.com>,
Eugenio PΓ©rez <eperezma@redhat.com>,
Hassan Sultan <hassansultan@google.com>,
virtualization@lists.linux.dev
X-In-Reply-To: <20261105115715.1466924-3-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