qemu: ensure sane umask for qemu process
authorChunyan Liu <cyliu@suse.com>
Wed, 3 Sep 2014 06:18:07 +0000 (14:18 +0800)
committerEric Blake <eblake@redhat.com>
Wed, 3 Sep 2014 11:58:15 +0000 (05:58 -0600)
commit0e1a1a8c47e443c68bd13555f27a0437c02e1170
tree3450dc08a607daf012f7faaa67fcc3b9fcefff9d
parent6209454d5b10c2d89faab8a56b250f1569d823fe
qemu: ensure sane umask for qemu process

Add umask to _virCommand, allow user to set umask to command.
Set umask(002) to qemu process to overwrite the default umask
of 022 set by many distros, so that unix sockets created for
virtio-serial has expected permissions.

Fix problem reported here:
https://sourceware.org/bugzilla/show_bug.cgi?id=13078#c11
https://bugzilla.novell.com/show_bug.cgi?id=888166

To use virtio-serial device, unix socket created for chardev with
default umask(022) has insufficient permissions.
e.g.:
-device virtio-serial \
-chardev socket,path=/tmp/foo,server,nowait,id=foo \
-device virtserialport,chardev=foo,name=org.fedoraproject.port.0

srwxr-xr-x 1 qemu qemu 0 21. Jul 14:19 /tmp/somefile.sock

Other users in the same group (like real user, test engines, etc)
cannot write to this socket.

Signed-off-by: Chunyan Liu <cyliu@suse.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
src/libvirt_private.syms
src/qemu/qemu_process.c
src/util/vircommand.c
src/util/vircommand.h