Linux Netfilter development
 help / color / mirror / Atom feed
From: Florian Westphal <fw@strlen.de>
To: netdev-bot+sashiko@kernel.org
Cc: theodorlarionov@gmail.com, davem@davemloft.net,
	edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com,
	horms@kernel.org, pablo@netfilter.org, 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 09:48:26 +0100	[thread overview]
Message-ID: <av63w6kQryQqWP_y@strlen.de> (raw)
In-Reply-To: <179506802393.3136.3490105838474942994@kernel.org>

netdev-bot+sashiko@kernel.org <netdev-bot+sashiko@kernel.org> wrote:
> [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.

I think we should disable dup or fwd of skbs coming from br_netfilter
(i.e. with SKB_EXT_BRIDGE_NF extension set).

It would also make sense to disable/remove nf_queue support for
br_netfilter in nf-next (this is independent of this work).

  reply	other threads:[~2026-11-19  8:48 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
2026-11-19  8:48     ` Florian Westphal [this message]
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=av63w6kQryQqWP_y@strlen.de \
    --to=fw@strlen.de \
    --cc=coreteam@netfilter.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=netdev-bot+sashiko@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