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