linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eric Biggers <ebiggers@kernel.org>
To: Ramji Jiyani <ramjiyani@google.com>
Cc: arnd@arndb.de, viro@zeniv.linux.org.uk, bcrl@kvack.org,
	hch@lst.de, kernel-team@android.com, linux-aio@kvack.org,
	linux-arch@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	linux-kernel@vger.kernel.org, stable@vger.kernel.org,
	oleg@redhat.com, Jeff Moyer <jmoyer@redhat.com>
Subject: Re: [PATCH v2] aio: Add support for the POLLFREE
Date: Wed, 6 Oct 2021 14:16:00 -0700	[thread overview]
Message-ID: <YV4SELcjE7EfBiLI@gmail.com> (raw)
In-Reply-To: <20211006195029.532034-1-ramjiyani@google.com>

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@google.com>
> Reviewed-by: Jeff Moyer <jmoyer@redhat.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

  reply	other threads:[~2021-10-06 21:16 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-06 19:50 [PATCH v2] aio: Add support for the POLLFREE Ramji Jiyani
2021-10-06 21:16 ` Eric Biggers [this message]
2021-10-06 22:36   ` Ramji Jiyani

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YV4SELcjE7EfBiLI@gmail.com \
    --to=ebiggers@kernel.org \
    --cc=arnd@arndb.de \
    --cc=bcrl@kvack.org \
    --cc=hch@lst.de \
    --cc=jmoyer@redhat.com \
    --cc=kernel-team@android.com \
    --cc=linux-aio@kvack.org \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=oleg@redhat.com \
    --cc=ramjiyani@google.com \
    --cc=stable@vger.kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).