From nobody Sun May 12 08:30:37 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1669047728; cv=none; d=zohomail.com; s=zohoarc; b=UdDLil/d4lbT24UBrQs0wPyaFYKFc5i1yc5LpCKwrV3pjoPtNYpRW9Rlge6fFv3ZjpaBFNetbYkth00TOsclDdHEhXn0ZN/bX5CKBUmL4MmYm6hwXvuUMjfDrrjOjM2S1c3653QQWYwjudDnlcYvgH8l4sALLRr6E0rkT2rS/ck= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1669047728; h=Content-Type:Content-Transfer-Encoding:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Sender:Subject:To; bh=lgcylgtDgLjbj4oi0/Y0Y5+IGq7w8pL948au3xJAlRQ=; b=cPonDnbLvTXXj/91mKWox/QLaUPOFELMsJCkk3HpDO1cGiQ8scYy1hhl8DmGZzh13jePNUcZxYGQLVN4lxpM2VEin+WLhIz/ZfHA1LY0fM81xjF/84gVrcFNiwr8HA2G9NIb2deB5cxngOmutLs0lGJZVOq0c3sgKzPxghJEyPg= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1669047728611871.5992557102501; Mon, 21 Nov 2022 08:22:08 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ox9YR-0006PE-Lg; Mon, 21 Nov 2022 11:21:56 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ox9YO-0006OT-Uj for qemu-devel@nongnu.org; Mon, 21 Nov 2022 11:21:52 -0500 Received: from frasgout.his.huawei.com ([185.176.79.56]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ox9YJ-0008K6-H5 for qemu-devel@nongnu.org; Mon, 21 Nov 2022 11:21:52 -0500 Received: from fraeml738-chm.china.huawei.com (unknown [172.18.147.207]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4NGCHz4CC5z682wj; Tue, 22 Nov 2022 00:18:55 +0800 (CST) Received: from lhrpeml500005.china.huawei.com (7.191.163.240) by fraeml738-chm.china.huawei.com (10.206.15.219) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Mon, 21 Nov 2022 17:21:34 +0100 Received: from localhost (10.122.247.231) by lhrpeml500005.china.huawei.com (7.191.163.240) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Mon, 21 Nov 2022 16:21:33 +0000 Date: Mon, 21 Nov 2022 16:21:32 +0000 To: , Hanna Reitz , Stefan Hajnoczi , Kevin Wolf , , David Hildenbrand , Igor Mammedov Subject: Null dereference in bdrv_unregister_buf() probably memory-backend-file related? Message-ID: <20221121162132.00007540@huawei.com> Organization: Huawei Technologies R&D (UK) Ltd. X-Mailer: Claws Mail 4.0.0 (GTK+ 3.24.29; x86_64-w64-mingw32) MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.122.247.231] X-ClientProxiedBy: lhrpeml500004.china.huawei.com (7.191.163.9) To lhrpeml500005.china.huawei.com (7.191.163.240) X-CFilter-Loop: Reflected Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=185.176.79.56; envelope-from=jonathan.cameron@huawei.com; helo=frasgout.his.huawei.com X-Spam_score_int: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-to: Jonathan Cameron From: Jonathan Cameron via Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZM-MESSAGEID: 1669047729198100001 Content-Type: text/plain; charset="utf-8" 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=3Dnone,file=3Dfull.qcow2,format=3Dqcow2,id=3Dhd \ -device virtio-blk,drive=3Dhd \ -object memory-backend-file,id=3Dcxl-mem1,mem-path=3D/tmp/cxltest.raw,s= ize=3D256M,align=3D256M \ 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.