On 03/27/2013 03:10 AM, Stefan Hajnoczi wrote:
> There are several places where QEMU accidentally relies on the O_NONBLOCK 
> state
> of passed file descriptors.  Exposing O_NONBLOCK state makes it part of the 
> QMP
> API whenever getfd or fdset_add_fd are used!
> 
> Whether or not QEMU will use O_NONBLOCK is an implementation detail and should
> be hidden from QMP clients.
> 
> This patch series addresses this in 3 steps:
> 
> 1. Fix callers of monitor_handle_fd_param(), monitor_fdset_get_fd(), and
>    monitor_get_fd() that depend on O_NONBLOCK being set.  Luckily there are
>    only two instances and they are fixed in Patches 1 & 2.

Description is now off after rebase, but the cover letter isn't
committed, so no big deal.

> 
> 2. Rename socket_set_nonblock() to qemu_set_nonblock() just like
>    qemu_set_cloexec().  This makes code cleaner when working with arbitrary
>    file descriptors that may not be sockets.  See Patch 3.
> 
> 3. Clear O_NONBLOCK when a chardev receives file descriptors.  From now on 
> QEMU
>    can assume that passed file descriptors are in blocking mode.  Simply use
>    qemu_set_nonblock(fd) if you want to enable O_NONBLOCK.  See Patch 4.

Series: Reviewed-by: Eric Blake <ebl...@redhat.com>

> v2:
>  * Rename socket_set_nonblock() in Patch 1 to avoid code churn [eblake]
>  * Avoid qemu_set_block(-1) calls that clobber errno [quintela]
> 
> Stefan Hajnoczi (4):
>   oslib-posix: rename socket_set_nonblock() to qemu_set_nonblock()
>   net: ensure "socket" backend uses non-blocking fds
>   qemu-socket: set passed fd non-blocking in socket_connect()
>   chardev: clear O_NONBLOCK on SCM_RIGHTS file descriptors

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to