lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Z9CXDDrruPmTjdW5@mini-arch>
Date: Tue, 11 Mar 2025 13:03:24 -0700
From: Stanislav Fomichev <stfomichev@...il.com>
To: Mina Almasry <almasrymina@...gle.com>
Cc: Stanislav Fomichev <sdf@...ichev.me>, netdev@...r.kernel.org,
	davem@...emloft.net, edumazet@...gle.com, kuba@...nel.org,
	pabeni@...hat.com, linux-kernel@...r.kernel.org,
	donald.hunter@...il.com, horms@...nel.org,
	michael.chan@...adcom.com, pavan.chebbi@...adcom.com,
	andrew+netdev@...n.ch, jdamato@...tly.com,
	xuanzhuo@...ux.alibaba.com, asml.silence@...il.com, dw@...idwei.uk
Subject: Re: [PATCH net-next v2 2/3] net: add granular lock for the netdev
 netlink socket

On 03/11, Mina Almasry wrote:
> On Tue, Mar 11, 2025 at 7:40 AM Stanislav Fomichev <sdf@...ichev.me> wrote:
> >
> > As we move away from rtnl_lock for queue ops, introduce
> > per-netdev_nl_sock lock.
> >
> > Cc: Mina Almasry <almasrymina@...gle.com>
> > Signed-off-by: Stanislav Fomichev <sdf@...ichev.me>
> > ---
> >  include/net/netdev_netlink.h | 1 +
> >  net/core/netdev-genl.c       | 6 ++++++
> >  2 files changed, 7 insertions(+)
> >
> > diff --git a/include/net/netdev_netlink.h b/include/net/netdev_netlink.h
> > index 1599573d35c9..075962dbe743 100644
> > --- a/include/net/netdev_netlink.h
> > +++ b/include/net/netdev_netlink.h
> > @@ -5,6 +5,7 @@
> >  #include <linux/list.h>
> >
> >  struct netdev_nl_sock {
> > +       struct mutex lock;
> >         struct list_head bindings;
> >  };
> >
> > diff --git a/net/core/netdev-genl.c b/net/core/netdev-genl.c
> > index a219be90c739..63e10717efc5 100644
> > --- a/net/core/netdev-genl.c
> > +++ b/net/core/netdev-genl.c
> > @@ -859,6 +859,7 @@ int netdev_nl_bind_rx_doit(struct sk_buff *skb, struct genl_info *info)
> >                 goto err_genlmsg_free;
> >         }
> >
> > +       mutex_lock(&priv->lock);
> 
> You do not need to acquire this lock so early, no? AFAICT you only
> need to lock around:
> 
> list_add(&binding->list, sock_binding_list);
> 
> Or is this to establish a locking order (sock_binding_list lock before
> the netdev lock)?

Right, if I acquire it later, I'd have to do the same order
in netdev_nl_sock_priv_destroy and it seems to be a bit more complicated
to do (since we go over the list of bindings over there).

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ