From nobody Fri May 3 12:19:38 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) client-ip=207.211.31.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1597155740; cv=none; d=zohomail.com; s=zohoarc; b=KwWKIG0Rifci5os3hqAP+RIZ1Skh3D0lya62UWawZlewJmWSwiJwU4FhACrgeG1apFXSCz875/o/4AfHOfugYD1EmdBgMTswnYDOjeLieL45EPfue4QZsx8u2l7ArNe40lQyj3bFJu7h5zJDy+1HSNhF03z5YYsWmr09nIHAMXY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1597155740; h=Content-Type:Content-Transfer-Encoding:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=zZOuxIqxcgbW9z/KEeprtbfb6x5KRnlvE1ZXVNXRjXo=; b=bbXL55LWXSrJqpqe8dLFxbSxritGuXy9elspVwCW+GT4Odnueg+eezgJYaHJD+FXGhancavBAAVivDvrxV4e1W/irQhaPUdJhMExyn/aW0Uxa5HTOw1oIsV5VM1wtrBIC+6vG6GDIeqz1XoTXk0Hw7GV1Z9NNdQRu1q6vdfM3jg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by mx.zohomail.com with SMTPS id 159715574049024.417381409047493; Tue, 11 Aug 2020 07:22:20 -0700 (PDT) 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-287-8sOUFJ6IP2uDxi5NZeCYVw-1; Tue, 11 Aug 2020 10:22:17 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 34E9B1005510; Tue, 11 Aug 2020 14:22:10 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0EBB971922; Tue, 11 Aug 2020 14:22:07 +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 44A7BA553C; Tue, 11 Aug 2020 14:22:05 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 07BEM3wu016109 for ; Tue, 11 Aug 2020 10:22:03 -0400 Received: by smtp.corp.redhat.com (Postfix) id EB8A1108AA; Tue, 11 Aug 2020 14:22:03 +0000 (UTC) Received: from antique-work.redhat.com (unknown [10.40.195.59]) by smtp.corp.redhat.com (Postfix) with ESMTP id 685EE19C71 for ; Tue, 11 Aug 2020 14:22:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1597155739; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=zZOuxIqxcgbW9z/KEeprtbfb6x5KRnlvE1ZXVNXRjXo=; b=OvbXQnkE1nETsIVaa1CKi2KT5HGHd7TGhXl70aURtCzWThBMSvcnAMH+1jnYYOsqI6hr6k 533oQ0er2SmBN5CCBzuvLNMbmUs+ReztQ7LMMJbIv/ARV7xBl+JK6RzOusnagICwGS3HRa JZ48fZ6Ad59ZxU6OqCudYrui/V576jM= X-MC-Unique: 8sOUFJ6IP2uDxi5NZeCYVw-1 From: Pavel Hrdina To: libvir-list@redhat.com Subject: [libvirt PATCH] qemu: fix crash in qemuDomainSetBlkioParameters without cgroups Date: Tue, 11 Aug 2020 16:21:59 +0200 Message-Id: <1b4c5b5dcd1a28a1d7875f9060698a34d07dbae7.1597155712.git.phrdina@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" If we don't have cgroups available and user tries to update blkio parameters for running VM it will crash. It should have been protected by the virCgroupHasController() check but it was never called if the API was executed without any flags. We call virDomainObjGetDefs() which sets `def` and `persistentDef` based on the flags and these two variables should be used to figure out if we need to update LIVE, CONFIG or both states. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=3D1808293 Signed-off-by: Pavel Hrdina Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_driver.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 07e9518a9b..8008da6d16 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -9356,7 +9356,7 @@ qemuDomainSetBlkioParameters(virDomainPtr dom, if (virDomainObjGetDefs(vm, flags, &def, &persistentDef) < 0) goto endjob; =20 - if (flags & VIR_DOMAIN_AFFECT_LIVE) { + if (def) { if (!virCgroupHasController(priv->cgroup, VIR_CGROUP_CONTROLLER_BL= KIO)) { virReportError(VIR_ERR_OPERATION_INVALID, "%s", _("blkio cgroup isn't mounted")); --=20 2.26.2