From nobody Sat Apr 27 13:09:09 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1496133698295132.30624047523315; Tue, 30 May 2017 01:41:38 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A320885545; Tue, 30 May 2017 08:41:35 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id BB36019EE9; Tue, 30 May 2017 08:41:33 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 5D885180BAF4; Tue, 30 May 2017 08:41:30 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v4U8f0MV014573 for ; Tue, 30 May 2017 04:41:00 -0400 Received: by smtp.corp.redhat.com (Postfix) id 6D61E183C4; Tue, 30 May 2017 08:41:00 +0000 (UTC) Received: from beluga.usersys.redhat.com (dhcp129-94.brq.redhat.com [10.34.129.94]) by smtp.corp.redhat.com (Postfix) with ESMTP id C32FA183B9; Tue, 30 May 2017 08:40:57 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com A320885545 Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=libvir-list-bounces@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com A320885545 From: Erik Skultety To: libvir-list@redhat.com Date: Tue, 30 May 2017 10:41:17 +0200 Message-Id: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Cc: Erik Skultety Subject: [libvirt] [PATCH] qemu:json: Fix daemon crash on handling domain shutdown event X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Tue, 30 May 2017 08:41:36 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" commit a8eba5036 added further checking of the guest shutdown cause, but this enhancement is available since qemu 2.10, causing a crash because of a NULL pointer dereference on older qemus. Thread 1 "libvirtd" received signal SIGSEGV, Segmentation fault. 0x00007ffff72441af in virJSONValueObjectGet (object=3D0x0, key=3D0x7fffd5ef11bf "guest") at util/virjson.c:769 769 if (object->type !=3D VIR_JSON_TYPE_OBJECT) (gdb) bt 0 in virJSONValueObjectGet 1 in virJSONValueObjectGetBoolean 2 in qemuMonitorJSONHandleShutdown 3 in qemuMonitorJSONIOProcessEvent 4 in qemuMonitorJSONIOProcessLine 5 in qemuMonitorJSONIOProcess 6 in qemuMonitorIOProcess 7 in qemuMonitorIO 8 in virEventPollDispatchHandles 9 in virEventPollRunOnce 10 in virEventRunDefaultImpl 11 in virNetDaemonRun 12 in main Signed-off-by: Erik Skultety --- src/qemu/qemu_monitor_json.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index 757595dd7..f208dd05a 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -528,7 +528,7 @@ static void qemuMonitorJSONHandleShutdown(qemuMonitorPt= r mon, virJSONValuePtr da bool guest =3D false; virTristateBool guest_initiated =3D VIR_TRISTATE_BOOL_ABSENT; =20 - if (virJSONValueObjectGetBoolean(data, "guest", &guest) =3D=3D 0) + if (data && virJSONValueObjectGetBoolean(data, "guest", &guest) =3D=3D= 0) guest_initiated =3D guest ? VIR_TRISTATE_BOOL_YES : VIR_TRISTATE_B= OOL_NO; =20 qemuMonitorEmitShutdown(mon, guest_initiated); --=20 2.13.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list