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]
Date:	Fri, 25 Jan 2013 15:12:51 -0800
From:	Andrew Morton <akpm@...ux-foundation.org>
To:	Hillf Danton <dhillf@...il.com>
Cc:	Kent Overstreet <koverstreet@...gle.com>, Valdis.Kletnieks@...edu,
	bcrl@...ck.org, zab@...bo.net, linux-kernel@...r.kernel.org,
	linux-aio@...ck.org, linux-fsdevel@...r.kernel.org
Subject: Re: [PATCH 3/3] aio-use-cancellation-list-lazily-fix

On Fri, 25 Jan 2013 21:30:32 +0800
Hillf Danton <dhillf@...il.com> wrote:

> On Fri, Jan 25, 2013 at 5:43 AM, Kent Overstreet <koverstreet@...gle.com> wrote:
> > The cancellation changes were fubar - we can't cancel a kiocb if it
> > doesn't actually have a cancellation callback.
> >
> > The use of xchg() in aio_complete() was right - there we're marking the
> > kiocb as completed - but we need to use cmpxchg() in kiocb_cancel() - a
> > lock isn't sufficient since we're synchronizing with aio_complete()
> > which isn't taking any locks.
> >
> >  static int kiocb_cancel(struct kioctx *ctx, struct kiocb *kiocb,
> >                         struct io_event *res)
> >  {
> > -       kiocb_cancel_fn *cancel;
> > +       kiocb_cancel_fn *old, *cancel;
> >         int ret = -EINVAL;
> >
> > -       cancel = xchg(&kiocb->ki_cancel, KIOCB_CANCELLED);
> > -       if (!cancel || cancel == KIOCB_CANCELLED)
> > -               return ret;
> > +       /*
> > +        * Don't want to set kiocb->ki_cancel = KIOCB_CANCELLED unless it
> > +        * actually has a cancel function, hence the cmpxchg()
> > +        */
> > +
> > +       cancel = ACCESS_ONCE(kiocb->ki_cancel);
> > +       do {
> > +               if (!cancel || cancel == KIOCB_CANCELLED)
> > +                       return ret;
> > +
> > +               BUG();
> 
> Hmm, what is trapped?
> 
> > +               old = cancel;
> > +               cancel = cmpxchg(&kiocb->ki_cancel, old, KIOCB_CANCELLED);
> > +       } while (cancel != old);

erk, I missed that.  What earthly sense is there in putting a BUG() in
that place.

I think I'll delete it and pretend I never saw it :(


--
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