From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6A3E2C2D0DE for ; Thu, 2 Jan 2020 02:10:06 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3C3D521734 for ; Thu, 2 Jan 2020 02:10:06 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3C3D521734 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.alibaba.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:35646 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1impw5-0006xl-Eo for qemu-devel@archiver.kernel.org; Wed, 01 Jan 2020 21:10:05 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:41726) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1impvO-0006Wm-IS for qemu-devel@nongnu.org; Wed, 01 Jan 2020 21:09:23 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1impvJ-0000NG-RF for qemu-devel@nongnu.org; Wed, 01 Jan 2020 21:09:18 -0500 Received: from out4436.biz.mail.alibaba.com ([47.88.44.36]:18530) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1impvJ-0000Bg-HK for qemu-devel@nongnu.org; Wed, 01 Jan 2020 21:09:17 -0500 X-Alimail-AntiSpam: AC=PASS; BC=-1|-1; BR=01201311R421e4; CH=green; DM=||false|; DS=||; FP=0|-1|-1|-1|0|-1|-1|-1; HT=e01e07486; MF=eguan@linux.alibaba.com; NM=1; PH=DS; RN=3; SR=0; TI=SMTPD_---0TmXLrqa_1577930930; Received: from localhost(mailfrom:eguan@linux.alibaba.com fp:SMTPD_---0TmXLrqa_1577930930) by smtp.aliyun-inc.com(127.0.0.1); Thu, 02 Jan 2020 10:08:50 +0800 Date: Thu, 2 Jan 2020 10:08:50 +0800 From: Eryu Guan To: Igor Mammedov Subject: Re: [BUG qemu 4.0] segfault when unplugging virtio-blk-pci device Message-ID: <20200102020850.GB41863@e18g06458.et15sqa> References: <20191231103434.GA41863@e18g06458.et15sqa> <20191231115136.7b967604@Igors-MacBook-Pro> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20191231115136.7b967604@Igors-MacBook-Pro> User-Agent: Mutt/1.5.21 (2010-09-15) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 47.88.44.36 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" On Tue, Dec 31, 2019 at 11:51:35AM +0100, Igor Mammedov wrote: > On Tue, 31 Dec 2019 18:34:34 +0800 > Eryu Guan 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=) 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=, > >     i1=) 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