Netdev List
 help / color / mirror / Atom feed
From: Hangbin Liu <hangbin.liu@linux.dev>
To: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
Cc: Qihang <q.h.hack.winter@gmail.com>,
	jv@jvosburgh.net, jiri@resnulli.us, andrew+netdev@lunn.ch,
	davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
	pabeni@redhat.com, willemb@google.com, netdev@vger.kernel.org,
	stable@vger.kernel.org
Subject: Re: [PATCH net 1/2] bonding: reject frames with insufficient headroom in bond_header_create
Date: Fri, 28 Aug 2026 09:12:24 +0800	[thread overview]
Message-ID: <apDgeCLGiHTd7fAC@fedora> (raw)
In-Reply-To: <willemdebruijn.kernel.361c9e585560e@gmail.com>

On Thu, Aug 27, 2026 at 05:37:09PM -0400, Willem de Bruijn wrote:
> Qihang wrote:
> > Hi Willem,
> > 
> > I'll resend this as v2 with a cover letter.
> > 
> > On scope: I grepped every header_ops->create.  Five devices delegate to a
> > lower device (bond, team, macvlan, ipvlan, 6lowpan), but only bond and
> > team re-select that lower device under RCU -- the rest bind it at netdev
> > creation.  So bond and team are the full scope.
> > 
> > Re Fixes: I used 950803f because it introduced bond_header_create (where
> > this check lives); before it the type-confusion BUG masked this race.
> > Happy to point at 1284cd3a2b74 instead if you prefer.
> > 
> > On the fix location, I'd rather get your read before writing more.  The
> > options I see:
> > 
> >   1. per-wrapper headroom reject in bond/team only -- small, safe,
> >      backport-friendly, but not generic (the next stacked device needs
> >      its own).
> > 
> >   2. central check in dev_hard_header on dev->hard_header_len -- one
> >      place, but I think it's unsafe for bond: bond_dev->hard_header_len
> >      only follows the first slave (bond_setup_by_slave),
> >      bond_change_active_slave flips curr_active_slave without touching
> >      it, and same-type slaves can have different hard_header_len (two GRE
> >      tunnels).  So it can under-reject.  Would need bond to maintain
> >      hard_header_len differently first.
> > 
> >   3. resolve the effective {dev, ops, hard_header_len} as one RCU triple
> >      via a generic callback, so the caller never cares which subordinate
> >      the master picks.  Truly generic and race-free, but it's a new ndo --
> >      net-next material, awkward for stable backport.
> > 
> >   4. make header_ops->create() take an explicit headroom contract and
> >      fail cleanly instead of pushing blind -- cleanest long-term, but
> >      touches every create() in the tree.  Too heavy for now.
> > 
> > My v1 is option 1 (per-wrapper).  Want one of these, a combination,
> > or something else entirely?
> 
> Thanks for the analysis.
> 
> I agree that 3 nd 4 are too invasive for the scope of the bug.
> 
> It's a bit odd that bond and team just take the hard_header_len of the
> first slave. And that bond_create_header just passes to

Actually, bond will use the max hard_header_len of all slaves, see

netdev_compute_master_upper_features()


> curr_active_slave, while various bond modes like LAG will have
> multiple concurrently active slaves.
> 
> That indicates that the intent is for all slaves to have the same
> header length and header_ops->create callback.

And here seem you want to all saves also sync the header length?

I'm not sure if we should/could do this in the same function
netdev_compute_master_upper_features().

Thanks
Hangbin

  reply	other threads:[~2026-08-28  1:12 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-24  2:18 [PATCH net 1/2] bonding: reject frames with insufficient headroom in bond_header_create Qihang
2026-08-24  2:18 ` [PATCH net 2/2] team: reject frames with insufficient headroom in team_header_create Qihang
2026-08-26  2:02 ` [PATCH net 1/2] bonding: reject frames with insufficient headroom in bond_header_create Willem de Bruijn
2026-08-27  3:13   ` Qihang
2026-08-27  5:10     ` Jiayuan Chen
2026-08-27 21:37     ` Willem de Bruijn
2026-08-28  1:12       ` Hangbin Liu [this message]
2026-08-28  2:43         ` Willem de Bruijn
2026-08-28  6:07           ` Qihang
2026-08-28 20:26             ` Willem de Bruijn
2026-08-27  1:10 ` Hangbin Liu
2026-08-27  3:25   ` 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=apDgeCLGiHTd7fAC@fedora \
    --to=hangbin.liu@linux.dev \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=jiri@resnulli.us \
    --cc=jv@jvosburgh.net \
    --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 \
    --cc=willemb@google.com \
    --cc=willemdebruijn.kernel@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