From: Ming Lei <ming.lei@redhat.com>
To: Keith Busch <kbusch@kernel.org>
Cc: Jason Yan <yanaijie@huawei.com>,
axboe@kernel.dk, hch@lst.de, keescook@chromium.org,
linux-block@vger.kernel.org
Subject: Re: [PATCH] block: do not copy data to user when bi_status is error
Date: Fri, 19 Mar 2021 09:36:40 +0800 [thread overview]
Message-ID: <YFQAKIjt5VzUNYDe@T590> (raw)
In-Reply-To: <20210318151305.GB31228@redsun51.ssa.fujisawa.hgst.com>
On Fri, Mar 19, 2021 at 12:13:05AM +0900, Keith Busch wrote:
> On Thu, Mar 18, 2021 at 08:26:21PM +0800, Jason Yan wrote:
> > When the user submitted a request with unaligned buffer, we will
> > allocate a new page and try to copy data to or from the new page.
> > If it is a reading request, we always copy back the data to user's
> > buffer, whether the result is good or error. So if the driver or
> > hardware returns an error, garbage data is copied to the user space.
> > This is a potential security issue which makes kernel info leaks.
> >
> > So do not copy the uninitalized data to user's buffer if the
> > bio->bi_status is not BLK_STS_OK in bio_copy_kern_endio_read().
>
> If we're using copy_kern routines, doesn't that mean it's a kernel
> request rather than user space?
It can be a kernel bounce buffer, which will be copied to user space
later, such as sg_scsi_ioctl(), but sg_scsi_ioctl() checks the request
result and not copy kernel buffer back in case of error.
Seems other cases are all kernel request.
--
Ming
next prev parent reply other threads:[~2021-03-19 1:37 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-18 12:26 [PATCH] block: do not copy data to user when bi_status is error Jason Yan
2021-03-18 12:56 ` Christoph Hellwig
2021-03-18 15:13 ` Keith Busch
2021-03-19 1:36 ` Ming Lei [this message]
2021-03-19 3:03 ` Jason Yan
2021-03-19 16:01 ` Keith Busch
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=YFQAKIjt5VzUNYDe@T590 \
--to=ming.lei@redhat.com \
--cc=axboe@kernel.dk \
--cc=hch@lst.de \
--cc=kbusch@kernel.org \
--cc=keescook@chromium.org \
--cc=linux-block@vger.kernel.org \
--cc=yanaijie@huawei.com \
/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.