From: Fam Zheng <famz@redhat.com>
To: qemu-devel@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>,
pbonzini@redhat.com, qemu-block@nongnu.org,
qemu-stable@nongnu.org, Stefan Hajnoczi <stefanha@redhat.com>
Subject: [Qemu-devel] [PATCH v2 0/2] block: Fix unaligned bdrv_aio_write_zeroes
Date: Fri, 24 Apr 2015 18:33:18 +0800 [thread overview]
Message-ID: <1429871600-10180-1-git-send-email-famz@redhat.com> (raw)
An unaligned zero write causes NULL deferencing in bdrv_co_do_pwritev. That
path is reachable from bdrv_co_write_zeroes and bdrv_aio_write_zeroes.
You can easily trigger through the former with qemu-io, as the test case added
by 61815d6e0aa. For bdrv_aio_write_zeroes, in common cases there's always a
format driver (which uses 512 alignment), so it would be much rarer to have
unaligned requests (only concerning top level here, when the request goes down
to bs->file, where for example the alignment is 4k, it would then be calling
bdrv_co_write_zeroes because it's in a coroutine).
fc3959e4669a1c fixed bdrv_co_write_zeroes but not bdrv_aio_write_zeroes. The
lattern is the actually used one by device model. Revert the previous fix, do
it in bdrv_co_do_pwritev, to cover both paths.
v2: Split to three aligned pwritev.
Fam Zheng (2):
Revert "block: Fix unaligned zero write"
block: Fix NULL deference for unaligned write if qiov is NULL
block.c | 121 +++++++++++++++++++++++++++++++++++-----------------------------
1 file changed, 66 insertions(+), 55 deletions(-)
--
1.9.3
next reply other threads:[~2015-04-24 10:33 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-24 10:33 Fam Zheng [this message]
2015-04-24 10:33 ` [Qemu-devel] [PATCH v2 1/2] Revert "block: Fix unaligned zero write" Fam Zheng
2015-04-24 11:12 ` Fam Zheng
2015-04-24 10:33 ` [Qemu-devel] [PATCH v2 2/2] block: Fix NULL deference for unaligned write if qiov is NULL Fam Zheng
2015-04-24 11:00 ` Paolo Bonzini
2015-04-24 11:51 ` Paolo Bonzini
2015-04-27 5:17 ` 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=1429871600-10180-1-git-send-email-famz@redhat.com \
--to=famz@redhat.com \
--cc=kwolf@redhat.com \
--cc=pbonzini@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).