From nobody Mon Feb 9 03:00:05 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) client-ip=205.139.110.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 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=1595410926; cv=none; d=zohomail.com; s=zohoarc; b=k77anbJmGeUlrXuuGUrB4GksCPnseSXsMKtsjsDF9GF0vgiJW2OCCaXoHKtP/Bei55Q8WR3KUHFnrzTaUcSUet7RdwwLJFhdF7lK+6IFOf0kFR9zKJcqbf7RHyALJ4vzZX+1rePlA9SzfQTXJivXzMQm07pQ1jz4H1P/nYPbOtU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1595410926; 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=Q1Eg5koXy/J3nskKnZ3dEqpvqbCL2+3rSF/ut/dPQtI=; b=aS9yDPJvRf8S6AV3gGYFkQkCRSF2tFN6FCyEAW1BBwIgwX/1Tx4REnH/PvAZDRpryW9orENcgKi5UeJt1gwmQSzCWvv9DejLAmhodu3FRtVdHKKWFT+0dcW+a99i5iUnqInlSYUqKbne3Z6dJxX2q1qWH0l7mjCCKqEF4ieHfXE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 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-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by mx.zohomail.com with SMTPS id 1595410926627378.980603859951; Wed, 22 Jul 2020 02:42:06 -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-344-VvZgND4SOSShSrRVU4ueaQ-1; Wed, 22 Jul 2020 05:41:11 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A09D391279; Wed, 22 Jul 2020 09:41:05 +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 82B00726A7; Wed, 22 Jul 2020 09:41:05 +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 51BC01800FEE; Wed, 22 Jul 2020 09:41:05 +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 06M9f1Lv000997 for ; Wed, 22 Jul 2020 05:41:01 -0400 Received: by smtp.corp.redhat.com (Postfix) id 8BCFE1A8F7; Wed, 22 Jul 2020 09:41:01 +0000 (UTC) Received: from localhost.localdomain (unknown [10.40.195.120]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0B0602855B for ; Wed, 22 Jul 2020 09:41:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1595410925; 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=Q1Eg5koXy/J3nskKnZ3dEqpvqbCL2+3rSF/ut/dPQtI=; b=LNU2sax+0CPoLPVTx2bLeucvbEa2BtpBpuS6CYlFspH78l8GVPf0rZJ29SyGqu5Mbr/p/R 1wcHn6n0AQlDYuhmgnNFOFurXpJzeTsaEFG2ZAEO7R0QH3VelEcYVHAMy8dzH3XpRpiimK EaHRXSygHOaKbZv4CVyqvWPkpnoAEvg= X-MC-Unique: VvZgND4SOSShSrRVU4ueaQ-1 From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH v1 19/34] qemuDomainBuildNamespace: Populate memory from daemon's namespace Date: Wed, 22 Jul 2020 11:40:13 +0200 Message-Id: <04f984a3abb8c9f7079cad38cb50fb0f1fbd8250.1595410402.git.mprivozn@redhat.com> 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.15 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 memory (nvdimms) into daemon's namespace. Signed-off-by: Michal Privoznik Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_domain_namespace.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/src/qemu/qemu_domain_namespace.c b/src/qemu/qemu_domain_namesp= ace.c index 2517832a8d..bafb08fac8 100644 --- a/src/qemu/qemu_domain_namespace.c +++ b/src/qemu/qemu_domain_namespace.c @@ -598,25 +598,25 @@ qemuDomainSetupAllHostdevs(virDomainObjPtr vm, =20 static int qemuDomainSetupMemory(virDomainMemoryDefPtr mem, - const struct qemuDomainCreateDeviceData *data) + char ***paths) { if (mem->model !=3D VIR_DOMAIN_MEMORY_MODEL_NVDIMM) return 0; =20 - return qemuDomainCreateDevice(mem->nvdimmPath, data, false); + return virStringListAdd(paths, mem->nvdimmPath); } =20 =20 static int qemuDomainSetupAllMemories(virDomainObjPtr vm, - const struct qemuDomainCreateDeviceData *data) + char ***paths) { size_t i; =20 VIR_DEBUG("Setting up memories"); for (i =3D 0; i < vm->def->nmems; i++) { if (qemuDomainSetupMemory(vm->def->mems[i], - data) < 0) + paths) < 0) return -1; } VIR_DEBUG("Setup all memories"); @@ -874,6 +874,9 @@ qemuDomainBuildNamespace(virQEMUDriverConfigPtr cfg, if (qemuDomainSetupAllHostdevs(vm, &paths) < 0) return -1; =20 + if (qemuDomainSetupAllMemories(vm, &paths) < 0) + return -1; + if (qemuDomainNamespaceMknodPaths(vm, (const char **) paths) < 0) return -1; =20 @@ -925,9 +928,6 @@ qemuDomainUnshareNamespace(virQEMUDriverConfigPtr cfg, if (qemuDomainSetupDev(mgr, vm, devPath) < 0) goto cleanup; =20 - if (qemuDomainSetupAllMemories(vm, &data) < 0) - goto cleanup; - if (qemuDomainSetupAllChardevs(vm, &data) < 0) goto cleanup; =20 @@ -1743,13 +1743,15 @@ int qemuDomainNamespaceSetupMemory(virDomainObjPtr vm, virDomainMemoryDefPtr mem) { + VIR_AUTOSTRINGLIST paths =3D NULL; + if (!qemuDomainNamespaceEnabled(vm, QEMU_DOMAIN_NS_MOUNT)) return 0; =20 - if (mem->model !=3D VIR_DOMAIN_MEMORY_MODEL_NVDIMM) - return 0; + if (qemuDomainSetupMemory(mem, &paths) < 0) + return -1; =20 - if (qemuDomainNamespaceMknodPath(vm, mem->nvdimmPath) < 0) + if (qemuDomainNamespaceMknodPaths(vm, (const char **) paths) < 0) return -1; =20 return 0; --=20 2.26.2