netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: netdev-bot+sashiko@kernel.org
To: theodorlarionov@gmail.com
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
Subject: Re: [PATCH net v2 2/2] net: unset the mac header of a pskb copy that points into headroom
Date: Thu, 19 Nov 2026 06:00:23 +0000	[thread overview]
Message-ID: <179506802393.3136.3490105838474942994@kernel.org> (raw)
In-Reply-To: <20261117175835.745796-3-theodorlarionov@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.

Critical: 0 · High: 1 · Medium: 0 · Low: 0

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] net: out-of-bounds read in nf_send_reset() after
  __pskb_copy_fclone()

--

> diff --git a/net/core/skbuff.c b/net/core/skbuff.c
> --- a/net/core/skbuff.c
> +++ b/net/core/skbuff.c
> @@ -2278,6 +2278,8 @@ struct sk_buff *__pskb_copy_fclone(struct sk_buff *skb, int headroom,
>  	}
>  
>  	skb_copy_header(n, skb);
> +	if (skb_mac_header_was_set(n) && skb_mac_offset(n) < 0)
> +		skb_unset_mac_header(n);
>  out:
>  	return n;
>  }

[Severity: High]
Does this turn the uninitialised read into an out-of-bounds read for
bridged packets? The copy still carries SKB_EXT_BRIDGE_NF, because
skb_copy_header() -> __copy_skb_header() -> __skb_ext_copy() duplicates
the extensions. After this change, though, n->mac_header is ~0U.

nf_dup_ipv4() and nf_dup_ipv6() hand that copy to ip_local_out() and
ip6_local_out(), so it goes through NF_INET_LOCAL_OUT before any
link-layer header is pushed. Suppose a reject with tcp reset rule
matches there. nf_send_reset() and nf_send_reset6() only test
nf_bridge_info_exists(oldskb) before calling eth_hdr(oldskb). They then
pass oeth->h_source and oeth->h_dest to dev_hard_header().

With the mac header unset, that trips the DEBUG_NET_WARN_ON_ONCE() in
skb_mac_header(). It then reads 12 bytes at oldskb->head + 0xffff,
well past the end of the head buffer. Those bytes end up in the
Ethernet header of the RST sent out the bridge port, or the access
faults if the address is unmapped.

Before this patch the same path read uninitialised headroom inside the
buffer, which is the leak being fixed here. So the reject helpers
probably need a skb_mac_header_was_set() check, the same way
nf_bridge_adjust_skb_data() in nfnetlink_queue.c has one. Or would you
rather drop the bridge extension on the dup path? Either way, it looks
like that has to go in together with this change, especially with the
stable tag.

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261117175835.745796-1-theodorlarionov%40gmail.com

  reply	other threads:[~2026-11-19  6:00 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-17 17:58 [PATCH net v2 0/2] net: do not point a pskb copy's mac header into uninitialised headroom Theodor Arsenij Larionov Trichkine
2026-11-17 17:58 ` [PATCH net v2 1/2] netfilter: nfnetlink_queue: only adjust bridged skbs that have a mac header Theodor Arsenij Larionov Trichkine
2026-11-19  6:00   ` netdev-bot+sashiko
2026-11-17 17:58 ` [PATCH net v2 2/2] net: unset the mac header of a pskb copy that points into headroom Theodor Arsenij Larionov Trichkine
2026-11-19  6:00   ` netdev-bot+sashiko [this message]
2026-11-19  8:48     ` Florian Westphal
2026-11-17 18:03 ` [PATCH net v2 0/2] net: do not point a pskb copy's mac header into uninitialised headroom netdev-bot+sinfo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=179506802393.3136.3490105838474942994@kernel.org \
    --to=netdev-bot+sashiko@kernel.org \
    --cc=coreteam@netfilter.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=fw@strlen.de \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=pablo@netfilter.org \
    --cc=phil@nwl.cc \
    --cc=theodorlarionov@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).