Re: [syzbot] [bpf?] [net?] possible deadlock in xsk_notifier (3)
From: Stanislav Fomichev
Date: Wed Jun 25 2025 - 19:38:01 EST
On 06/25, Jakub Kicinski wrote:
> On Wed, 25 Jun 2025 13:48:03 -0700 Stanislav Fomichev wrote:
> > > > I'm still learning the af_xdp. Sure, I'm interested in it, just a bit
> > > > worried if I'm capable of completing it. I will try then.
> > >
> > > SG, thanks! If you need more details lmk, but basically we need to reorder
> > > netdev_lock_ops() and mutex_lock(lock: &xs->mutex)+XSK_READY check.
> > > And similarly for cleanup (out_unlock/out_release) path.
> >
> > Jakub just told me that I'm wrong and it looks similar to commit
> > f0433eea4688 ("net: don't mix device locking in dev_close_many()
> > calls"). So this is not as easy as flipping the lock ordering :-(
>
> I don't think registering a netdev from NETDEV_UP even of another
> netdev is going to play way with instance locks and lockdep.
> This is likely a false positive but if syzbot keeps complaining
> we could:
>
> diff --git a/drivers/net/wan/lapbether.c b/drivers/net/wan/lapbether.c
> index 995a7207bdf8..f357a7ac70ac 100644
> --- a/drivers/net/wan/lapbether.c
> +++ b/drivers/net/wan/lapbether.c
> @@ -81,7 +81,7 @@ static struct lapbethdev *lapbeth_get_x25_dev(struct net_device *dev)
>
> static __inline__ int dev_is_ethdev(struct net_device *dev)
> {
> - return dev->type == ARPHRD_ETHER && strncmp(dev->name, "dummy", 5);
> + return dev->type == ARPHRD_ETHER && !netdev_need_ops_lock(dev);
> }
>
> IDK what the dummy hack is there for, it's been like that since
> git begun..
Agreed. The driver itlself looks interesting. IIUC, when loaded, it
unconditionally creates virtual netdev for any eth device in the init
ns. A bit surprised that syzbot enables it, none of my machines have it
enabled.