]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu_shim: Ignore SIGPIPE
authorMichal Privoznik <mprivozn@redhat.com>
Fri, 28 Feb 2020 14:36:49 +0000 (15:36 +0100)
committerMichal Privoznik <mprivozn@redhat.com>
Thu, 5 Mar 2020 10:24:51 +0000 (11:24 +0100)
I've found that if my virtlogd is socket activated but the daemon
doesn't run yet, then the virt-qemu-run is killed right after it
tries to start the domain. The problem is that because the default
setting is to use virtlogd, the domain create code tries to
connect to virtlogd socket, which in turn tries to detect who is
connecting (virNetSocketGetUNIXIdentity()) and as a part of it,
it will try to open /proc/${PID_OF_SHIM}/stat which is denied by
SELinux:

  type=AVC msg=audit(1582903501.927:323): avc:  denied  { search } for  \
  pid=1210 comm="virtlogd" name="1843" dev="proc" ino=37224 \
  scontext=system_u:system_r:virtlogd_t:s0-s0:c0.c1023 \
  tcontext=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 tclass=dir \
  permissive=0

Virtlogd reacts by closing the connection which the shim sees as
SIGPIPE. Since the default response to the signal is Term, we
don't even get to reporting any error nor to removing the
temporary directory.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
src/qemu/qemu_shim.c

index fd905825aa29bb897f3e03451f4f38003ed96b86..7e87b8fb962721e826cb80603304a2d07df67284 100644 (file)
@@ -150,6 +150,7 @@ int main(int argc, char **argv)
     signal(SIGINT, qemuShimSigShutdown);
     signal(SIGQUIT, qemuShimSigShutdown);
     signal(SIGHUP, qemuShimSigShutdown);
+    signal(SIGPIPE, SIG_IGN);
 
     if (root == NULL) {
         if (!(root = g_dir_make_tmp("virt-qemu-run-XXXXXX", &error))) {