render / rpms / libvirt

Forked from rpms/libvirt 10 months ago
Clone
Mark McLoughlin f1ac00
From 127a39777e9809053bb98a9082e27c73543ccfa2 Mon Sep 17 00:00:00 2001
Mark McLoughlin da05e0
From: Daniel P. Berrange <berrange@redhat.com>
Mark McLoughlin da05e0
Date: Mon, 17 Aug 2009 08:32:08 +0100
Mark McLoughlin da05e0
Subject: [PATCH] Disable sound cards when running sVirt
Mark McLoughlin da05e0
Mark McLoughlin da05e0
Temporary hack till PulseAudio autostart problems are sorted out when
Mark McLoughlin da05e0
SELinux enforcing (bz 486112)
Mark McLoughlin da05e0
Mark McLoughlin da05e0
Fedora-patch: libvirt-0.6.4-svirt-sound.patch
Mark McLoughlin da05e0
---
Mark McLoughlin da05e0
 src/qemu_conf.c |   17 ++++++++++++++++-
Mark McLoughlin da05e0
 1 files changed, 16 insertions(+), 1 deletions(-)
Mark McLoughlin da05e0
Mark McLoughlin da05e0
diff --git a/src/qemu_conf.c b/src/qemu_conf.c
Mark McLoughlin 897506
index f92bcef..f3b4ef0 100644
Mark McLoughlin da05e0
--- a/src/qemu_conf.c
Mark McLoughlin da05e0
+++ b/src/qemu_conf.c
Mark McLoughlin 897506
@@ -1510,6 +1510,20 @@ int qemudBuildCommandLine(virConnectPtr conn,
Daniel Veillard 4f644c
     char uuid[VIR_UUID_STRING_BUFLEN];
Daniel Veillard cdd5b3
     char domid[50];
Daniel Veillard cdd5b3
     const char *cpu = NULL;
Daniel Veillard cdd5b3
+    int skipSound = 0;
Daniel Veillard cdd5b3
+
Daniel Veillard cdd5b3
+    if (driver->securityDriver &&
Daniel Veillard cdd5b3
+        driver->securityDriver->name &&
Daniel Veillard cdd5b3
+        STREQ(driver->securityDriver->name, "selinux") &&
Daniel Veillard cdd5b3
+        getuid() == 0) {
Mark McLoughlin da05e0
+        static int soundWarned = 0;
Daniel Veillard cdd5b3
+        skipSound = 1;
Daniel Veillard cdd5b3
+        if (def->nsounds &&
Daniel Veillard cdd5b3
+            !soundWarned) {
Daniel Veillard cdd5b3
+            soundWarned = 1;
Daniel Veillard cdd5b3
+            VIR_WARN0("Sound cards for VMs are disabled while SELinux security model is active");
Daniel Veillard cdd5b3
+        }
Daniel Veillard cdd5b3
+    }
Daniel Veillard cdd5b3
 
Daniel Veillard cdd5b3
     uname_normalize(&ut);
Daniel Veillard cdd5b3
 
Mark McLoughlin 897506
@@ -2181,7 +2195,8 @@ int qemudBuildCommandLine(virConnectPtr conn,
Daniel Veillard cdd5b3
     }
Daniel Veillard cdd5b3
 
Daniel Veillard cdd5b3
     /* Add sound hardware */
Daniel Veillard cdd5b3
-    if (def->nsounds) {
Daniel Veillard cdd5b3
+    if (def->nsounds &&
Daniel Veillard cdd5b3
+        !skipSound) {
Daniel Veillard cdd5b3
         int size = 100;
Daniel Veillard cdd5b3
         char *modstr;
Daniel Veillard cdd5b3
         if (VIR_ALLOC_N(modstr, size+1) < 0)
Mark McLoughlin da05e0
-- 
Mark McLoughlin da05e0
1.6.2.5
Mark McLoughlin da05e0