Article View: linux.kernel.netdev
Article #18977Re: [PATCH net v2 1/2] netfilter: nfnetlink_queue: only adjust bridged skbs that have a mac header
From: netdev-bot+sashiko
Date: Thu, 19 Nov 2026 06:00
Date: Thu, 19 Nov 2026 06:00
123 lines
12943 bytes
12943 bytes
Thank you for your contribution! Sashiko AI review found 2 potential
issue(s) to consider.
Critical: 0 · High: 1 · Medium: 0 · Low: 1
If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).
- [High] The series leaves an out-of-bounds read in nf_send_reset() and
nf_send_reset6().
- [Low] The commit message and tags present this as a standalone fix for
a live KASAN slab-out-of-bounds bug, with `Fixes: a5fedd43d5f6` and…
--
netfilter: nfnetlink_queue: only adjust bridged skbs that have a mac header
This patch makes nf_bridge_adjust_skb_data() and
nf_bridge_adjust_segmented_data() skip the push/pull of
skb_mac_header_len() bytes when the skb has no mac header set. It is
groundwork for the next patch in the series, which unsets the mac header
of a pskb copy that points into headroom.
> Fixes: a5fedd43d5f6 ("netfilter: move skb_gso_segment into nfnetlink_queue module")
> Cc: stable@vger.kernel.org
[Severity: Low]
Is this Fixes tag accurate for this patch on its own? The commit message
says the trigger only shows up once the next patch is applied:
> A pskb copy of a bridged packet, such as one made by nft dup,
> keeps that info, and the next patch unsets its mac header.
Before that patch, a pskb copy keeps the original mac_header offset. So
skb_mac_header_was_set() is true and skb_mac_header_len() does not
underflow in nf_bridge_adjust_skb_data().
The next patch ("net: unset the mac header of a pskb copy that points into
headroom") has Fixes: 1da177e4c3f4 and no dependency note. A backport of
that patch alone would bring in the KASAN splat this patch prevents.
Could the commit message say this is a prerequisite for the following
patch? Or could the stable tag on the next patch list this one as a
dependency?
> diff --git a/net/netfilter/nfnetlink_queue.c b/net/netfilter/nfnetlink_queue.c
> index a8aa7ad832c3f..fafadd9057cf7 100644
> --- a/net/netfilter/nfnetlink_queue.c
> +++ b/net/netfilter/nfnetlink_queue.c
> @@ -1084,13 +1084,13 @@ nf_queue_entry_dup(struct nf_queue_entry *e)
> */
> static void nf_bridge_adjust_skb_data(struct sk_buff *skb)
> {
> - if (nf_bridge_info_get(skb))
> + if (nf_bridge_info_get(skb) && skb_mac_header_was_set(skb))
> __skb_push(skb, skb_mac_header_len(skb));
> }
>
> static void nf_bridge_adjust_segmented_data(struct sk_buff *skb)
> {
> - if (nf_bridge_info_get(skb))
> + if (nf_bridge_info_get(skb) && skb_mac_header_was_set(skb))
> __skb_pull(skb, skb_mac_header_len(skb));
> }
[Severity: High]
This patch only guards these two nfnetlink_queue helpers. Do other users
also trust the mac header whenever nf_bridge info is present?
nf_send_reset() in net/ipv4/netfilter/nf_reject_ipv4.c does this:
if (nf_bridge_info_exists(oldskb)) {
struct ethhdr *oeth = eth_hdr(oldskb);
...
if (dev_hard_header(nskb, nskb->dev, ntohs(nskb->protocol),
oeth->h_source, oeth->h_dest, nskb->len) < 0)
It never calls skb_mac_header_was_set(). nf_send_reset6() in
net/ipv6/netfilter/nf_reject_ipv6.c has the same code.
With the next patch applied, it looks like this path can be reached:
1. Bridged IPv4 or IPv6 traffic passes ip/ip6 PREROUTING or FORWARD
through br_netfilter. At that point skb->data is at the network header,
so skb_mac_offset() < 0.
2. A TEE or nft dup rule calls nf_dup_ipv4() or nf_dup_ipv6(), which call
pskb_copy(). Then __copy_skb_header()->__skb_ext_copy() keeps
SKB_EXT_BRIDGE_NF on the copy, and after the next patch the copy's
mac_header is 0xffff.
3. The copy goes through ip_local_out() or ip6_local_out() and the
LOCAL_OUT hook.
4. An OUTPUT rule "REJECT --reject-with tcp-reset" (or nft "reject with
tcp reset") matches the copy. nf_reject_ip_tcphdr_get() only checks
frag offset, protocol, RST and checksum, so the copy passes.
5. nf_bridge_info_exists() is true, so eth_hdr(oldskb) returns
skb->head + 65535.
dev_hard_header() then copies 12 bytes from that address into the RST's
Ethernet header. The RST goes out the physical input port.
Can this read past the buffer and send those kernel bytes onto the wire?
Before the series this path read uninitialized headroom inside the buffer.
With the series applied, it reads past the end of the buffer.
Would it be more robust to drop SKB_EXT_BRIDGE_NF from the copy in the
dup path? For example, call skb_ext_del(skb, SKB_EXT_BRIDGE_NF) after
pskb_copy() in nf_dup_ipv4() and nf_dup_ipv6().
The copy is a locally routed L3 packet, so its br_netfilter state has no
meaning there. That would cover every user and make the per-user guards
unnecessary. If not, nf_send_reset() and nf_send_reset6() would need the
same skb_mac_header_was_set() check.
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261117175835.745796-1-theodorlarionov%40gmail.com
Technical Details
Message-ID:
<179506802273.3136.14270280205910670302@kernel.org>Path:
mbox-mo1.pugleaf.net!news-lax.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-366755-linux-kernel-netdev=dewy.ruReferences:
<20261117175835.745796-2-theodorlarionov@gmail.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-366755-linux-kernel-netdev=dewy.ru From: netdev-bot+sashiko@kernel.org Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net v2 1/2] netfilter: nfnetlink_queue: only adjust bridged skbs that have a mac header Date: Thu, 19 Nov 2026 06:00:22 +0000 Organization: Usenet Network Message-ID: <179506802273.3136.14270280205910670302@kernel.org> References: <20261117175835.745796-2-theodorlarionov@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="2801851"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:bX085JSz0T+MrOPutkKnF9BtR9Q= sha256:aBN2m72oGkBW5Db5IfKJQWo1M1+ngVOv65dD2E9yJXg= sha1:Nl/uWhX7limogjWh62jAEilT9+8= sha256:sz0QYHy+AWaVZkG8WqrdpzBSJaAVcwYJCzd9VsMpids= 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 F2200115507; Thu, 19 Nov 2026 09:00:54 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.4 X-Spam-Status: No, score=-3.4 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, URIBL_BLOCKED=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 okNlNnMYlHxc; Thu, 19 Nov 2026 09:00:51 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-366755-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 2E7001154A3; Thu, 19 Nov 2026 09:00:43 +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 903CD223FB4; Thu, 19 Nov 2026 06:00: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=1795068025; b=T1jyPp/77CbPfT9dd6gtagq8ZYbnnc8e/1CN28Qv9CA8GPv8Dd5mPY4vn48F4GkxMyDk i6DwG6u4gAv2mv/VoT2h5Zpk4/x7eySB2CSj+HQB44rYWQwYPKrzMb2BOU7wzxj6Yot44 6m0fJgO3ue1nCacClw+qxPUkJy5nMFS24mTCTLe+lQ5wPMJ2CvC8D6jB1121ezeur9fvv xAFuTWL+bdf07b5R00hT+nOLSNnwffXrreLQ0YtG68aJIpzdkRi5P3nw/Pwp5I492iKgq xgxhGrDspkcdhvLDi1iNkQXGn9E+/MOrgZMHV7aYarGIG+GUpsWaVFaNzimcNYbdC8A== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795068025; h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc: Date:Message-ID:In-Reply-To:References:X-sashiko-severity: Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id: List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner: Precedence:MIME-Version; bh=+b8NBtiQLHCO40sC7F8rypcN15XfAiFGua5IsAt8Ejk=; b=2XQnQ2Ba58DJiYWdEuevb1BBXmViZqL5DRLIJWkmqPQLgGal4VS/NOglECrOI05Xi6PB LbGXTGKHfBHs9+mKcbe2Se3rMO/89jE8+hdarNVnxeK5O9LEVEd9EZztQLBEwUZzPL6G3 n/lQYB6dimIlwPz4A7S0dM7LB8gh+s6np3QAtgHUZOJEJEN6gExkc+r+0r+g3qxz//TNJ 1cfg6eu64a+DJ2jgJzB5/Gi9SuMQvYu9WZ8I4urNuPal5m2+JLUUC6GtUk4UF+3NXc+nd BEmhJm3STyuoRZiQX/BZ4omQGsVTVI7EKm2ey+AaAaf7IwEoj9PNxkHCNjO/18z52fg== 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=ULPBVKx7; 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 EE2EC60A2602; Thu, 19 Nov 2026 06:00:24 +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=ULPBVKx7 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=1795068024; b=hazdMg/dfh377hmGzNiES2EjdCzqNn2/ws6A5Rp9ry+uZhbWN9qg653saEHjQR1oefBO rT9ZzKVWxyyzGzmu2c/Ffgz1TLQMtUMbORExxnNOBNMp5cSqg51IL+Iijo/TpHFl3c4CR z7HKiaspuo+aPaPOH8Xbm3zDxEug/iIfGK563IjTbobm9AKdoPVSidujoOT0JhR+GOPtP 5qL9IY/Ukb55zPS/D0RcM0qVV7x2S1KlUhXyLR8rypTzDLzug1rMPhkdaqD/11UCJAWvG lrH87kwzdotZq0cAkBbRILJOIsticW0ipYx4q+zeByIe+VWv1PTUoTQOep9fC3jSYOQ== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795068024; h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID: In-Reply-To:References:X-sashiko-severity:Content-Type: Content-Transfer-Encoding:MIME-Version; bh=+b8NBtiQLHCO40sC7F8rypcN15XfAiFGua5IsAt8Ejk=; b=Uf5RdINJdGCZLNvXja9eICnvfKY/x1yVkNSmMoR9aRMwqIPfKun3HUr9tQAjHX0tA6NI PPO/k5pctZ2MAI7GyWjSmIbSd66UU3SM6ZCO+2WKnUoSk77MbUnIQ/KKLgtmhzI+OA+cy A8+81yZSh9uXdzc273gIUau86MFyhkFYrgw6KSRirNIXOUpO8s+OS1S1Ae7Xo4TlzGfeR 2NvOktL4eJljuu97GgV3/4uklgLKne/Ic3DhVmwa0ezAwi9VhVIPmlV25RbtYlEamsGev u6Av0Bx0Glc7Rlb/akUpNnwx7CmyUcDGiCExt9bNr+pRhJl/+kp1VRu2dlyBIrverkw== 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=ULPBVKx7; 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 17D88606A320; Thu, 19 Nov 2026 06:00:23 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2D1131F000C5; Thu, 19 Nov 2026 06:00:23 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1795068023; bh=+b8NBtiQLHCO40sC7F8rypcN15XfAiFGua5IsAt8Ejk=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=ULPBVKx7elAZHskhquoySjADN2or1tn7LWRegayd8Q27EjVOJlO/WXP3Bk+4TM8g/ K8ZSfghDQC20SDp5i/ANaoQ5bYwpYcYM2u4JWugvprcsJuEGYnM2HqBYpM3LWJWUUD ejPROgligt7WnsVMU1SGIAn0HvLUgSG/+gF+otBVMugu3epGC+zkJQroFXmC+bUjci 1ZdkXBx6Ex1mIVIOYfYAUyX3BfC6NYSlS4JZHB7c2XYqst3xh2kkV2DbvccgnMqiac Uv9oQhM9ww+dN2NgNG6oKCS7jNrYP+1erCrdEQOlW68b3OjeGJJUZlrayisXM0srZH nvTtk2t3XpAfw== X-Cc: davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com, horms@kernel.org, pablo@netfilter.org, fw@strlen.de, phil@nwl.cc, netdev@vger.kernel.org, netfilter-devel@vger.kernel.org, coreteam@netfilter.org X-In-Reply-To: <20261117175835.745796-2-theodorlarionov@gmail.com> X-sashiko-severity: High 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