From: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
To: Eric Dumazet <edumazet@google.com>,
Willem de Bruijn <willemdebruijn.kernel@gmail.com>
Cc: Kuniyuki Iwashima <kuniyu@google.com>,
"David S. Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>,
Paolo Abeni <pabeni@redhat.com>,
Jason Wang <jasowang@redhat.com>,
Andrew Lunn <andrew+netdev@lunn.ch>,
Simon Horman <horms@kernel.org>,
Kuniyuki Iwashima <kuni1840@gmail.com>,
netdev@vger.kernel.org
Subject: Re: [PATCH v1 net-next] tun: Ignore tun in netdev_lock_pos().
Date: Sun, 29 Mar 2026 22:29:32 -0400 [thread overview]
Message-ID: <willemdebruijn.kernel.1968171df848f@gmail.com> (raw)
In-Reply-To: <CANn89iL_znbKR2oqOs9kQTgAnNKv487ymr8Xx8ouHFsyAK=o6Q@mail.gmail.com>
Eric Dumazet wrote:
> On Fri, Mar 27, 2026 at 4:16 PM Willem de Bruijn
> <willemdebruijn.kernel@gmail.com> wrote:
> >
> > Kuniyuki Iwashima wrote:
> > > On Fri, Mar 27, 2026 at 2:48 PM Eric Dumazet <edumazet@google.com> wrote:
> > > >
> > > > On Fri, Mar 27, 2026 at 2:34 PM Kuniyuki Iwashima <kuniyu@google.com> wrote:
> > > > >
> > > > > dev->type could be any value on tun due to TUNSETLINK.
> > > > >
> > > > > Let's not warn about it in netdev_lock_pos().
> > > > >
> > > > > Signed-off-by: Kuniyuki Iwashima <kuniyu@google.com>
> > > >
> > > > Hmmm... should we instead have a list of supported types ?
> > > >
> > > > And reject user space requests for unsupported ones ?
> > >
> > > I chose a safer way but maybe we could reuse tun_get_addr_len()
> > > and define the default case there as unsupported ?
> > >
> > > I guess it's okay even if it breaks userspace because we can
> > > just add a single line to restore the support.
> >
> > We shouldn't risk breaking userspace, over such a sanity check.
>
> The thing is : this check makes sure that each type has a different
> lockdep class.
>
> >
> > Presumably any truly newly added type will have a non-zero addr_len.
> > While tun sets this to zero for weird inputs. Maybe just filter on
> > that in the WARN_ONCE?
>
> Then we might hit some lockdep issues...
Warnings due to stacked devices wouldn't apply to tun.
Can this be used to set up (false positive) lock inversion deadline
reports?
> Perhaps use lockdep_register_key() on each tun device...
In tun_set_iff replace the xmit_lockdep_class previously set by
netdev_init_one_queue?
If keeping the approach from v1, perhaps a tun device can already be
identified in core code without having to export tun_link_ops.
From the init in tun_set_iff, dev->sysfs_groups[0] will have an attr
"tun_flags". There might be something more elegant. Just the first I
spotted.
next prev parent reply other threads:[~2026-03-30 2:29 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-27 21:34 [PATCH v1 net-next] tun: Ignore tun in netdev_lock_pos() Kuniyuki Iwashima
2026-03-27 21:48 ` Eric Dumazet
2026-03-27 22:22 ` Kuniyuki Iwashima
2026-03-27 23:16 ` Willem de Bruijn
2026-03-28 0:19 ` Eric Dumazet
2026-03-30 2:29 ` Willem de Bruijn [this message]
2026-03-29 3:36 ` kernel test robot
2026-03-29 4:06 ` kernel test robot
2026-03-29 11:10 ` kernel test robot
2026-03-29 13:36 ` kernel test robot
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.1968171df848f@gmail.com \
--to=willemdebruijn.kernel@gmail.com \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=jasowang@redhat.com \
--cc=kuba@kernel.org \
--cc=kuni1840@gmail.com \
--cc=kuniyu@google.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.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