From nobody Mon Feb 9 19:54:21 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.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; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1573857361; cv=none; d=zoho.com; s=zohoarc; b=O/XJJ/Gf1Fc31gUdueA/H/DuCVILH8IaVXni7EkO2qAI1hCB2RbUUPIDoa2UNRSToMD2Fs5+GXH02RJZLlWLcV5Ly0qi2ZftmL0Ug5akxnCIwJALp/c7LKHx5p/OKvQVqilC/zt7fMBk+Xsr4nBnDgt9NunvXn4vHZqKiDkq68M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1573857361; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=xpRt2bKJHxs5WpBFBkL7lknNLi+Y8CrPC3LLiBRxjdw=; b=ARr4zpF1ud+CXoHmFeRtEh6XB8JsdtHVZqYJwp/8GghhxjMb5MEks6nAJz4dkblGJVk5YJhza8VfG0IkUpQXkHOwavBeD+WxxOjsxCO5HXPZUBlSKygIw7xU07Q9SYeKtm/pAt9SebMVeRvuaCRMyXkqg4Ec8PBSwGtWYy8DQMQ= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1573857361401825.817180826959; Fri, 15 Nov 2019 14:36:01 -0800 (PST) Received: from localhost ([::1]:45402 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iVkC7-000602-SW for importer@patchew.org; Fri, 15 Nov 2019 17:35:59 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:56680) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iVk9f-0003lz-Jx for qemu-devel@nongnu.org; Fri, 15 Nov 2019 17:33:28 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iVk9e-0000mk-Io for qemu-devel@nongnu.org; Fri, 15 Nov 2019 17:33:27 -0500 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:51573 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iVk9e-0000mJ-Fb for qemu-devel@nongnu.org; Fri, 15 Nov 2019 17:33:26 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-150-GAOzM_JNM8aSMLwCrfx42w-1; Fri, 15 Nov 2019 17:33:22 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 0D7B41883523; Fri, 15 Nov 2019 22:33:21 +0000 (UTC) Received: from thinkpad.redhat.com (ovpn-116-194.ams2.redhat.com [10.36.116.194]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8218375E39; Fri, 15 Nov 2019 22:33:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1573857205; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=xpRt2bKJHxs5WpBFBkL7lknNLi+Y8CrPC3LLiBRxjdw=; b=Gmz3lTv89/hkTsHKjI4c/t9wLcPOgTt4LEPandzmswyQwpYUJWb2q4Lk7zph+kICbHxgTC kbXJIOM21+40zrKLQh+9RWWwJjag92m0U+E9g4sw0kG0yp74jdrtGuxkzYUYwEaglXRVZc UnySxHiEyneQZaTldTp4PEcb4vCtUoo= From: Laurent Vivier To: qemu-devel@nongnu.org Subject: [PULL 3/6] ppc: Skip partially initialized vCPUs in 'info pic' Date: Fri, 15 Nov 2019 23:33:09 +0100 Message-Id: <20191115223312.204979-4-lvivier@redhat.com> In-Reply-To: <20191115223312.204979-1-lvivier@redhat.com> References: <20191115223312.204979-1-lvivier@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-MC-Unique: GAOzM_JNM8aSMLwCrfx42w-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 205.139.110.120 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-ppc@nongnu.org, Greg Kurz , Mark Cave-Ayland , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Greg Kurz CPU_FOREACH() can race with vCPU hotplug/unplug on sPAPR machines, ie. we may try to print out info about a vCPU with a NULL presenter pointer. Check that in order to prevent QEMU from crashing. Signed-off-by: Greg Kurz Message-Id: <157192725327.3146912.12047076483178652551.stgit@bahia.lan> Signed-off-by: David Gibson --- hw/intc/xics.c | 11 ++++++++++- hw/intc/xive.c | 11 ++++++++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/hw/intc/xics.c b/hw/intc/xics.c index 5f746079be46..e7ac9ba618fa 100644 --- a/hw/intc/xics.c +++ b/hw/intc/xics.c @@ -44,7 +44,16 @@ =20 void icp_pic_print_info(ICPState *icp, Monitor *mon) { - int cpu_index =3D icp->cs ? icp->cs->cpu_index : -1; + int cpu_index; + + /* Skip partially initialized vCPUs. This can happen on sPAPR when vCP= Us + * are hot plugged or unplugged. + */ + if (!icp) { + return; + } + + cpu_index =3D icp->cs ? icp->cs->cpu_index : -1; =20 if (!icp->output) { return; diff --git a/hw/intc/xive.c b/hw/intc/xive.c index 952a461d5329..75dce82fb205 100644 --- a/hw/intc/xive.c +++ b/hw/intc/xive.c @@ -523,9 +523,18 @@ static const char * const xive_tctx_ring_names[] =3D { =20 void xive_tctx_pic_print_info(XiveTCTX *tctx, Monitor *mon) { - int cpu_index =3D tctx->cs ? tctx->cs->cpu_index : -1; + int cpu_index; int i; =20 + /* Skip partially initialized vCPUs. This can happen on sPAPR when vCP= Us + * are hot plugged or unplugged. + */ + if (!tctx) { + return; + } + + cpu_index =3D tctx->cs ? tctx->cs->cpu_index : -1; + if (kvm_irqchip_in_kernel()) { Error *local_err =3D NULL; =20 --=20 2.23.0