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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20110311161924.b902942a.akpm@linux-foundation.org>
Date:	Fri, 11 Mar 2011 16:19:24 -0800
From:	Andrew Morton <akpm@...ux-foundation.org>
To:	Jeff Moyer <jmoyer@...hat.com>
Cc:	Roland Dreier <roland@...nel.org>, linux-aio@...ck.org,
	linux-kernel@...r.kernel.org, Benjamin LaHaise <bcrl@...ck.org>,
	stable@...nel.org
Subject: Re: [PATCH] aio: Wake all waiters when destroying ctx

On Fri, 11 Mar 2011 09:21:46 -0500
Jeff Moyer <jmoyer@...hat.com> wrote:

> Roland Dreier <roland@...nel.org> writes:
> 
> > From: Roland Dreier <roland@...estorage.com>
> >
> > The test program below will hang because io_getevents() uses
> > add_wait_queue_exclusive(), which means the wake_up() in io_destroy()
> > only wakes up one of the threads.  Fix this by using wake_up_all() in
> > the aio code paths where we want to make sure no one gets stuck.
> 
> [snip]
> 
> > Cc: <stable@...nel.org>
> > Signed-off-by: Roland Dreier <roland@...estorage.com>
> > ---
> >  fs/aio.c |    4 ++--
> >  1 files changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/fs/aio.c b/fs/aio.c
> > index 26869cd..88f0ed5 100644
> > --- a/fs/aio.c
> > +++ b/fs/aio.c
> > @@ -520,7 +520,7 @@ static inline void really_put_req(struct kioctx *ctx, struct kiocb *req)
> >  	ctx->reqs_active--;
> >  
> >  	if (unlikely(!ctx->reqs_active && ctx->dead))
> > -		wake_up(&ctx->wait);
> > +		wake_up_all(&ctx->wait);
> >  }
> >  
> >  static void aio_fput_routine(struct work_struct *data)
> > @@ -1229,7 +1229,7 @@ static void io_destroy(struct kioctx *ioctx)
> >  	 * by other CPUs at this point.  Right now, we rely on the
> >  	 * locking done by the above calls to ensure this consistency.
> >  	 */
> > -	wake_up(&ioctx->wait);
> > +	wake_up_all(&ioctx->wait);
> >  	put_ioctx(ioctx);	/* once for the lookup */
> >  }
> >  
> 
> Thanks, Roland, this looks good.
> 
> Reviewed-by: Jeff Moyer <jmoyer@...hat.com>

It's a fairly old bug (yes?) and we're presumably close to 2.6.38.  So
I scheduled the fix for 2.6.39 marked for backporting into 2.6.38.x and
earlier.

That may have been a bit over-cautious - feel free to argue ;)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ