From nobody Fri Apr 26 11:28:12 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 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=1631209779; cv=none; d=zohomail.com; s=zohoarc; b=ML8RwpSQC7Ix9tF9aNGHkbwqyQOE1+Kyykevq6Tt42ic9EboUSyHXFE9Op9cszUXPn5vuaJjeknFzp//XnaiY71rw9ddp4IbSQBmw4F0W6qanJWMi6mHHiu9VP/lk+P8yg6EYTYhMj7rr+uGGIi6aRajQh9fS0Qn59XdcB3Rjzk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1631209779; h=Content-Type:Content-Transfer-Encoding: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=CaJo7mzd9K0A+Q5G9l7PAdpBFiYeaavv4KL+f18SPgs=; b=BqIoDMLN9bOkLKcdBNEu4yGDniRWt9Vw7UvKRh02cOOPIhtMVDY6b+QM9DTlbJ+RE7Q6445FGuNHg340Bgv7DIDzrUzvjqSJPtG1OdEEtpU4iqd7Fb2QxuK3dU4cxZIs63tflDL9j+RvGq8k6k8pu7MxbZQc9OuBLlGIlhi8Fic= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 163120977946664.65878473765656; Thu, 9 Sep 2021 10:49:39 -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-457-NIT2Sd9hNV68a5zn_0yXxA-1; Thu, 09 Sep 2021 13:49:37 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 0F973EC1B2; Thu, 9 Sep 2021 17:49:32 +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 DE4465FCD1; Thu, 9 Sep 2021 17:49:31 +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 9A3F74EA2F; Thu, 9 Sep 2021 17:49:31 +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 189HkgjB019315 for ; Thu, 9 Sep 2021 13:46:42 -0400 Received: by smtp.corp.redhat.com (Postfix) id ACE931ABD8; Thu, 9 Sep 2021 17:46:42 +0000 (UTC) Received: from vhost3.router.laine.org (ovpn-112-70.phx2.redhat.com [10.3.112.70]) by smtp.corp.redhat.com (Postfix) with ESMTP id 701AD5D6CF for ; Thu, 9 Sep 2021 17:46:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1631209778; 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: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=CaJo7mzd9K0A+Q5G9l7PAdpBFiYeaavv4KL+f18SPgs=; b=OnG6GX1XJNfwcGCU6o8TFxoc4tAgFH8nh1k1TJPDkgfH1j1EtA6XySDsnNENGLy/aOQXh+ nj0QEbfILrsWron+QHt5/uBFDLMqnjZgiBPzEfF4ksddqvqFMtr1e3RIxKE2loEYsNLZB2 HteofVlkn/3y7IN+zbPDgoCF0N3MxEY= X-MC-Unique: NIT2Sd9hNV68a5zn_0yXxA-1 From: Laine Stump To: libvir-list@redhat.com Subject: [libvirt PATCH 1/2] conf: reformat virDomainDefCompatibleDevice for upcoming additional check Date: Thu, 9 Sep 2021 13:46:40 -0400 Message-Id: <20210909174641.131003-2-laine@redhat.com> In-Reply-To: <20210909174641.131003-1-laine@redhat.com> References: <20210909174641.131003-1-laine@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 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.12 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) X-ZM-MESSAGEID: 1631209780254100001 Content-Type: text/plain; charset="utf-8" The next patch will add another check similar to the existing check for a change in alias name. This patch reformats the code in preparation so that the next patch's purpose will be clear. Signed-off-by: Laine Stump --- src/conf/domain_conf.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index cb9e7218ff..fefc527901 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -28477,13 +28477,14 @@ virDomainDefCompatibleDevice(virDomainDef *def, data.oldInfo =3D virDomainDeviceGetInfo(oldDev); =20 if (action =3D=3D VIR_DOMAIN_DEVICE_ACTION_UPDATE && - live && - (data.newInfo && data.oldInfo && - data.newInfo->alias && data.oldInfo->alias && - STRNEQ(data.newInfo->alias, data.oldInfo->alias))) { - virReportError(VIR_ERR_OPERATION_DENIED, "%s", - _("changing device alias is not allowed")); - return -1; + live && data.newInfo && data.oldInfo) { + + if (data.newInfo->alias && data.oldInfo->alias && + STRNEQ(data.newInfo->alias, data.oldInfo->alias)) { + virReportError(VIR_ERR_OPERATION_DENIED, "%s", + _("changing device alias is not allowed")); + return -1; + } } =20 if (!virDomainDefHasUSB(def) && --=20 2.31.1 From nobody Fri Apr 26 11:28:12 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 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=1631209741; cv=none; d=zohomail.com; s=zohoarc; b=eFZfUINqxTuBz9azxRHRUdqNu15gr+WIukWh/SSkTqusCEzEHKDNYDl6eWCZosqb4RDdTHR6lrxGYTj//pW+hmR44btwN08L+KAXizs7ScPt7DUkm+dUSLmomUsF5QVhw7iS90cMlJlwYEAQmvBmgiFF5vdc5xR4kU0v8Oobkk8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1631209741; h=Content-Type:Content-Transfer-Encoding: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=rLkCANmlMTw5evylAZ5/+xFbFkBW48fUJGI6+a1vvPQ=; b=NFcO8KvgF7dujF7FuGrfq3WGEj9+wrKGxpecJ7bfhTEvyKcojrUhzS+qqgW17scKj6MFlpBp5qR+zXKbsKEK5J0WbAYA0eecNIQaAdvp28dRICwb7fVRKTV4CyR9UaQw5ieAVu4qV05xTn98EJwC77AsXKy/2nIdkg+YYq8qY7g= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1631209741832317.9198378848098; Thu, 9 Sep 2021 10:49:01 -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-407-P9_XwsRSOSepWQz5UA7q-g-1; Thu, 09 Sep 2021 13:48:58 -0400 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 442B4800493; Thu, 9 Sep 2021 17:48:53 +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 E7ECD4180; Thu, 9 Sep 2021 17:48:52 +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 509251800FE4; Thu, 9 Sep 2021 17:48:52 +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 189HkhfW019320 for ; Thu, 9 Sep 2021 13:46:43 -0400 Received: by smtp.corp.redhat.com (Postfix) id 1B4C75D6CF; Thu, 9 Sep 2021 17:46:43 +0000 (UTC) Received: from vhost3.router.laine.org (ovpn-112-70.phx2.redhat.com [10.3.112.70]) by smtp.corp.redhat.com (Postfix) with ESMTP id D283F188E4 for ; Thu, 9 Sep 2021 17:46:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1631209740; 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: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=rLkCANmlMTw5evylAZ5/+xFbFkBW48fUJGI6+a1vvPQ=; b=DpdyIXvbKl/oD592r3lddZYAmOvU72ySPJCVU45WmZmP49QZHuC0fcVfMTd4Gbl8nF8BrR WENzLCSDno7dKoTtRw+VDeP1htGUOYL3gxbrFsxa7nm8jZFKh8NoRMwxdV96nA0jB35/8d l6AEhqUDNKUmMAvYnGoATDVzCWC8Ggc= X-MC-Unique: P9_XwsRSOSepWQz5UA7q-g-1 From: Laine Stump To: libvir-list@redhat.com Subject: [libvirt PATCH 2/2] conf: log error on attempts to modify ACPI index of active device Date: Thu, 9 Sep 2021 13:46:41 -0400 Message-Id: <20210909174641.131003-3-laine@redhat.com> In-Reply-To: <20210909174641.131003-1-laine@redhat.com> References: <20210909174641.131003-1-laine@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 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.11 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) X-ZM-MESSAGEID: 1631209744110100001 Content-Type: text/plain; charset="utf-8" The ACPI index of a device in a running guest can't be modified, and libvirt doesn't actually attempt to modify it, but it was possible for a user to request such a modification, and libvirt wouldn't complain, thus misleading the user into thinking that it had actually been changed. Resolves: https://bugzilla.redhat.com/1998920 Signed-off-by: Laine Stump Reviewed-by: Michal Privoznik --- src/conf/domain_conf.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index fefc527901..7ff890d8b7 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -28485,6 +28485,12 @@ virDomainDefCompatibleDevice(virDomainDef *def, _("changing device alias is not allowed")); return -1; } + + if (data.newInfo->acpiIndex !=3D data.oldInfo->acpiIndex) { + virReportError(VIR_ERR_OPERATION_DENIED, "%s", + _("changing device 'acpi index' is not allowed"= )); + return -1; + } } =20 if (!virDomainDefHasUSB(def) && --=20 2.31.1