🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #6561

Re: [PATCH net 1/5] net/sched: act_vlan: reject short linear Ethernet headers after POP_ETH

#6561
From: Eric Dumazet
Date: Thu, 22 Oct 2026 17:57
99 lines
12729 bytes
Le jeu. 22 oct. 2026 à 18:01, Jamal Hadi Salim <jhs@mojatatu.com> a écrit :
>
> On Thu, Oct 22, 2026 at 11:21 AM Willem de Bruijn
> <willemdebruijn.kernel@gmail.com> wrote:
> >
> > Jamal Hadi Salim wrote:
> > > The issue:
> > > act_vlan POP_ETH can leave a linear area shorter than ETH_HLEN; a
> > > subsequent eth_type_trans() may then BUG in __skb_pull() when the frame
> > > is redirected to an Ethernet device.
> > >
> > > The Fix:
> > > Drop the packet at the producer boundary when skb_headlen() is shorter
> > > than ETH_HLEN after skb_eth_pop().
> > >
> > > Conditions to recreate the bug:
> > > - egress tc filter on lo: action vlan pop_eth.
> > > - AF_PACKET SOCK_RAW with PACKET_VNET_HDR, hdr_len=28, and a non-linear
> > >   eth / inner-eth frame.
> > > - The pop leaves skb_headlen(skb) < ETH_HLEN; a following
> > >   eth_type_trans() can BUG in __skb_pull().
> > >
> > > Fixes: 19fbcb36a39e ("net/sched: act_vlan: Add {POP,PUSH}_ETH actions")
> > > Reported-by: Vega <vega@nebusec.ai>
> > > Link: https://lore.kernel.org/r/40fe2d7dfce13411bfbe9271c0f7c54fb7e88e3b.1782548651.git.bronzed_45_vested@icloud.com/
> > > Cc: stable@vger.kernel.org
> > > Suggested-by: Jakub Kicinski <kuba@kernel.org>
> > > Reviewed-by: Victor Nogueira <victor@mojatatu.com>
> > > Signed-off-by: Jamal Hadi Salim <jhs@mojatatu.com>
> > > ---
> > >  net/sched/act_vlan.c | 2 ++
> > >  1 file changed, 2 insertions(+)
> > >
> > > diff --git a/net/sched/act_vlan.c b/net/sched/act_vlan.c
> > > index 6a375fdc63dd..ddf03b08bfe8 100644
> > > --- a/net/sched/act_vlan.c
> > > +++ b/net/sched/act_vlan.c
> > > @@ -79,6 +79,8 @@ TC_INDIRECT_SCOPE int tcf_vlan_act(struct sk_buff *skb,
> > >               err = skb_eth_pop(skb);
> > >               if (err)
> > >                       goto drop;
> > > +             if (unlikely(skb_headlen(skb) < ETH_HLEN))
> > > +                     goto drop;
> >
> > Could it try to pull the header and only drop if the packet is too short?
> >
>
> What would be the benefit?

Not dropping legitimate packets :)

skb_eth_pop() only guarantees the 14 bytes it removes were in the
linear part. Nothing guarantees anything after them, and many skbs
have exactly ETH_HLEN bytes in their linear part.

For instance, drivers using napi_gro_frags() (mlx4, sfc, gve, be2net,
cxgb4, ionic, ...) when GRO is disabled, or for protocols without a GRO
handler: napi_frags_skb() only pulls the Ethernet header.

After POP_ETH, skb_headlen(skb) is 0 for these packets.
They work today (for example POP_ETH then redirect to bareudp),
and this patch would silently drop them.

        err = skb_eth_pop(skb);
        if (err)
                goto drop;
        if (!pskb_may_pull(skb, ETH_HLEN))
                goto drop;

fixes the crash, and only drops packets shorter than ETH_HLEN after the
pop, which are not valid L3 packets anyway.

> Note: the OVS patches pull because they must restore
> MAC_PROTO_ETHERNET and already return an action error, i see a good
> reason there.

The same reasoning applies here: the producer makes the packet
valid for the consumer, it should not punish valid packets.

Thanks.


> > >       case TCA_VLAN_ACT_PUSH_ETH:
> > >               err = skb_eth_push(skb, p->tcfv_push_dst, p->tcfv_push_src);
> > > --
> > > 2.43.0
> > >
> >
> >
Technical Details
Message-ID: <CAL4WiipJLzZ9ywOPaFHZ+wePTOuO+6+aaRCVXMHz+xmmQm2hcA@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-350740-linux-kernel-netdev=dewy.ru
References: <ACT-N6N4.v1.r0.20261022051412@mojatatu.com> <ACT-N6N4.v1.r0.20261022051412-1@mojatatu.com> <willemdebruijn.kernel.38722ee638a21@gmail.com> <CAM0EoMnJhXQPxfU65oLYvpc-a6MhZSKi-D664fTMLah_6p7G2Q@mail.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-350740-linux-kernel-netdev=dewy.ru
From: edumazet@kernel.org (Eric Dumazet)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net 1/5] net/sched: act_vlan: reject short linear Ethernet
 headers after POP_ETH
Date: Thu, 22 Oct 2026 19:57:11 +0200
Organization: Usenet Network
Message-ID: <CAL4WiipJLzZ9ywOPaFHZ+wePTOuO+6+aaRCVXMHz+xmmQm2hcA@mail.gmail.com>
References: <ACT-N6N4.v1.r0.20261022051412@mojatatu.com> <ACT-N6N4.v1.r0.20261022051412-1@mojatatu.com>
 <willemdebruijn.kernel.38722ee638a21@gmail.com> <CAM0EoMnJhXQPxfU65oLYvpc-a6MhZSKi-D664fTMLah_6p7G2Q@mail.gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Injection-Info: usenet.network;
	logging-data="284521"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:y8uC882khT+kvgj8a77ZYbZHPvg= sha256:7Ql/jLvqgKU4hAsrv7Sw9Flndv3RHs6x7cNVwYMqndQ=
	sha1:lJL1nq3NWiHZbHu4ObzwccAmb6U= sha256:vQpOFYBY7K7XTvSMtm3izQd4ifUNvPdFMohCjtAipp8=
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 7AA1411132B; Thu, 22 Oct 2026 20:59:13 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.739
X-Spam-Status: No, score=-3.739 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.339, 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 SC3sDO98UuI6;
	Thu, 22 Oct 2026 20:59:08 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-350740-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 4BC7D11128A; Thu, 22 Oct 2026 20:59:00 +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 259C234B59; Thu, 22 Oct 2026 17:57:31 +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=1792691847;
	b=5N1tJ9vYeENrY3ZDAcxhY6m4V+HPps0FTIaCwQ/kCIZMpZ+bQHg9m5G5/J3mMeTzGr7D
	 Xrg2zmZlTEbue0lYtSB3fbypq7kZ/Vxz4bielLggZ6SiZOvHl+7FpbzJf8d8AQ8OUPsR7
	 T9DYE/tVhtzP+nmqwRj0FsGhdfozZhlWMqgK3gyc5OEpO1ZBxVCiPBe1Bxz7HCoean6ah
	 rs3WLyjQHaqgxvf4GvfESN6zgQxHtlWrrCNoz/pEYqHLUhNTouPAXC82QRXLcmddtozlY
	 ZHEA39SvcSvLl2ngDJ61onpYXtmXXDgIwZe3E8e3IjMV7ioUNAitIsLdLVJyURHJ3DA==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1792691847;
	h=X-Original-To:Received:Received:DKIM-Signature:Received:
	 X-Forwarded-Encrypted: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=kezdcC+FSW+yMTp2Da1WjecVlmYgqS8wNI64QyxYIRY=;
	b=POHca9Q6YnXe816aZ686XyWwOB8Oyx0rBkOGWvAQQE6FGww0Fud3pXIUK92hiqF6vCwk
	 j3/e0gi8Opmf/KQ0jOc9jxrveGes9Ht2X4zGV7kq1Hn6mm3sQORlRH4FrcfTrzpHsVv3x
	 /h3f2erPO9rd80MRZjCf0eQd/z7+i6ZtS7LSaPBfPGxRFqUHY7pe8JphhQydGnSRAv5W6
	 FDjy5V9yvofkdIXR181ar5mF33Jn9U60srHlqi9GMkYcFZe6LwAlyD1u7marUlAcIALCG
	 /Bv6uFaTbip4MkEOfsHYKXS+VN2CwkVujs415FY4mQBRcfqi6ffMiSe9zwu1toUbwvA==
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=HWlmzYsX;
	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 14DF6606A332;
	Thu, 22 Oct 2026 17:57:27 +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=HWlmzYsX
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=1792691846;
	b=BVCOrqQF3vbtPWYTcWONi3afSv86mx5XtwLDx6uEgBxqqyGL7F7Chs2BRlNaC/PqzYDe
	 sV1dmPawaKF8SXtlllKMgTknoMWFdl3s0PCyyRm3QaqDe/xoaDbAwHKdvkt2WXLLolq+7
	 di3qfIdl8DetiWuEryF7/gZ+F041Nsipdd6LzpN3W31aXG88MeiJAFAcPVwemcsTrj5KS
	 cKdSjPCyj4iFUjgcVsetVoj7T88sqmCjC8f17uaxAFzDnVJF5JNf8rLOBkkOjynnRIhff
	 14HXmIGMyjg/bt2fufnbfgunm7tSFqu03fHzUej6lGzSMBF3mrMNGeXxQbPfpuviJNg==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1792691846;
	h=Received:DKIM-Signature:Received:X-Forwarded-Encrypted:
	 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=kezdcC+FSW+yMTp2Da1WjecVlmYgqS8wNI64QyxYIRY=;
	b=XMyLKdsg5RlRaZAGk/d0mP9Q4EibvMROTseCbzfdUV8QCPDREYWUsUB+lWmWOmMo6589
	 cFa1LREo6zI0b0fLO8PEe6NnSc/SzB2Q7iP4zsGHQcf9NaT9F7OYzj8vwFOcc7D2kbSb3
	 k/e7KXUTpUm5GEHyXYNovkB0h/qEh5dep2lPSVFKvyAGl4TBZINE9etQz5zMwm3j1bjZI
	 odjqegc7of6DCXS4ow1WNfBfWXEQAy8XlJqxm7BcSi1XiIRlZ6iqDJou6JbgPuADlsUQO
	 FbQsyMMtF2BrqK3BTmnmfzxtydq+o1ozRDMvi84lBQ3eiEfVs5eBvV5DAaS8Jp6AEdA==
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=HWlmzYsX;
	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 E5E5A606A329
	for <netdev@vger.kernel.org>; Thu, 22 Oct 2026 17:57:25 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id C43351F031EC
	for <netdev@vger.kernel.org>; Thu, 22 Oct 2026 17:57:25 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1792691845;
	bh=kezdcC+FSW+yMTp2Da1WjecVlmYgqS8wNI64QyxYIRY=;
	h=References:In-Reply-To:From:Date:Subject:To:Cc;
	b=HWlmzYsXxtxFtXk59tbpJnlVi3Eo1x2LZYpEPB5xOjM44lj0VIPkxNqY3mfAtC1Tg
	 JqOisUCzOtZjx6jXvt+i6UPUyvl5/1PpDGRC6cjN3xya5ldpydkEXENdJKNohA6Ul/
	 UMj5x/8eqAOSget0AqX81RuSYWwwcWDu9JqMhKM6v90IWTxydHppNNnP+R+XZwn13K
	 Zq0nlBzVaaNkZfAKDcLCmQHmq71F4UxKDT1xzdPhul4cFpNT3ZTTjSKaTmlOUTRM+l
	 XIu7aYU08FZMJD1RAxXyF8Gu3XISUDcAW75SdNLbaPINRZYtR9JxC8hhAHFlYvFRr3
	 pQjlIxXBhxuNA==
X-Received: by mail-lj1-f173.google.com with SMTP id 38308e7fff4ca-3ab30b3212aso20329211fa.0
        for <netdev@vger.kernel.org>; Thu, 22 Oct 2026 10:57:25 -0700 (PDT)
X-Forwarded-Encrypted: i=1; AKwUvBx68qebg3sHkGIbaj49QFdu815eYFCN+0kurRrwcuiqh4FEO5w1eleEafDDOiqme11L0oFxw+g=@vger.kernel.org
X-Gm-Message-State: AFq9FYJoyuH1c0hfXI9oZkiJbwg2yZmTEhkmfIBVo0jVspXLyHyyOcZq
	ayNVw4cZ1g/LBy5sO7rRGwcGyLGnfmdRY8paTscOPWmr20rTmc5P2IeCuFtNwsCoebakZsRB2Wq
	45kEasV/4e8OJqbPbS1SXJvdzoEn9ZKs=
X-Received: by 2002:a05:651c:c019:20b0:3ac:433c:6ac6 with SMTP id
 38308e7fff4ca-3ac440a79cdmr13633081fa.3.1792691844526; Thu, 22 Oct 2026
 10:57:24 -0700 (PDT)
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: <CAM0EoMnJhXQPxfU65oLYvpc-a6MhZSKi-D664fTMLah_6p7G2Q@mail.gmail.com>
X-Gmail-Original-Message-ID: <CAL4WiipJLzZ9ywOPaFHZ+wePTOuO+6+aaRCVXMHz+xmmQm2hcA@mail.gmail.com>
X-Gm-Features: AclHuK_nqha3vOjEUCmurV-VfrxxzUbueW59pQsZ8XZJ_XYH3Bsub5nUKrzWM3M
X-Cc: Willem de Bruijn <willemdebruijn.kernel@gmail.com>, netdev@vger.kernel.org, 
	Jiri Pirko <jiri@resnulli.us>, Andrew Lunn <andrew+netdev@lunn.ch>, 
	"David S . Miller" <davem@davemloft.net>, Guillaume Nault <gnault@redhat.com>, Simon Horman <horms@kernel.org>, 
	Paolo Abeni <pabeni@redhat.com>, Jakub Kicinski <kuba@kernel.org>, 
	Victor Nogueira <victor@mojatatu.com>, Vega <vega@nebusec.ai>, Ren Wei <n05ec@lzu.edu.cn>, 
	Herbert Xu <herbert@gondor.apana.org.au>, Jason Wang <jasowangio@gmail.com>, 
	stable@vger.kernel.org