Article View: linux.kernel.netdev
Article #12087Re: [PATCH net v3 2/8] net: virtio: do not use dev->type to find the outer L3 header
From: Eric Dumazet
Date: Fri, 06 Nov 2026 08:48
Date: Fri, 06 Nov 2026 08:48
53 lines
11261 bytes
11261 bytes
Le ven. 6 nov. 2026 à 05:18, Willem de Bruijn
<willemdebruijn.kernel@gmail.com> a écrit :
>
> 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.
Thanks Willem, v4 does both: this patch is squashed into the first
one, and the selftests are dropped from the series. I will send them
separately, with the fixes Sashiko found in patches 7 and 8.
pw-bot: cr
Technical Details
Message-ID:
<CAL4Wiiqoa7+=0vxHuG8p497O3yU9hJvXV+F1zpOSOiRMG9-j6w@mail.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-357849-linux-kernel-netdev=dewy.ruReferences:
<20261105115715.1466924-1-edumazet@kernel.org> <20261105115715.1466924-3-edumazet@kernel.org> <willemdebruijn.kernel.2494b56c7bdc2@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-357849-linux-kernel-netdev=dewy.ru
From: edumazet@kernel.org (Eric Dumazet)
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: Fri, 6 Nov 2026 09:48:23 +0100
Organization: Usenet Network
Message-ID: <CAL4Wiiqoa7+=0vxHuG8p497O3yU9hJvXV+F1zpOSOiRMG9-j6w@mail.gmail.com>
References: <20261105115715.1466924-1-edumazet@kernel.org> <20261105115715.1466924-3-edumazet@kernel.org>
<willemdebruijn.kernel.2494b56c7bdc2@gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Injection-Info: usenet.network;
logging-data="3831235"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:2Z+3Ctn99fQ/KUT7xBuqt3kQbJs= sha256:fVi2QMuryJuZEe0zSFquSh3fCh47fcIjeNZC2dodySE=
sha1:bTQTBhm5cafErIbM8TT/tSxleAk= sha256:PCTgWF5jgxgRY/5k8roP4Xl6qJmOnZ69A477fpG4kjg=
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 85A441131C1; Fri, 6 Nov 2026 11:52:52 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.501
X-Spam-Status: No, score=-3.501 tagged_above=-9999 required=6.31
tests=[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 3ZsWSMORxn7d;
Fri, 6 Nov 2026 11:52: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-357849-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 sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
by mail.dewy.ru (Postfix) with ESMTPS id DDD451131AE; Fri, 6 Nov 2026 11:52:32 +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 357592AB57; Fri, 6 Nov 2026 08:48:37 +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=1793954917;
b=3x7rdt5YAlUlVP4Q5YK5xnXp/sQj9Pcekeuj94ccFBenggkaE6z3dkaf0xDTpnDbaUn1
cD/+l7dl7BVUybMC7DrwBBSaFvasPxyFI0FNElc8rj7PxZqpcrk73AkMwh1P0jfLsFarQ
uf3Gpyr3EOY8o+EpHXSgEL7NMolWfBVMTjmpU96kGJFmmzzFBY9D8sg7pkOgIt6xKgZnd
k1JeaGa6JwShGp2qyigW4neqHCmruutvk8uQlAX8R1fOT4R7yqCbmwORCAIM0D8hA7rc+
8QXxmCMw1V9i9McBHlqpACnWE3Ei9kfe7hUgzEKOV7wi94m+qnsq5rktNL4IeKoMQwA==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1793954917;
h=X-Original-To:Received:Received:DKIM-Signature:Received:
X-Gm-Message-State:X-Received:X-Mailing-List:List-Id:List-Post:
List-Help:List-Subscribe:List-Unsubscribe:List-Owner:Precedence:
MIME-Version:References:In-Reply-To:From:Date:
X-Gmail-Original-Message-ID:X-Gm-Features:Message-ID:Subject:To:Cc:
Content-Type:Content-Transfer-Encoding;
bh=QPSWzvYvVt1otuhEA/nRLFOiH4lZX6RTdmU2sAZbE2A=;
b=uOjrcX2RuouefBWhmdqZuJ7ckcI3uUJpD9sbPN5accntNgenTEUPBBc9bb6WhT1pj8bc
X5uL9iTA4BcM+KNwqfufYh7Lci2p6vpEr2oPNUZIkPtvz3novRgTnRA+JGyGjW8LnFn5q
WhP5oH9r1i1enhIj+x+ovwstFkmnQH6xJSht493PQq2W7Np70oruJI4jY89AhyNlQLtCg
XK14ugHhc0n/ggkWTEVETx8Uc09jBwqTn2kmRYXSE56OH3k5Ij282iy8EPrrXz9AF73cC
S54tudrbGYFMjC15XOg4Aba/wu66A6tJTD1Evk9NrI80CKkOkGe/SSdvMuWDxDfu2/A==
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="XmQ1kK/S";
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 0D61E606A333;
Fri, 6 Nov 2026 08:48:37 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=XmQ1kK/S
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=1793954916;
b=VRY7QA1O6cdqOD7x7yZSiY4+DTF7SyxJF3CsKg8CL6eCxIcD+iqRwY/8fMHFq9D1Jmzj
iSk2X8drQHk2kpfDUIbq5TRE1kMLImLS7sXJQ3A5WLh8oO98E5aIaYGYIw4hKiwjn3tVp
+cfy/f77IIPYormGhSdWji70zbCS1jllCBPinDzQFDUoygP2tinJnwEq/X89buZXA9mof
0n3qDICXYqVT1gA1aCW9ZXGzoCYrHmDUJzk2aoNxdX4DiLbxYJ8AF498hLWFy6n1RgWS0
ZgD/I43Fn6Pj/STluML0RaL1sy7aFlvAsciai1fhV5nny3heaV9oyYF5l5AjHEbf/8A==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1793954916;
h=Received:DKIM-Signature:Received:X-Gm-Message-State:X-Received:
MIME-Version:References:In-Reply-To:From:Date:
X-Gmail-Original-Message-ID:X-Gm-Features:Message-ID:Subject:To:Cc:
Content-Type:Content-Transfer-Encoding;
bh=QPSWzvYvVt1otuhEA/nRLFOiH4lZX6RTdmU2sAZbE2A=;
b=f8jWX/I3mmphcJBgKrnjzDHxxVCYn+c3dbmxORrUjpLZxPdNdhx1893fOJoVhotxu72F
pjWG9iI4CuZQ8nN5UFzsktjWEholCKKB23Dg/+fvAShF++R5NtaO8na5UqjOQLgif/CHf
qIvIDK3gS0KM+tD0qjOFOPS6V/lKOX+V4zgrL1bXeceX1ls2xnGThySPoQffALAFu8KoZ
/T7kz4lVU45/jVj2sbTmxZcxf8y2SD7g+MsSwSPtz6uXRBh+0uGI7dWAYIDM8yj0F8Whe
d2cAXjxsPLHmse6xP1fcJxilxK+4UcFDzT3ndcwiBDJL3wSwGgVX5LqMRqXwYAmy1PQ==
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="XmQ1kK/S";
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 E423C606A328
for <netdev@vger.kernel.org>; Fri, 6 Nov 2026 08:48:35 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 87FA71F008A5
for <netdev@vger.kernel.org>; Fri, 6 Nov 2026 08:48:35 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
s=k20260515; t=1793954915;
bh=QPSWzvYvVt1otuhEA/nRLFOiH4lZX6RTdmU2sAZbE2A=;
h=References:In-Reply-To:From:Date:Subject:To:Cc;
b=XmQ1kK/S++uQRzPT8eUgxF8quhZhWr+S+11Hf0A1VS0vj+4Np6Jwd3fbMLMkcW8sA
DfOKGYeUMJs0hkWvWWP9RbFosgiUfI7NXv33Q/d+nzgVob57itUjKjsYMYA1NXrgob
dxUQGn4AYXZHyV2CwBCXbe54s7oMXGhxsgq9N0ZSkkDSxnirRAlx5PoTW0E0j4ZPcB
+MIwpE7p7TUo336o+mn67JN6e3SEw2lIVP88uKgROdK99E8g19xWH0QtnMK1UdYitQ
iDbXerf5IF+zea39WOY3FFXRQx8mBXifpm9TX8d4wXZnPxnBH6UwZbAsS5dnnL5Tan
LZWWdx6LAFnfw==
X-Received: by mail-oa1-f47.google.com with SMTP id 586e51a60fabf-48e9476e26aso96322fac.3
for <netdev@vger.kernel.org>; Fri, 06 Nov 2026 00:48:35 -0800 (PST)
X-Gm-Message-State: APuU4Z+GqNtKq7cQZzsI/ZXt4aZWS9Hclai3Yq9Jz32VKWFlCPtw8DlJ
+98X0brbb2fZqLbj2vOFns/IIW87sSkCcWwn4R/GJtiF3+lieX2XVbOV81TGH/F3cvWfaeuA6eY
EFbd9I2zT2fBeDj1uMLihboMHVJvR1d4=
X-Received: by 2002:a05:6870:8327:b0:48f:e24e:6b6a with SMTP id
586e51a60fabf-4ad9914e161mr1171313fac.61.1793954914699; Fri, 06 Nov 2026
00:48:34 -0800 (PST)
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
X-In-Reply-To: <willemdebruijn.kernel.2494b56c7bdc2@gmail.com>
X-Gmail-Original-Message-ID: <CAL4Wiiqoa7+=0vxHuG8p497O3yU9hJvXV+F1zpOSOiRMG9-j6w@mail.gmail.com>
X-Gm-Features: AclHuK8VZB_QmyiYw9SabnBbcPNtk4vy7WYuuy3H9l5V4RQHRVJOYmWAQ5YIbSs
X-Cc: netdev@vger.kernel.org, "David S. Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>, 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