9c6c51
From 863827760fc7550b9b454fadf1377bea616fdcfd Mon Sep 17 00:00:00 2001
9c6c51
Message-Id: <863827760fc7550b9b454fadf1377bea616fdcfd@dist-git>
9c6c51
From: =?UTF-8?q?J=C3=A1n=20Tomko?= <jtomko@redhat.com>
9c6c51
Date: Wed, 3 Oct 2018 16:58:18 +0200
9c6c51
Subject: [PATCH] qemu: fix up permissions for pre-created UNIX sockets
9c6c51
MIME-Version: 1.0
9c6c51
Content-Type: text/plain; charset=UTF-8
9c6c51
Content-Transfer-Encoding: 8bit
9c6c51
9c6c51
My commit d6b8838 fixed the uid:gid for the pre-created UNIX sockets
9c6c51
but did not account for the different umask of libvirtd and QEMU.
9c6c51
Since commit 0e1a1a8c we set umask to '0002' for the QEMU process.
9c6c51
Manually tune-up the permissions to match what we would have gotten
9c6c51
if QEMU had created the socket.
9c6c51
9c6c51
https://bugzilla.redhat.com/show_bug.cgi?id=1633389
9c6c51
9c6c51
Signed-off-by: Ján Tomko <jtomko@redhat.com>
9c6c51
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
9c6c51
(cherry picked from commit 8ba65c4d95712b54362fd81c34bae99f51d45a0b)
9c6c51
Signed-off-by: Ján Tomko <jtomko@redhat.com>
9c6c51
9c6c51
RHEL 7.6.z: https://bugzilla.redhat.com/show_bug.cgi?id=1635228
9c6c51
RHEL 8.0: https://bugzilla.redhat.com/show_bug.cgi?id=1634775
9c6c51
9c6c51
Reviewed-by: Erik Skultety <eskultet@redhat.com>
9c6c51
---
9c6c51
 src/qemu/qemu_command.c | 6 ++++++
9c6c51
 1 file changed, 6 insertions(+)
9c6c51
9c6c51
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
9c6c51
index 5c71abab96..028f48310b 100644
9c6c51
--- a/src/qemu/qemu_command.c
9c6c51
+++ b/src/qemu/qemu_command.c
9c6c51
@@ -4933,6 +4933,12 @@ qemuOpenChrChardevUNIXSocket(const virDomainChrSourceDef *dev)
9c6c51
         goto error;
9c6c51
     }
9c6c51
 
9c6c51
+    /* We run QEMU with umask 0002. Compensate for the umask
9c6c51
+     * libvirtd might be running under to get the same permission
9c6c51
+     * QEMU would have. */
9c6c51
+    if (virFileUpdatePerm(dev->data.nix.path, 0002, 0664) < 0)
9c6c51
+        goto error;
9c6c51
+
9c6c51
     return fd;
9c6c51
 
9c6c51
  error:
9c6c51
-- 
9c6c51
2.19.1
9c6c51