From: Jonathan Cameron via <qemu-devel@nongnu.org>
To: <qemu-devel@nongnu.org>, Hanna Reitz <hreitz@redhat.com>,
Stefan Hajnoczi <stefanha@redhat.com>,
Kevin Wolf <kwolf@redhat.com>, <linuxarm@huawei.com>,
David Hildenbrand <david@redhat.com>,
Igor Mammedov <imammedo@redhat.com>
Subject: Null dereference in bdrv_unregister_buf() probably memory-backend-file related?
Date: Mon, 21 Nov 2022 16:21:32 +0000 [thread overview]
Message-ID: <20221121162132.00007540@huawei.com> (raw)
First CC list is a guess as I haven't managed to root cause where things are
going wrong yet.
Originally hit this whilst rebasing some CXL patches on v7.2.0-rc1.
CXL makes extensive use of memory-backends and most my tests happen
to use memory-backend-file
Issue seen on arm64 and x86 though helpfully on x86 the crash appears in an entirely
unrelated location (though the 'fix' works).
Fairly minimal test command line.
qemu-system-aarch64 \
-M virt \
-drive if=none,file=full.qcow2,format=qcow2,id=hd \
-device virtio-blk,drive=hd \
-object memory-backend-file,id=cxl-mem1,mem-path=/tmp/cxltest.raw,size=256M,align=256M \
Powerdown the machine or ctrl-c during boot gives a segfault.
On arm64 it was in a stable location that made at least some sense in that
bs in the below snippet is NULL.
I added the follow work around and the segfault goes away...
[PATCH] temp
---
block/io.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/block/io.c b/block/io.c
index b9424024f9..750e1366aa 100644
--- a/block/io.c
+++ b/block/io.c
@@ -3324,6 +3324,9 @@ void bdrv_unregister_buf(BlockDriverState *bs, void *host, size_t size)
{
BdrvChild *child;
+ if (!bs) {
+ return;
+ }
GLOBAL_STATE_CODE();
if (bs->drv && bs->drv->bdrv_unregister_buf) {
bs->drv->bdrv_unregister_buf(bs, host, size);
--
2.37.2
Not present on v7.1.0 . I'll start a bisection shortly but may take a while.
next reply other threads:[~2022-11-21 16:22 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-21 16:21 Jonathan Cameron via [this message]
2022-11-21 16:47 ` Null dereference in bdrv_unregister_buf() probably memory-backend-file related? Stefan Hajnoczi
2022-11-21 17:29 ` Jonathan Cameron via
2022-11-21 21:03 ` Stefan Hajnoczi
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=20221121162132.00007540@huawei.com \
--to=qemu-devel@nongnu.org \
--cc=Jonathan.Cameron@huawei.com \
--cc=david@redhat.com \
--cc=hreitz@redhat.com \
--cc=imammedo@redhat.com \
--cc=kwolf@redhat.com \
--cc=linuxarm@huawei.com \
--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).