From nobody Sun Feb 8 17:41:48 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 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=1595410879; cv=none; d=zohomail.com; s=zohoarc; b=Q8nf8m1YTzykKZHXfm9LbPwVwl0BfehOI27APRmGq+9qO7lCGVERJ9FxO6JElmPfbQYlE9NWu7U2ADtxtCoLwi06A3izd9U8jUlfeO2u55uNWHYRg7XCmpUEUyOSanNUNjifhkpjJr2MMvutn6dR0T6V2iAfroslXqCFg8QhX1g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1595410879; 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=jbbZHnlOf8fxjIWNaQAW22PXfp3Aqi0pxagpzY0t2lM=; b=dln/7UojsHq83xU7bNdA2oAm/ROUqYM9n9yT3EJKGens4TCpSCRiH89VtbUPgDgam9dFAKT3srv6LXH8ZLzSn9QaqJ9DCdKew2H91xXWiGS6egud3O0By+0nEM06YyGirpVXFZ7pXLAP4d32FSZVI2iuUhEvKMPGN8A7fC+1XsI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 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-delivery-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 1595410879730131.0751794763538; Wed, 22 Jul 2020 02:41:19 -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-215-wBm110sJNEWIkmYcZXyy2w-1; Wed, 22 Jul 2020 05:41:16 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 7B2B291276; Wed, 22 Jul 2020 09:41:11 +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 5B6995D9CA; Wed, 22 Jul 2020 09:41:11 +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 2C009730E9; Wed, 22 Jul 2020 09:41:11 +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 06M9f6gX001056 for ; Wed, 22 Jul 2020 05:41:06 -0400 Received: by smtp.corp.redhat.com (Postfix) id CC59C2B6DB; Wed, 22 Jul 2020 09:41:06 +0000 (UTC) Received: from localhost.localdomain (unknown [10.40.195.120]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4BA762B5BF for ; Wed, 22 Jul 2020 09:41:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1595410878; 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=jbbZHnlOf8fxjIWNaQAW22PXfp3Aqi0pxagpzY0t2lM=; b=d1MfN7mTVsRLFWuLea9yiOSTaJm6RfUfJK1lKlbL/ILIys5BRuhJJaXcjLIBQU+HGWT5RQ JzlqANgJWbEgg8ec97BdThBDUQuLi4K0winrXoBTgHo15U+ynjU1XV7HfhXvau8/TllRXq mlWmhJj9/RuZUE1A1FGgjmApF6rTxsY= X-MC-Unique: wBm110sJNEWIkmYcZXyy2w-1 From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH v1 25/34] qemuDomainBuildNamespace: Populate loader from daemon's namespace Date: Wed, 22 Jul 2020 11:40:19 +0200 Message-Id: In-Reply-To: References: 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.14 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" As mentioned in one of previous commits, populating domain's namespace from pre-exec() hook is dangerous. This commit moves population of the namespace with domain loader into daemon's namespace. Signed-off-by: Michal Privoznik Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_domain_namespace.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/qemu/qemu_domain_namespace.c b/src/qemu/qemu_domain_namesp= ace.c index 2ab10cb9f0..66c6cedadf 100644 --- a/src/qemu/qemu_domain_namespace.c +++ b/src/qemu/qemu_domain_namespace.c @@ -801,7 +801,7 @@ qemuDomainSetupAllRNGs(virDomainObjPtr vm, =20 static int qemuDomainSetupLoader(virDomainObjPtr vm, - const struct qemuDomainCreateDeviceData *data) + char ***paths) { virDomainLoaderDefPtr loader =3D vm->def->os.loader; =20 @@ -810,16 +810,16 @@ qemuDomainSetupLoader(virDomainObjPtr vm, if (loader) { switch ((virDomainLoader) loader->type) { case VIR_DOMAIN_LOADER_TYPE_ROM: - if (qemuDomainCreateDevice(loader->path, data, false) < 0) + if (virStringListAdd(paths, loader->path) < 0) return -1; break; =20 case VIR_DOMAIN_LOADER_TYPE_PFLASH: - if (qemuDomainCreateDevice(loader->path, data, false) < 0) + if (virStringListAdd(paths, loader->path) < 0) return -1; =20 if (loader->nvram && - qemuDomainCreateDevice(loader->nvram, data, false) < 0) + virStringListAdd(paths, loader->nvram) < 0) return -1; break; =20 @@ -891,6 +891,9 @@ qemuDomainBuildNamespace(virQEMUDriverConfigPtr cfg, if (qemuDomainSetupAllRNGs(vm, &paths) < 0) return -1; =20 + if (qemuDomainSetupLoader(vm, &paths) < 0) + return -1; + if (qemuDomainNamespaceMknodPaths(vm, (const char **) paths) < 0) return -1; =20 @@ -942,9 +945,6 @@ qemuDomainUnshareNamespace(virQEMUDriverConfigPtr cfg, if (qemuDomainSetupDev(mgr, vm, devPath) < 0) goto cleanup; =20 - if (qemuDomainSetupLoader(vm, &data) < 0) - goto cleanup; - if (qemuDomainSetupLaunchSecurity(vm, &data) < 0) goto cleanup; =20 --=20 2.26.2