From: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
To: Jakub Kicinski <kuba@kernel.org>,
Willem de Bruijn <willemdebruijn.kernel@gmail.com>
Cc: Qihang <q.h.hack.winter@gmail.com>,
netdev@vger.kernel.org, daniel.zahka@gmail.com,
davem@davemloft.net, edumazet@google.com, pabeni@redhat.com,
horms@kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH net v5 2/2] packet: use consistent hard_header_len in TX_RING send path
Date: Mon, 03 Aug 2026 23:04:54 -0400 [thread overview]
Message-ID: <willemdebruijn.kernel.ad7f187edf35@gmail.com> (raw)
In-Reply-To: <20260803192228.49a49867@kernel.org>
Jakub Kicinski wrote:
> On Thu, 30 Jul 2026 05:22:21 -0400 Willem de Bruijn wrote:
> > Qihang wrote:
> > > tpacket_snd() reads dev->hard_header_len independently for skb
> > > allocation and header construction in tpacket_fill_skb(). Concurrent
> > > netdevice reconfiguration can therefore make the reserved headroom
> > > smaller than the amount later pushed, or make copylen - hard_header_len
> > > negative.
> > >
> > > Snapshot hard_header_len once before processing ring frames and use it
> > > for the frame limit, headroom allocation, copy length, and skb
> > > construction. Pass the snapshot to tpacket_fill_skb().
> > >
> > > The separate SOCK_DGRAM consistency problem between hard_header_len and
> > > header_ops->create is not addressed here.
> > >
> > > Fixes: 69e3c75f4d54 ("net: TX_RING and packet mmap")
> > > Cc: stable@vger.kernel.org
> > > Signed-off-by: Qihang <q.h.hack.winter@gmail.com>
I missed this before, but Qihang is that your full name?
https://www.kernel.org/doc/html/latest/process/submitting-patches.html#sign-your-work-the-developer-s-certificate-of-origin
> >
> > Reviewed-by: Willem de Bruijn <willemb@google.com>
>
> Willem, does the *shiko feedback look like false positives?
> Both instances seem to provide different feedback, if I'm reading my own
> tea leaves right Claude discarded the Gemini feedback about a panic
> as a hallucination..
>
> https://sashiko.dev/#/patchset/20260730082925.93759-2-q.h.hack.winter@gmail.com
>
> https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20260730082925.93759-2-q.h.hack.winter@gmail.com
If I read Gemini feedback correctly, all reports are about the current
solution falling short of fixing the instance of this race condition
with dev_hard_header(), which reads dev->hard_header_len directly.
The patch indeed mentions this limitation.
As well as the same issue with dev_validate_header(), which the commit
does not list as limitation. But that one is only reached with variable
length L2 protocols.
Side note, in net-next I can probably remove header_ops.validate now
that ax25 is gone, and with that all of dev_validate_header. No other
variable length L2 protocol ever implemented that callback.
But that won't help older kernels, of course. I think it's fine to
remove that CAP_SYS_RAWIO branch in the fix, which never had much
value anyway. It was there to allow testing purposely bad input or so.
next prev parent reply other threads:[~2026-08-04 3:04 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-30 8:29 [PATCH net v5 0/2] packet: use consistent hard_header_len in send paths Qihang
2026-07-30 8:29 ` [PATCH net v5 1/2] packet: use consistent hard_header_len in non-ring " Qihang
2026-07-30 8:29 ` [PATCH net v5 2/2] packet: use consistent hard_header_len in TX_RING send path Qihang
2026-07-30 9:22 ` Willem de Bruijn
2026-08-04 2:22 ` Jakub Kicinski
2026-08-04 3:04 ` Willem de Bruijn [this message]
2026-08-04 23:43 ` Jakub Kicinski
2026-08-05 13:35 ` Willem de Bruijn
2026-08-04 9:00 ` [PATCH net v6 0/3] net: fix hard_header_len races in packet send paths Qihang
2026-08-04 9:00 ` [PATCH net v6 1/3] net: remove CAP_SYS_RAWIO zero-padding in dev_validate_header Qihang
2026-08-04 12:16 ` Willem de Bruijn
2026-08-04 23:44 ` Jakub Kicinski
2026-08-04 9:32 ` [PATCH net v6 2/3] packet: use consistent hard_header_len in non-ring send paths Qihang
2026-08-04 9:33 ` [PATCH net v6 3/3] packet: use consistent hard_header_len in TX_RING send path Qihang
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=willemdebruijn.kernel.ad7f187edf35@gmail.com \
--to=willemdebruijn.kernel@gmail.com \
--cc=daniel.zahka@gmail.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=q.h.hack.winter@gmail.com \
--cc=stable@vger.kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.