From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:36524) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UKorn-0003Tz-2S for qemu-devel@nongnu.org; Wed, 27 Mar 2013 07:50:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UKori-0008Ow-9z for qemu-devel@nongnu.org; Wed, 27 Mar 2013 07:50:06 -0400 Received: from mx1.redhat.com ([209.132.183.28]:40285) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UKori-0008Kz-2T for qemu-devel@nongnu.org; Wed, 27 Mar 2013 07:50:02 -0400 Message-ID: <5152DC83.60009@redhat.com> Date: Wed, 27 Mar 2013 05:48:19 -0600 From: Eric Blake MIME-Version: 1.0 References: <1364375446-24180-1-git-send-email-stefanha@redhat.com> In-Reply-To: <1364375446-24180-1-git-send-email-stefanha@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="----enig2GUTSOGCSMPGIUWFRHBOF" Subject: Re: [Qemu-devel] [PATCH v2 0/4] monitor: do not rely on O_NONBLOCK for passed file descriptors List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi Cc: Anthony Liguori , david.pravec@nethost.cz, Juan Quintela , mprivozn@redhat.com, coreyb@linux.vnet.ibm.com, qemu-devel@nongnu.org, Luiz Capitulino This is an OpenPGP/MIME signed message (RFC 4880 and 3156) ------enig2GUTSOGCSMPGIUWFRHBOF Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 03/27/2013 03:10 AM, Stefan Hajnoczi wrote: > There are several places where QEMU accidentally relies on the O_NONBLO= CK state > of passed file descriptors. Exposing O_NONBLOCK state makes it part of= the QMP > API whenever getfd or fdset_add_fd are used! >=20 > Whether or not QEMU will use O_NONBLOCK is an implementation detail and= should > be hidden from QMP clients. >=20 > This patch series addresses this in 3 steps: >=20 > 1. Fix callers of monitor_handle_fd_param(), monitor_fdset_get_fd(), an= d > 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. >=20 > 2. Rename socket_set_nonblock() to qemu_set_nonblock() just like > qemu_set_cloexec(). This makes code cleaner when working with arbit= rary > file descriptors that may not be sockets. See Patch 3. >=20 > 3. Clear O_NONBLOCK when a chardev receives file descriptors. From now= on QEMU > can assume that passed file descriptors are in blocking mode. Simpl= y use > qemu_set_nonblock(fd) if you want to enable O_NONBLOCK. See Patch 4= =2E Series: Reviewed-by: Eric Blake > v2: > * Rename socket_set_nonblock() in Patch 1 to avoid code churn [eblake]= > * Avoid qemu_set_block(-1) calls that clobber errno [quintela] >=20 > 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 --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org ------enig2GUTSOGCSMPGIUWFRHBOF Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.13 (GNU/Linux) Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJRUtyDAAoJEKeha0olJ0NqJHgH/jxmXqM+aDURPYoQpV/10fpQ Ld7yyLfrPc/a3LX8zkpuHHlAzT2Uk8SOlhG61KKgUIUBCvu2SNtlrRklfWbhA6g+ pcBg0QxMkoIjkeZ1FLK+cSIqMpyvYQrXqNDqJsm646B9hnZF/1QW18pn32EShy8B zFPAnLHmWwqGlyhgZVff60V42O380DdR28Ogm/ca8lrIVb1HviseZpyFVsVJMSII GAcLmBNf9IZlElC0cBdrjvpwjc6B65/m87vec3tohm5XAoMqaCPR3HSGDTYnZJ69 BlDv0Pe694N3VuD4ldG5XMm3RbW6xg9WyY9MxusvoZa3DO44EqhP97/I2yHoJAs= =bFTb -----END PGP SIGNATURE----- ------enig2GUTSOGCSMPGIUWFRHBOF--