From nobody Sat Feb 7 06:55:48 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.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 63.128.21.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=1610719984; cv=none; d=zohomail.com; s=zohoarc; b=f7HSRD76LZLJWQzpYd9kvETYrpS4ZZ5dcH++aoOmyWGQrRFNY6L1278NguxjEEkv0EmrrJP+QVfu+eDf8CZAMXyBYFJ31xwFg/pAD5cE8oTE8dcV5o+IUyMBFIqM8zYbhpyZck7ei5+wY91BHCd0JXTwO+flhhDWEdY3UxBoo8s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610719984; 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=5vufR2bIm/33cj5EVk+NNbebWDv80IvrNLtvNgh3KFU=; b=Hn4r9KwBrTGzSGKHOqq9jNx3h6YixyCq8SCLtA2UwfOQWejX5roy40rXMINT2AKbG9sp9wYcX/A7jlBJ8HnPYUpuw+i/AYYFSfJ2udMtNOFqAAfElTNMhCM1k3eErvs0ATRmibEUjybVuLjqM5jJt2OSSYhKIlG5w2pww7dwRVA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 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-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1610719984368570.5289471796558; Fri, 15 Jan 2021 06:13:04 -0800 (PST) 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-529-ybtCVGD3OtWdLTgiFdxAKw-1; Fri, 15 Jan 2021 09:12:49 -0500 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 2AE0C1922963; Fri, 15 Jan 2021 14:12:43 +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 062B666A08; Fri, 15 Jan 2021 14:12:43 +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 C32A84EA6C; Fri, 15 Jan 2021 14:12:42 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 10FECSNg025939 for ; Fri, 15 Jan 2021 09:12:28 -0500 Received: by smtp.corp.redhat.com (Postfix) id 810BB60C6B; Fri, 15 Jan 2021 14:12:28 +0000 (UTC) Received: from localhost.localdomain (unknown [10.40.194.52]) by smtp.corp.redhat.com (Postfix) with ESMTP id 037C860BF3 for ; Fri, 15 Jan 2021 14:12:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1610719983; 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=5vufR2bIm/33cj5EVk+NNbebWDv80IvrNLtvNgh3KFU=; b=JBxtHB6D+N/5W0DITuMGY2FP9B9InFwztXXfMFp0SiQz4NUozX5Fpxwg+ITfibV/BhgAXp uIc251HKprAxPpxy4Ct2UW+geJn2StM+cfhJLexgtzjQl6lLjDW//BJVDOO8ti8pfprVIq KpfTXhgkiQjwkpTQEXxGPs0IXvskZ2Y= X-MC-Unique: ybtCVGD3OtWdLTgiFdxAKw-1 From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 3/6] security: Relabel virtio-pmem Date: Fri, 15 Jan 2021 15:12:17 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 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 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) Content-Type: text/plain; charset="utf-8" Just like with NVDIMM model, we have to relabel the path to virtio-pmem so that QEMU can access it. Signed-off-by: Michal Privoznik --- src/security/security_apparmor.c | 2 +- src/security/security_dac.c | 4 ++-- src/security/security_selinux.c | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/security/security_apparmor.c b/src/security/security_appar= mor.c index 1d828ce0d8..29f0956d22 100644 --- a/src/security/security_apparmor.c +++ b/src/security/security_apparmor.c @@ -683,6 +683,7 @@ AppArmorSetMemoryLabel(virSecurityManagerPtr mgr, { switch (mem->model) { case VIR_DOMAIN_MEMORY_MODEL_NVDIMM: + case VIR_DOMAIN_MEMORY_MODEL_VIRTIO_PMEM: if (!virFileExists(mem->nvdimmPath)) { virReportError(VIR_ERR_INTERNAL_ERROR, _("%s: \'%s\' does not exist"), @@ -690,7 +691,6 @@ AppArmorSetMemoryLabel(virSecurityManagerPtr mgr, return -1; } return reload_profile(mgr, def, mem->nvdimmPath, true); - case VIR_DOMAIN_MEMORY_MODEL_VIRTIO_PMEM: case VIR_DOMAIN_MEMORY_MODEL_NONE: case VIR_DOMAIN_MEMORY_MODEL_DIMM: case VIR_DOMAIN_MEMORY_MODEL_LAST: diff --git a/src/security/security_dac.c b/src/security/security_dac.c index 0acdc2a52d..71d58758c4 100644 --- a/src/security/security_dac.c +++ b/src/security/security_dac.c @@ -1889,10 +1889,10 @@ virSecurityDACRestoreMemoryLabel(virSecurityManager= Ptr mgr, =20 switch (mem->model) { case VIR_DOMAIN_MEMORY_MODEL_NVDIMM: + case VIR_DOMAIN_MEMORY_MODEL_VIRTIO_PMEM: ret =3D virSecurityDACRestoreFileLabel(mgr, mem->nvdimmPath); break; =20 - case VIR_DOMAIN_MEMORY_MODEL_VIRTIO_PMEM: case VIR_DOMAIN_MEMORY_MODEL_DIMM: case VIR_DOMAIN_MEMORY_MODEL_LAST: case VIR_DOMAIN_MEMORY_MODEL_NONE: @@ -2063,6 +2063,7 @@ virSecurityDACSetMemoryLabel(virSecurityManagerPtr mg= r, =20 switch (mem->model) { case VIR_DOMAIN_MEMORY_MODEL_NVDIMM: + case VIR_DOMAIN_MEMORY_MODEL_VIRTIO_PMEM: seclabel =3D virDomainDefGetSecurityLabelDef(def, SECURITY_DAC_NAM= E); if (seclabel && !seclabel->relabel) return 0; @@ -2075,7 +2076,6 @@ virSecurityDACSetMemoryLabel(virSecurityManagerPtr mg= r, user, group, true); break; =20 - case VIR_DOMAIN_MEMORY_MODEL_VIRTIO_PMEM: case VIR_DOMAIN_MEMORY_MODEL_DIMM: case VIR_DOMAIN_MEMORY_MODEL_LAST: case VIR_DOMAIN_MEMORY_MODEL_NONE: diff --git a/src/security/security_selinux.c b/src/security/security_selinu= x.c index bbffbccb17..3563dbfb86 100644 --- a/src/security/security_selinux.c +++ b/src/security/security_selinux.c @@ -1572,6 +1572,7 @@ virSecuritySELinuxSetMemoryLabel(virSecurityManagerPt= r mgr, =20 switch (mem->model) { case VIR_DOMAIN_MEMORY_MODEL_NVDIMM: + case VIR_DOMAIN_MEMORY_MODEL_VIRTIO_PMEM: seclabel =3D virDomainDefGetSecurityLabelDef(def, SECURITY_SELINUX= _NAME); if (!seclabel || !seclabel->relabel) return 0; @@ -1581,7 +1582,6 @@ virSecuritySELinuxSetMemoryLabel(virSecurityManagerPt= r mgr, return -1; break; =20 - case VIR_DOMAIN_MEMORY_MODEL_VIRTIO_PMEM: case VIR_DOMAIN_MEMORY_MODEL_NONE: case VIR_DOMAIN_MEMORY_MODEL_DIMM: case VIR_DOMAIN_MEMORY_MODEL_LAST: @@ -1602,6 +1602,7 @@ virSecuritySELinuxRestoreMemoryLabel(virSecurityManag= erPtr mgr, =20 switch (mem->model) { case VIR_DOMAIN_MEMORY_MODEL_NVDIMM: + case VIR_DOMAIN_MEMORY_MODEL_VIRTIO_PMEM: seclabel =3D virDomainDefGetSecurityLabelDef(def, SECURITY_SELINUX= _NAME); if (!seclabel || !seclabel->relabel) return 0; @@ -1609,7 +1610,6 @@ virSecuritySELinuxRestoreMemoryLabel(virSecurityManag= erPtr mgr, ret =3D virSecuritySELinuxRestoreFileLabel(mgr, mem->nvdimmPath, t= rue); break; =20 - case VIR_DOMAIN_MEMORY_MODEL_VIRTIO_PMEM: case VIR_DOMAIN_MEMORY_MODEL_DIMM: case VIR_DOMAIN_MEMORY_MODEL_NONE: case VIR_DOMAIN_MEMORY_MODEL_LAST: --=20 2.26.2