From nobody Mon May 6 12:21:45 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.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.133.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=1639394499; cv=none; d=zohomail.com; s=zohoarc; b=Z4m23LsKTUVGD9Q2ym5vc+uGBymwL8r3rcaK8RtObd3rlUfEeuPC50BPPjYBIhx93buFrr/YtxSZPg6zmlg5jG5XapwcwGpaF9nSCgv3eKi3d0IFQoUaMJyF7++WRNqqKaOZ9bbTfwjXk+G6+509fqpcmLUkqSHoCE0pK1oW87c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1639394499; 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=948n8s80ovC6KzsL118o4GzMxW93GtNFU45sJDULQME=; b=infnvYsHlzT3phlxobKyP1ewPh8pO8aj7s36HOBMT06bLtvUH+49vgVplcFw7Y5WMng6YDrp5wCtDK8CuQIfiZUL8C4tasWwU2MrDCdGWUyB14XoDMuFJPQH0qSnZEoTEDCWnbHgL1yLKsqGgBZhvSGtx5iHs5d40+LD+EOiu44= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.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.133.124]) by mx.zohomail.com with SMTPS id 1639394499477668.9755242947964; Mon, 13 Dec 2021 03:21:39 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-110-Fb-3g4f8NkGZMAJ2tD8qyA-1; Mon, 13 Dec 2021 06:21:35 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B0652101F007; Mon, 13 Dec 2021 11:21:30 +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 17EFB78342; Mon, 13 Dec 2021 11:21:29 +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 E01EB4BB7C; Mon, 13 Dec 2021 11:21:26 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1BDBLPJX018676 for ; Mon, 13 Dec 2021 06:21:25 -0500 Received: by smtp.corp.redhat.com (Postfix) id 00CC2100EBAD; Mon, 13 Dec 2021 11:21:25 +0000 (UTC) Received: from maggie.redhat.com (unknown [10.43.2.64]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7CB93101E591 for ; Mon, 13 Dec 2021 11:21:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1639394498; 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=948n8s80ovC6KzsL118o4GzMxW93GtNFU45sJDULQME=; b=gWrkp7LDQiwVqnbORZXwOkm4fl8uYUtYJ7T6eTtLZd/Kj4VbZM3R9iqHOZXMi34CqXZxhV dmfUZhtJ48DxtZFyxf3ItOh78MpJVFmqMSUVRi6M8lWS7iVCges3hNAPZlqwgM/j1z9bYS KQmhMlGvXDAe7trnH4/yBcVq/C4Jp0o= X-MC-Unique: Fb-3g4f8NkGZMAJ2tD8qyA-1 From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH] qemuProcessPrepareHost: Create domain private dirs as early as possible Date: Mon, 13 Dec 2021 12:21:16 +0100 Message-Id: <845f21cfcf1088ff4e754c980ebaf08febaf83f6.1639394476.git.mprivozn@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 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.13 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: 1639394500085100001 Content-Type: text/plain; charset="utf-8" As of ff024b60cc3 we are opening chardevs before starting QEMU. However, we also doing that before domain private directories are created. This leaves us impossible to create guest agent socket which lives under priv->channelTargetDir. While creating the dirs can be moved just before qemuProcessPrepareHostBackendChardev() it's better to do it as the very first step so that this kind of error is prevented in future. Fixes: ff024b60cc39d5d41b1e68728a00a47e103ec4dd Signed-off-by: Michal Privoznik Reviewed-by: J=C3=A1n Tomko Reviewed-by: Martin Kletzander --- src/qemu/qemu_process.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 4963ce383f..82d0af5549 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -7024,6 +7024,14 @@ qemuProcessPrepareHost(virQEMUDriver *driver, qemuDomainObjPrivate *priv =3D vm->privateData; g_autoptr(virQEMUDriverConfig) cfg =3D virQEMUDriverGetConfig(driver); =20 + /* + * Create all per-domain directories in order to make sure domain + * with any possible seclabels can access it. + */ + if (qemuProcessMakeDir(driver, vm, priv->libDir) < 0 || + qemuProcessMakeDir(driver, vm, priv->channelTargetDir) < 0) + return -1; + if (qemuPrepareNVRAM(driver, vm) < 0) return -1; =20 @@ -7085,14 +7093,6 @@ qemuProcessPrepareHost(virQEMUDriver *driver, return -1; } =20 - /* - * Create all per-domain directories in order to make sure domain - * with any possible seclabels can access it. - */ - if (qemuProcessMakeDir(driver, vm, priv->libDir) < 0 || - qemuProcessMakeDir(driver, vm, priv->channelTargetDir) < 0) - return -1; - VIR_DEBUG("Write domain masterKey"); if (qemuDomainWriteMasterKeyFile(driver, vm) < 0) return -1; --=20 2.32.0