render / rpms / libvirt

Forked from rpms/libvirt 9 months ago
Clone
Pablo Greco 40546a
From dc905fbc1f420a8d7856d9ff7f27b3faae352098 Mon Sep 17 00:00:00 2001
Pablo Greco 40546a
Message-Id: <dc905fbc1f420a8d7856d9ff7f27b3faae352098@dist-git>
Pablo Greco 40546a
From: Erik Skultety <eskultet@redhat.com>
Pablo Greco 40546a
Date: Thu, 3 Jan 2019 10:03:46 +0100
Pablo Greco 40546a
Subject: [PATCH] qemu: process: SEV: Relabel guest owner's SEV files created
Pablo Greco 40546a
 before start
Pablo Greco 40546a
Pablo Greco 40546a
Before launching a SEV guest we take the base64-encoded guest owner's
Pablo Greco 40546a
data specified in launchSecurity and create files with the same content
Pablo Greco 40546a
under /var/lib/libvirt/qemu/<domain>. The reason for this is that we
Pablo Greco 40546a
need to pass these files on to QEMU which then uses them to communicate
Pablo Greco 40546a
with the SEV firmware, except when it doesn't have permissions to open
Pablo Greco 40546a
those files since we don't relabel them.
Pablo Greco 40546a
Pablo Greco 40546a
https://bugzilla.redhat.com/show_bug.cgi?id=1658112
Pablo Greco 40546a
Pablo Greco 40546a
Signed-off-by: Erik Skultety <eskultet@redhat.com>
Pablo Greco 40546a
Acked-by: Michal Privoznik <mprivozn@redhat.com>
Pablo Greco 40546a
(cherry picked from commit 7dc31fe503e540d5b4ee4f94d61842aa6e302e94)
Pablo Greco 40546a
Signed-off-by: Erik Skultety <eskultet@redhat.com>
Pablo Greco 40546a
Message-Id: <6bde21a3bda257a042d6f6c1d78ab1bf12c196d3.1546506016.git.eskultet@redhat.com>
Pablo Greco 40546a
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
Pablo Greco 40546a
---
Pablo Greco 40546a
 src/qemu/qemu_process.c | 4 ++++
Pablo Greco 40546a
 1 file changed, 4 insertions(+)
Pablo Greco 40546a
Pablo Greco 40546a
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
Pablo Greco 40546a
index 757e2d33a4..bc573f96a4 100644
Pablo Greco 40546a
--- a/src/qemu/qemu_process.c
Pablo Greco 40546a
+++ b/src/qemu/qemu_process.c
Pablo Greco 40546a
@@ -5990,6 +5990,7 @@ qemuProcessSEVCreateFile(virDomainObjPtr vm,
Pablo Greco 40546a
                          const char *data)
Pablo Greco 40546a
 {
Pablo Greco 40546a
     qemuDomainObjPrivatePtr priv = vm->privateData;
Pablo Greco 40546a
+    virQEMUDriverPtr driver = priv->driver;
Pablo Greco 40546a
     char *configFile;
Pablo Greco 40546a
     int ret = -1;
Pablo Greco 40546a
 
Pablo Greco 40546a
@@ -6002,6 +6003,9 @@ qemuProcessSEVCreateFile(virDomainObjPtr vm,
Pablo Greco 40546a
         goto cleanup;
Pablo Greco 40546a
     }
Pablo Greco 40546a
 
Pablo Greco 40546a
+    if (qemuSecurityDomainSetPathLabel(driver, vm, configFile, true) < 0)
Pablo Greco 40546a
+        goto cleanup;
Pablo Greco 40546a
+
Pablo Greco 40546a
     ret = 0;
Pablo Greco 40546a
  cleanup:
Pablo Greco 40546a
     VIR_FREE(configFile);
Pablo Greco 40546a
-- 
Pablo Greco 40546a
2.22.0
Pablo Greco 40546a