From nobody Mon Feb 9 04:45:54 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.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 170.10.129.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=1674831923; cv=none; d=zohomail.com; s=zohoarc; b=VxEhbAECJ3VT/qNZEB/oEln0uGC+OGFxWn5rvkRfYWibWfyPjlnhdQlpSSuyXPd2pZU3Yi8Ug408Q6Y0Dm9AnYW+B/w7M0dUpGzw+twqEN1XUqJhefpOYfA/noVSUH0r34+BwBcWAFVmu7Ul7WfCvezQJMlAgUZ/Wq0m2UkocLw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1674831923; 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=l8PpY6j4+08sbA7lqMLBt9l2fC5pSyztZlb6liz6wfk=; b=VRqbXBgYcEt4LEzktkLStU/w17qJONGqon0skjP6mK7XiilY05wbWpxRrUqRV5kmT18ki3/Ypegox91hNlrjrr249ZzI0d4Uj8RCO1OyNi2HV06nKcCEdVOjUlLrYF5c7+/Hw/RsxBhL4aMEAqim4XiWGSnZqRMLz+p09IecYbk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.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 [170.10.129.124]) by mx.zohomail.com with SMTPS id 1674831923008281.5177863312224; Fri, 27 Jan 2023 07:05:23 -0800 (PST) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-179-oxU2XMp2PSClwKfVmFQV3A-1; Fri, 27 Jan 2023 10:05:19 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 75A231875042; Fri, 27 Jan 2023 15:05:14 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5FD3040C200D; Fri, 27 Jan 2023 15:05:14 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 539EA194658D; Fri, 27 Jan 2023 15:05:14 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id A7D4B194658C for ; Fri, 27 Jan 2023 15:05:11 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 8DD9F18EC1; Fri, 27 Jan 2023 15:05:11 +0000 (UTC) Received: from maggie.redhat.com (unknown [10.43.2.39]) by smtp.corp.redhat.com (Postfix) with ESMTP id 34CD27AD4 for ; Fri, 27 Jan 2023 15:05:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1674831922; 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=l8PpY6j4+08sbA7lqMLBt9l2fC5pSyztZlb6liz6wfk=; b=Hx1wk0E8LUTr9YyF6dAZB1T0eoAbWdYJxiWjPKh/E8LdmqpTNmj7EwmjTpX5u/5qtUyGl4 LNS///IM/dwbT52S9mgaVXAr6qSJQNjvkEuK48hpH/GFhskzDEx1OijPOvKMTsMk75S5Dg UaAcJrAX6XdYkQifCEQZClrCqvYYifM= X-MC-Unique: oxU2XMp2PSClwKfVmFQV3A-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 2/3] qemuExtTPMStop: Restore TPM state label more often Date: Fri, 27 Jan 2023 16:05:07 +0100 Message-Id: <807005cffcbaaf4d41d7c6d12b5a11c9f0dbdaad.1674831875.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 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: 1674831924535100002 Content-Type: text/plain; charset="utf-8"; x-default="true" When stopping swtpm we can restore the label either on just the swtpm's domain specific logfile (/var/log/swtpm/libvirt/qemu/...), or on the logfile and the state too (/var/lib/libvirt/swtpm/...). The deciding factor is whether the guest is stopped because of outgoing migration OR the state is on a shared filesystem. But this is not correct condition, because for instance saving the guest into a file (virsh save) is also an outgoing migration. Alternatively, when the swtpm state is stored on a shared filesystem, but the guest is destroyed (virsh destroy), i.e. stopped because of different reason than migration, we want to restore the seclabels. The correct condition is: skip restoring the state on outgoing migration AND shared filesystem. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=3D2161557 Signed-off-by: Michal Privoznik --- src/qemu/qemu_tpm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/qemu/qemu_tpm.c b/src/qemu/qemu_tpm.c index b2748eb6a4..5831ffc32e 100644 --- a/src/qemu/qemu_tpm.c +++ b/src/qemu/qemu_tpm.c @@ -1142,7 +1142,7 @@ qemuExtTPMStop(virQEMUDriver *driver, return; =20 qemuTPMEmulatorStop(cfg->swtpmStateDir, shortName); - if (outgoingMigration || qemuTPMHasSharedStorage(vm->def)) + if (outgoingMigration && qemuTPMHasSharedStorage(vm->def)) restoreTPMStateLabel =3D false; =20 if (qemuSecurityRestoreTPMLabels(driver, vm, restoreTPMStateLabel) < 0) --=20 2.39.1