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  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]
Date:   Tue, 19 Feb 2019 20:46:27 -0700
From:   Jason Gunthorpe <jgg@...pe.ca>
To:     Matthew Wilcox <willy@...radead.org>
Cc:     linux-kernel@...r.kernel.org
Subject: Re: xarray reserve/release?

On Tue, Feb 19, 2019 at 05:26:09PM -0800, Matthew Wilcox wrote:
> On Tue, Feb 19, 2019 at 04:53:49PM -0700, Jason Gunthorpe wrote:
> > Hey Matt,
> > 
> > Did you intend that xa_release doesn't work on allocating arrays:
> 
> That surprises me.  I'll take a look in the morning.

I think the issue is that this:

static inline void xa_release(struct xarray *xa, unsigned long index)
{
	xa_cmpxchg(xa, index, NULL, NULL, 0);

relies on the NULL actually being xas_store(NULL), but cmpxchg
transforms it into xas_store(XA_ZERO_ENTRY) when allocating..

So xa_reserve(), xa_release() and xa_cmpxchg() all do the same thing
for allocating arrays.

Perhaps this:

void __xa_release(struct xarray *xa, unsigned long index)
{
	XA_STATE(xas, xa, index);
	void *curr;

	curr = xas_load(&xas);
	if (curr == XA_ZERO_ENTRY)
		xas_store(&xas, NULL);
}

?

Also, I wonder if xa_reserve() is better written as as

       xa_cmpxchg(xa, index, NULL, XA_ZERO_ENTRY)

Bit clearer what is going on..

Jason

Powered by blists - more mailing lists