From nobody Wed Apr 24 07:33:54 2024 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; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com 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 163151833497742.6366510344003; Mon, 13 Sep 2021 00:32:14 -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-17-Rmv9gjf-NrG1aZWG88Xesg-1; Mon, 13 Sep 2021 03:32:12 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 7D8A169722; Mon, 13 Sep 2021 07:32:07 +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 0675D19724; Mon, 13 Sep 2021 07:32: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 0203A4EA2F; Mon, 13 Sep 2021 07:32:06 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 18D7W4Iw002547 for ; Mon, 13 Sep 2021 03:32:04 -0400 Received: by smtp.corp.redhat.com (Postfix) id F32272167D88; Mon, 13 Sep 2021 07:32:03 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast04.extmail.prod.ext.rdu2.redhat.com [10.11.55.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id EE0132167D84 for ; Mon, 13 Sep 2021 07:31:56 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 560B0100B8C3 for ; Mon, 13 Sep 2021 07:31:56 +0000 (UTC) Received: from hazel.ad.blazis.com (mail.blazis.com [96.30.196.7]) by relay.mimecast.com with ESMTP id us-mta-243-koU7aXGXMYmevOEyOWJJ_Q-1; Mon, 13 Sep 2021 03:31:54 -0400 Received: from blazis.com (oak.ad.blazis.com [172.16.0.4]) by hazel.ad.blazis.com (Postfix) with ESMTP id CF316224A18 for ; Mon, 13 Sep 2021 02:25:06 -0500 (CDT) Received: from root (uid 0) (envelope-from root@blazis.com) id 9d514 by blazis.com (DragonFly Mail Agent v0.13); Mon, 13 Sep 2021 01:18:06 -0500 X-MC-Unique: Rmv9gjf-NrG1aZWG88Xesg-1 X-MC-Unique: koU7aXGXMYmevOEyOWJJ_Q-1 From: Nick Chevsky To: libvir-list@redhat.com Subject: [PATCH 1/1] qemu_tpm: Start swtpm(8) daemon with --terminate switch Date: Mon, 13 Sep 2021 01:16:18 -0500 Message-Id: <20210913061618.4019652-2-nchevsky@gmail.com> In-Reply-To: <20210913061618.4019652-1-nchevsky@gmail.com> References: <20210913061618.4019652-1-nchevsky@gmail.com> MIME-Version: 1.0 X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id 18D7W4Iw002547 X-loop: libvir-list@redhat.com Cc: Nick Chevsky 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.84 on 10.5.11.23 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-ZM-MESSAGEID: 1631518337086100003 Content-Type: text/plain; charset="utf-8" Launch swtpm(8) with the --terminate switch, which guarantees that the daemon will shut itself down when QEMU dies (current behavior). We had so far been getting this "for free" (i.e. without --terminate) due to a defect in upstream's connection handling logic [1], on which libvirt should not rely since it will eventually be fixed. Adding --terminate preserves and guarantees the current behavior. [1] https://github.com/stefanberger/swtpm/pull/509 Signed-off-by: Nick Chevsky Reviewed-by: Michal Privoznik --- src/qemu/qemu_tpm.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/qemu/qemu_tpm.c b/src/qemu/qemu_tpm.c index 477a26dc69..100481503c 100644 --- a/src/qemu/qemu_tpm.c +++ b/src/qemu/qemu_tpm.c @@ -576,6 +576,8 @@ qemuTPMEmulatorBuildCommand(virDomainTPMDef *tpm, virCommandAddArg(cmd, "--log"); virCommandAddArgFormat(cmd, "file=3D%s", tpm->data.emulator.logfile); =20 + virCommandAddArg(cmd, "--terminate"); + virCommandSetUID(cmd, swtpm_user); virCommandSetGID(cmd, swtpm_group); =20 --=20 2.30.2