render / rpms / libvirt

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