forked from pool/libvirt
3558b40b5b
- qemu: fix issues related to restricted permissions on /dev/sev b6440119-qemu-conf-sev.patch, a404ac34-qemu-cgroup-sev.patch, 6fd4c8f8-qemu-domain-sev.patch, 17f6a257-security-dac-sev.patch, a2d3dea9-qemu-caps-dac-override-sev.patch bsc#1124842 OBS-URL: https://build.opensuse.org/request/show/672885 OBS-URL: https://build.opensuse.org/package/show/Virtualization/libvirt?expand=0&rev=728
61 lines
1.9 KiB
Diff
61 lines
1.9 KiB
Diff
commit 6fd4c8f8785a063112c8161a3a3f5ad3cb6647ea
|
|
Author: Erik Skultety <eskultet@redhat.com>
|
|
Date: Tue Jan 22 13:46:16 2019 +0100
|
|
|
|
qemu: domain: Add /dev/sev into the domain mount namespace selectively
|
|
|
|
Instead of exposing /dev/sev to every domain, do it selectively.
|
|
|
|
Signed-off-by: Erik Skultety <eskultet@redhat.com>
|
|
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
|
|
|
|
Index: libvirt-5.0.0/src/qemu/qemu_domain.c
|
|
===================================================================
|
|
--- libvirt-5.0.0.orig/src/qemu/qemu_domain.c
|
|
+++ libvirt-5.0.0/src/qemu/qemu_domain.c
|
|
@@ -116,6 +116,7 @@ VIR_ENUM_IMPL(qemuDomainNamespace, QEMU_
|
|
#define DEVPREFIX "/dev/"
|
|
#define DEV_VFIO "/dev/vfio/vfio"
|
|
#define DEVICE_MAPPER_CONTROL_PATH "/dev/mapper/control"
|
|
+#define DEV_SEV "/dev/sev"
|
|
|
|
|
|
struct _qemuDomainLogContext {
|
|
@@ -12018,6 +12019,26 @@ qemuDomainSetupLoader(virQEMUDriverConfi
|
|
}
|
|
|
|
|
|
+static int
|
|
+qemuDomainSetupLaunchSecurity(virQEMUDriverConfigPtr cfg ATTRIBUTE_UNUSED,
|
|
+ virDomainObjPtr vm,
|
|
+ const struct qemuDomainCreateDeviceData *data)
|
|
+{
|
|
+ virDomainSEVDefPtr sev = vm->def->sev;
|
|
+
|
|
+ if (!sev || sev->sectype != VIR_DOMAIN_LAUNCH_SECURITY_SEV)
|
|
+ return 0;
|
|
+
|
|
+ VIR_DEBUG("Setting up launch security");
|
|
+
|
|
+ if (qemuDomainCreateDevice(DEV_SEV, data, false) < 0)
|
|
+ return -1;
|
|
+
|
|
+ VIR_DEBUG("Set up launch security");
|
|
+ return 0;
|
|
+}
|
|
+
|
|
+
|
|
int
|
|
qemuDomainBuildNamespace(virQEMUDriverConfigPtr cfg,
|
|
virSecurityManagerPtr mgr,
|
|
@@ -12089,6 +12110,9 @@ qemuDomainBuildNamespace(virQEMUDriverCo
|
|
if (qemuDomainSetupLoader(cfg, vm, &data) < 0)
|
|
goto cleanup;
|
|
|
|
+ if (qemuDomainSetupLaunchSecurity(cfg, vm, &data) < 0)
|
|
+ goto cleanup;
|
|
+
|
|
/* Save some mount points because we want to share them with the host */
|
|
for (i = 0; i < ndevMountsPath; i++) {
|
|
struct stat sb;
|