From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38062) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XP6GA-0000n1-ES for qemu-devel@nongnu.org; Wed, 03 Sep 2014 04:49:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XP6G6-0006wF-Ke for qemu-devel@nongnu.org; Wed, 03 Sep 2014 04:49:46 -0400 Received: from mx1.redhat.com ([209.132.183.28]:64160) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XP6G6-0006w3-BH for qemu-devel@nongnu.org; Wed, 03 Sep 2014 04:49:42 -0400 Date: Wed, 3 Sep 2014 09:49:37 +0100 From: "Daniel P. Berrange" Message-ID: <20140903084937.GA18021@redhat.com> References: <1409725087-30483-1-git-send-email-cyliu@suse.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <1409725087-30483-1-git-send-email-cyliu@suse.com> Subject: Re: [Qemu-devel] [PATCH V2] fix: unix sockets created for virtio-serail has insufficient permissions Reply-To: "Daniel P. Berrange" List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Chunyan Liu Cc: libvir-list@redhat.com, qemu-devel@nongnu.org On Wed, Sep 03, 2014 at 02:18:07PM +0800, Chunyan Liu wrote: > Add umask to _virCommand, allow user to set umask to command. > Set umask(002) to qemu process to overwrite default umask(022) 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 > --- > Changes: > * set umask(002) to the whole qemu process instead of calling > umask in qemu unix_listen_opts. > > V1 is here: > http://www.mail-archive.com/libvir-list@redhat.com/msg101513.html > > src/libvirt_private.syms | 1 + > src/qemu/qemu_process.c | 1 + > src/util/vircommand.c | 11 +++++++++++ > src/util/vircommand.h | 1 + > 4 files changed, 14 insertions(+) ACK, you could possibly argue that it should be configurable in qemu.conf, but I think that would be overkill. We unconditionally put QEMU into a special group, so we really should make sure that stuff is accessible to that group via umask. Regards, Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|