All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pavel Begunkov <asml.silence@gmail.com>
To: George Kennedy <george.kennedy@oracle.com>,
	gregkh@linuxfoundation.org, axboe@kernel.dk
Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 0/2] Revert "block: add single bio async direct IO helper" to avoid UAF
Date: Tue, 7 Dec 2021 17:36:24 +0000	[thread overview]
Message-ID: <95ea9142-9f36-981d-a04d-3efded544af7@gmail.com> (raw)
In-Reply-To: <1638892302-14475-1-git-send-email-george.kennedy@oracle.com>

On 12/7/21 15:51, George Kennedy wrote:
> git bisect shows that commit 54a88eb838d3
> ("block: add single bio async direct IO helper")
> causes the following UAF: KASAN: use-after-free Write in io_submit_one
> 
> Tried to root-cause the issue, but need the patch submitter's help in
> coming up with a fix.

Hey George, thanks for the report. Do you have a reproducer?

One spot I don't like is how errors from bio_iov_iter_get_pages()
are handled, will test it.

diff --git a/block/fops.c b/block/fops.c
index ad732a36f9b3..211f44974d1e 100644
--- a/block/fops.c
+++ b/block/fops.c
@@ -342,7 +342,7 @@ static ssize_t __blkdev_direct_IO_async(struct kiocb *iocb,
  		if (unlikely(ret)) {
  			bio->bi_status = BLK_STS_IOERR;
  			bio_endio(bio);
-			return ret;
+			return -EIOCBQUEUED;
  		}
  	}
  	dio->size = bio->bi_iter.bi_size;


-- 
Pavel Begunkov

  parent reply	other threads:[~2021-12-07 17:36 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-07 15:51 [PATCH 0/2] Revert "block: add single bio async direct IO helper" to avoid UAF George Kennedy
2021-12-07 15:51 ` [PATCH 1/2] Revert "block: avoid extra iter advance with async iocb" George Kennedy
2021-12-07 15:51 ` [PATCH 2/2] Revert "block: add single bio async direct IO helper" George Kennedy
2021-12-07 17:36 ` Pavel Begunkov [this message]
2021-12-07 18:09   ` [PATCH 0/2] Revert "block: add single bio async direct IO helper" to avoid UAF George Kennedy
2021-12-07 18:11     ` Pavel Begunkov

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=95ea9142-9f36-981d-a04d-3efded544af7@gmail.com \
    --to=asml.silence@gmail.com \
    --cc=axboe@kernel.dk \
    --cc=george.kennedy@oracle.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.