render / rpms / libvirt

Forked from rpms/libvirt 9 months ago
Clone
Mark McLoughlin aa0373
From 5f8d720b5f1393ee333a5fa8375ffe9ac954d48b 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 da05e0
index 6b0b404..53186e0 100644
Mark McLoughlin da05e0
--- a/src/qemu_conf.c
Mark McLoughlin da05e0
+++ b/src/qemu_conf.c
Mark McLoughlin da05e0
@@ -1384,6 +1384,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 da05e0
@@ -2015,7 +2029,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