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: <20251112153855.GA7209@lst.de>
Date: Wed, 12 Nov 2025 16:38:55 +0100
From: Christoph Hellwig <hch@....de>
To: Vlastimil Babka <vbabka@...e.cz>
Cc: Christoph Hellwig <hch@....de>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Christoph Lameter <cl@...two.org>,
	David Rientjes <rientjes@...gle.com>,
	Roman Gushchin <roman.gushchin@...ux.dev>,
	Harry Yoo <harry.yoo@...cle.com>,
	Eric Biggers <ebiggers@...nel.org>, linux-mm@...ck.org,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH 6/7] mempool: fix a wakeup race when sleeping for
 elements

On Wed, Nov 12, 2025 at 11:53:39AM +0100, Vlastimil Babka wrote:
> > +alloc:
> >  	element = remove_element(pool);
> >  	spin_unlock_irqrestore(&pool->lock, flags);
> >  
> > @@ -406,13 +407,17 @@ static void *mempool_alloc_from_pool(struct mempool *pool, gfp_t gfp_mask)
> >  		DEFINE_WAIT(wait);
> >  
> >  		prepare_to_wait(&pool->wait, &wait, TASK_UNINTERRUPTIBLE);
> > +		if (pool->curr_nr) {
> > +			finish_wait(&pool->wait, &wait);
> > +			goto alloc;
> > +		}
> >  		spin_unlock_irqrestore(&pool->lock, flags);
> I think the race already cannot exist, thanks to the pool->lock being
> unlocked after prepare_to_wait()?
> The freeing path can't bump pool->curr_nr without the lock, so the condition
> you added can't even be true, no?

You're right, I'll drop this again.


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ