qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eryu Guan <eguan@linux.alibaba.com>
To: Igor Mammedov <imammedo@redhat.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [BUG qemu 4.0] segfault when unplugging virtio-blk-pci device
Date: Thu, 2 Jan 2020 10:08:50 +0800	[thread overview]
Message-ID: <20200102020850.GB41863@e18g06458.et15sqa> (raw)
In-Reply-To: <20191231115136.7b967604@Igors-MacBook-Pro>

On Tue, Dec 31, 2019 at 11:51:35AM +0100, Igor Mammedov wrote:
> On Tue, 31 Dec 2019 18:34:34 +0800
> Eryu Guan <eguan@linux.alibaba.com> wrote:
> 
> > Hi,
> > 
> > I'm using qemu 4.0 and hit segfault when tearing down kata sandbox, I
> > think it's because io completion hits use-after-free when device is
> > already gone. Is this a known bug that has been fixed? (I went through
> > the git log but didn't find anything obvious).
> > 
> > gdb backtrace is:
> > 
> > Core was generated by `/usr/local/libexec/qemu-kvm -name sandbox-5b8df8c6c6901c3c0a9b02879be10fe8d69d6'.
> > Program terminated with signal 11, Segmentation fault.
> > #0 object_get_class (obj=obj@entry=0x0) at /usr/src/debug/qemu-4.0/qom/object.c:903
> > 903        return obj->class;
> > (gdb) bt
> > #0  object_get_class (obj=obj@entry=0x0) at /usr/src/debug/qemu-4.0/qom/object.c:903
> > #1  0x0000558a2c009e9b in virtio_notify_vector (vdev=0x558a2e7751d0,
> >     vector=<optimized out>) at /usr/src/debug/qemu-4.0/hw/virtio/virtio.c:1118
> > #2  0x0000558a2bfdcb1e in virtio_blk_discard_write_zeroes_complete (
> >     opaque=0x558a2f2fd420, ret=0)
> >     at /usr/src/debug/qemu-4.0/hw/block/virtio-blk.c:186
> > #3  0x0000558a2c261c7e in blk_aio_complete (acb=0x558a2eed7420)
> >     at /usr/src/debug/qemu-4.0/block/block-backend.c:1305
> > #4  0x0000558a2c3031db in coroutine_trampoline (i0=<optimized out>,
> >     i1=<optimized out>) at /usr/src/debug/qemu-4.0/util/coroutine-ucontext.c:116
> > #5  0x00007f45b2f8b080 in ?? () from /lib64/libc.so.6
> > #6  0x00007fff9ed75780 in ?? ()
> > #7  0x0000000000000000 in ?? ()
> > 
> > It seems like qemu was completing a discard/write_zero request, but
> > parent BusState was already freed & set to NULL.
> > 
> > Do we need to drain all pending request before unrealizing virtio-blk
> > device? Like the following patch proposed?
> > 
> > https://lists.gnu.org/archive/html/qemu-devel/2017-06/msg02945.html
> > 
> > If more info is needed, please let me know.
> 
> may be this will help: https://patchwork.kernel.org/patch/11213047/

Yeah, this looks promising! I'll try it out (though it's a one-time
crash for me). Thanks!

Eryu


  reply	other threads:[~2020-01-02  2:10 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-31 10:34 [BUG qemu 4.0] segfault when unplugging virtio-blk-pci device Eryu Guan
2019-12-31 10:51 ` Igor Mammedov
2020-01-02  2:08   ` Eryu Guan [this message]
2020-01-07 13:06     ` Eryu Guan
2020-01-07 14:01       ` Julia Suvorova
2020-01-08  1:54         ` Eryu Guan
2020-01-09  4:58         ` Eryu Guan
2020-01-13 16:38           ` Stefan Hajnoczi
2020-01-14  2:50             ` Eryu Guan
2020-01-14 16:16               ` Stefan Hajnoczi
2020-01-19  8:13                 ` Eryu Guan

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=20200102020850.GB41863@e18g06458.et15sqa \
    --to=eguan@linux.alibaba.com \
    --cc=imammedo@redhat.com \
    --cc=qemu-devel@nongnu.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 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).