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] [day] [month] [year] [list]
Date:   Wed, 17 Nov 2021 21:27:44 +0200
From:   Leon Romanovsky <leon@...nel.org>
To:     Jakub Kicinski <kuba@...nel.org>
Cc:     netdev@...r.kernel.org, davem@...emloft.net, eric.dumazet@...il.com
Subject: Re: [RFC net-next 1/2] net: add netdev_refs debug

On Wed, Nov 17, 2021 at 10:35:45AM -0800, Jakub Kicinski wrote:
> On Wed, 17 Nov 2021 20:24:17 +0200 Leon Romanovsky wrote:
> > > +/* Store a raw, unprotected pointer */
> > > +static inline void __netdev_ref_store(struct netdev_ref *ref,
> > > +				      struct net_device *dev)
> > > +{
> > > +	ref->dev = dev;
> > > +
> > > +#ifdef CONFIG_DEBUG_OBJECTS_NETDEV_REFS
> > > +	refcount_set(&ref->cnt, 0);  
> > 
> > This is very uncommon pattern. I would expect that first pointer access
> > will start from 1, like all refcount_t users. If you still prefer to
> > start from 0, i suggest you to use atomic_t. 
> 
> It's not really "starting from 0", it's more of a "setting the count
> to invalid". It can't escape from this state with a simple inc.

I understand it and this is what raises eyebrows. The refcount_t type
has very clear semantics which you are stretching too far.

Let's see what Eric had in mind for his RFC.

Thanks

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ