render / rpms / libvirt

Forked from rpms/libvirt 9 months ago
Clone
9c6c51
From e22ab3412457f4d804ad7b0f62bd37ae07ec186d Mon Sep 17 00:00:00 2001
9c6c51
Message-Id: <e22ab3412457f4d804ad7b0f62bd37ae07ec186d@dist-git>
9c6c51
From: Peter Krempa <pkrempa@redhat.com>
9c6c51
Date: Tue, 5 Feb 2019 10:20:33 +0100
9c6c51
Subject: [PATCH] qemu: caps: Don't try to ask for CAP_DAC_OVERRIDE if non-root
9c6c51
MIME-Version: 1.0
9c6c51
Content-Type: text/plain; charset=UTF-8
9c6c51
Content-Transfer-Encoding: 8bit
9c6c51
9c6c51
It will not work. This breaks qemu capabilities probing as a user.
9c6c51
9c6c51
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
9c6c51
Reviewed-by: Erik Skultety <eskultet@redhat.com>
9c6c51
(cherry picked from commit 620d9dd598fde388f56ac37bcd3b31168c2f9fc6)
9c6c51
9c6c51
https: //bugzilla.redhat.com/show_bug.cgi?id=1665400
9c6c51
Signed-off-by: Erik Skultety <eskultet@redhat.com>
9c6c51
Reviewed-by: Ján Tomko <jtomko@redhat.com>
9c6c51
---
9c6c51
 src/qemu/qemu_capabilities.c | 3 ++-
9c6c51
 1 file changed, 2 insertions(+), 1 deletion(-)
9c6c51
9c6c51
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
9c6c51
index f71cd08f4d..912f758bcd 100644
9c6c51
--- a/src/qemu/qemu_capabilities.c
9c6c51
+++ b/src/qemu/qemu_capabilities.c
9c6c51
@@ -4482,7 +4482,8 @@ virQEMUCapsInitQMPCommandRun(virQEMUCapsInitQMPCommandPtr cmd,
9c6c51
 #if WITH_CAPNG
9c6c51
     /* QEMU might run into permission issues, e.g. /dev/sev (0600), override
9c6c51
      * them just for the purpose of probing */
9c6c51
-    virCommandAllowCap(cmd->cmd, CAP_DAC_OVERRIDE);
9c6c51
+    if (geteuid() == 0)
9c6c51
+        virCommandAllowCap(cmd->cmd, CAP_DAC_OVERRIDE);
9c6c51
 #endif
9c6c51
 
9c6c51
     virCommandSetGID(cmd->cmd, cmd->runGid);
9c6c51
-- 
9c6c51
2.20.1
9c6c51