From: Max Reitz <mreitz@redhat.com>
To: Eric Blake <eblake@redhat.com>, qemu-devel@nongnu.org
Cc: qemu-block@nongnu.org, jsnow@redhat.com, qemu-stable@nongnu.org,
Stefan Hajnoczi <stefanha@redhat.com>,
Fam Zheng <famz@redhat.com>, Kevin Wolf <kwolf@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v2 2/5] block: Guarantee that *file is set on bdrv_get_block_status()
Date: Wed, 31 May 2017 16:42:27 +0200 [thread overview]
Message-ID: <00ea23b3-dbda-00df-0bf2-f746a3043a3a@redhat.com> (raw)
In-Reply-To: <20170524202842.26724-3-eblake@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 1627 bytes --]
On 2017-05-24 22:28, Eric Blake wrote:
> We document that *file is valid if the return is not an error and
> includes BDRV_BLOCK_OFFSET_VALID, but forgot to obey this contract
> when a driver (such as blkdebug) lacks a callback. Broken in
> commit 67a0fd2 (v2.6), when we added the file parameter.
Not sure if I'd call that "broken", as in the part participle of "break"
because there was never any breaking. It just didn't abide by the
contract from the start.
> Enhance qemu-iotest 177 to cover this, using a sequence that would
> print garbage or even SEGV, because it was dererefencing through
> uninitialized memory. [The resulting test output shows that we
> have less-than-ideal block status from the blkdebug driver, but
> that's a separate fix coming up soon.]
>
> Setting *file on all paths that return BDRV_BLOCK_OFFSET_VALID is
> enough to fix the crash, but we can go one step further: always
> setting *file, even on error, means that a broken caller that
> blindly dereferences file without checking for error is now more
> likely to get a reliable SEGV instead of randomly acting on garbage,
> making it easier to diagnose such buggy callers. Adding an
> assertion that file is set where expected doesn't hurt either.
>
> CC: qemu-stable@nongnu.org
> Signed-off-by: Eric Blake <eblake@redhat.com>
>
> ---
> v2: drop redundant assignment
> ---
> block/io.c | 5 +++--
> tests/qemu-iotests/177 | 3 +++
> tests/qemu-iotests/177.out | 2 ++
> 3 files changed, 8 insertions(+), 2 deletions(-)
Anyway,
Reviewed-by: Max Reitz <mreitz@redhat.com>
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 498 bytes --]
next prev parent reply other threads:[~2017-05-31 14:42 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-24 20:28 [Qemu-devel] [PATCH v2 0/5] more blkdebug tweaks Eric Blake
2017-05-24 20:28 ` [Qemu-devel] [PATCH v2 1/5] qemu-io: Don't die on second open Eric Blake
2017-05-25 0:50 ` Fam Zheng
2017-05-31 14:18 ` Max Reitz
2017-05-31 15:12 ` Eric Blake
2017-05-31 15:56 ` Max Reitz
2017-05-24 20:28 ` [Qemu-devel] [PATCH v2 2/5] block: Guarantee that *file is set on bdrv_get_block_status() Eric Blake
2017-05-25 6:18 ` Fam Zheng
2017-05-31 14:42 ` Max Reitz [this message]
2017-05-24 20:28 ` [Qemu-devel] [PATCH v2 3/5] block: Allow NULL file for bdrv_get_block_status() Eric Blake
2017-05-25 6:34 ` Fam Zheng
2017-05-25 13:57 ` Eric Blake
2017-05-31 14:53 ` Max Reitz
2017-05-24 20:28 ` [Qemu-devel] [PATCH v2 4/5] block: Simplify use of BDRV_BLOCK_RAW Eric Blake
2017-05-25 6:35 ` Fam Zheng
2017-05-31 14:56 ` Max Reitz
2017-05-24 20:28 ` [Qemu-devel] [PATCH v2 5/5] blkdebug: Support .bdrv_co_get_block_status Eric Blake
2017-05-25 6:37 ` Fam Zheng
2017-05-31 15:00 ` Max Reitz
2017-05-25 14:36 ` [Qemu-devel] [PATCH v2 0/5] more blkdebug tweaks Fam Zheng
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=00ea23b3-dbda-00df-0bf2-f746a3043a3a@redhat.com \
--to=mreitz@redhat.com \
--cc=eblake@redhat.com \
--cc=famz@redhat.com \
--cc=jsnow@redhat.com \
--cc=kwolf@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-stable@nongnu.org \
--cc=stefanha@redhat.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 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).