[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAKUd0B8r=7EKOuyy=FACg438f2vQRdJMyzfJzcQOUd+4My4oYg@mail.gmail.com>
Date: Wed, 6 Oct 2021 15:36:11 -0700
From: Ramji Jiyani <ramjiyani@...gle.com>
To: Eric Biggers <ebiggers@...nel.org>
Cc: arnd@...db.de, viro@...iv.linux.org.uk, bcrl@...ck.org, hch@....de,
kernel-team@...roid.com, linux-aio@...ck.org,
linux-arch@...r.kernel.org, linux-fsdevel@...r.kernel.org,
linux-kernel@...r.kernel.org, stable@...r.kernel.org,
oleg@...hat.com, Jeff Moyer <jmoyer@...hat.com>
Subject: Re: [PATCH v2] aio: Add support for the POLLFREE
On Wed, Oct 6, 2021 at 2:16 PM Eric Biggers <ebiggers@...nel.org> wrote:
>
> On Wed, Oct 06, 2021 at 07:50:29PM +0000, Ramji Jiyani wrote:
> > Commit f5cb779ba163 ("ANDROID: binder: remove waitqueue when thread
> > exits.") fixed the use-after-free in eventpoll but aio still has the
> > same issue because it doesn't honor the POLLFREE flag.
> >
> > Add support for the POLLFREE flag to force complete iocb inline in
> > aio_poll_wake(). A thread may use it to signal it's exit and/or request
> > to cleanup while pending poll request. In this case, aio_poll_wake()
> > needs to make sure it doesn't keep any reference to the queue entry
> > before returning from wake to avoid possible use after free via
> > poll_cancel() path.
> >
> > The POLLFREE flag is no more exclusive to the epoll and is being
> > shared with the aio. Remove comment from poll.h to avoid confusion.
> >
> > This fixes a use after free issue between binder thread and aio
> > interactions in certain sequence of events [1].
> >
> > [1] https://lore.kernel.org/all/CAKUd0B_TCXRY4h1hTztfwWbNSFQqsudDLn2S_28csgWZmZAG3Q@mail.gmail.com/
> >
> > Signed-off-by: Ramji Jiyani <ramjiyani@...gle.com>
> > Reviewed-by: Jeff Moyer <jmoyer@...hat.com>
>
> Can you add Fixes and Cc stable tags to ensure that this fix gets backported?
> Please refer to Documentation/process/submitting-patches.rst.
>
> - Eric
Thanks Eric. I'll send v3 with these changes soon.
~ Ramji
Powered by blists - more mailing lists