Richard W.M. Jones
2019-Aug-01 09:06 UTC
Re: [Libguestfs] [nbdkit PATCH 4/8] Revert "RHEL 5: Define O_CLOEXEC and SOCK_CLOEXEC."
On Wed, Jul 31, 2019 at 04:31:32PM -0500, Eric Blake wrote:> This reverts commit 25206df20275aeff346d9b86adf5e9be99cc9e43. > > An upcoming patch wants to ensure no leaked fds from the server to a > child process. POSIX has required O_CLOEXEC since 2008, and although > current POSIX doesn't yet specify full atomic interfaces everywhere > such as SOCK_CLOEXEC, it does have an open bug since 2014 [1] > recommending the full set of interfaces that will be mandatory in the > next revision of POSIX. Most modern OS have caught up to that (RHEL 6 > and FreeBSD 10 support SOCK_CLOEXEC, for example), and we're doing > ourselves a disservice by using silent fallback instead of actively > detecting with compile failure on systems that are still behind. > > [1] http://austingroupbugs.net/view.php?id=411 > > Conflicts: > filters/xz/xzfile.c - The fallback moved from plugins/xz/xzfile.c (and > in fact has been dead code since commit c879d310 made it a filter) > plugins/file/file.c - context changes in the meantime > src/internal.h - Moved to server/internal.h > --- > server/internal.h | 8 -------- > filters/xz/xzfile.c | 4 ---- > plugins/example2/example2.c | 4 ---- > plugins/file/file.c | 4 ---- > plugins/streaming/streaming.c | 4 ---- > 5 files changed, 24 deletions(-) > > diff --git a/server/internal.h b/server/internal.h > index 80ab879c..6207f0cf 100644 > --- a/server/internal.h > +++ b/server/internal.h > @@ -50,14 +50,6 @@ > #define UNIX_PATH_MAX 108 > #endif > > -#ifndef O_CLOEXEC > -#define O_CLOEXEC 0 > -#endif > - > -#ifndef SOCK_CLOEXEC > -#define SOCK_CLOEXEC 0 > -#endifAs far as I can see Haiku (hrev52698) has O_CLOEXEC but NOT SOCK_CLOEXEC. As this version is a little old I'll do an update and see if newer versions support it. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-builder quickly builds VMs from scratch http://libguestfs.org/virt-builder.1.html
Richard W.M. Jones
2019-Aug-01 09:15 UTC
Re: [Libguestfs] [nbdkit PATCH 4/8] Revert "RHEL 5: Define O_CLOEXEC and SOCK_CLOEXEC."
On Thu, Aug 01, 2019 at 10:06:01AM +0100, Richard W.M. Jones wrote:> As far as I can see Haiku (hrev52698) has O_CLOEXEC but NOT > SOCK_CLOEXEC. As this version is a little old I'll do an update and > see if newer versions support it.I'm on hrev53313+1 which also doesn't appear to have SOCK_CLOEXEC (nor does it have accept4). Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-p2v converts physical machines to virtual machines. Boot with a live CD or over the network (PXE) and turn machines into KVM guests. http://libguestfs.org/virt-v2v
Eric Blake
2019-Aug-01 10:06 UTC
Re: [Libguestfs] [nbdkit PATCH 4/8] Revert "RHEL 5: Define O_CLOEXEC and SOCK_CLOEXEC."
On 8/1/19 4:15 AM, Richard W.M. Jones wrote:> On Thu, Aug 01, 2019 at 10:06:01AM +0100, Richard W.M. Jones wrote: >> As far as I can see Haiku (hrev52698) has O_CLOEXEC but NOT >> SOCK_CLOEXEC. As this version is a little old I'll do an update and >> see if newer versions support it. > > I'm on hrev53313+1 which also doesn't appear to have SOCK_CLOEXEC (nor > does it have accept4).Ouch. Then I'm seriously thinking of a followup patch which either forces SERIALIZE_ALL_REQUESTS on all plugins when SOCK_CLOEXEC is missing, or which adds a bool to the plugin interface that the plugin sets to true if it does not fork (default to false), and where we force SERIALIZE_ALL_REQUESTS plugins which have not set it to true (most of our in-tree plugins can set the bool to true). -- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3226 Virtualization: qemu.org | libvirt.org
Apparently Analagous Threads
- Re: [nbdkit PATCH 4/8] Revert "RHEL 5: Define O_CLOEXEC and SOCK_CLOEXEC."
- Re: [nbdkit PATCH 4/8] Revert "RHEL 5: Define O_CLOEXEC and SOCK_CLOEXEC."
- [nbdkit PATCH 4/8] Revert "RHEL 5: Define O_CLOEXEC and SOCK_CLOEXEC."
- [nbdkit PATCH v2 04/17] Revert "RHEL 5: Define O_CLOEXEC and SOCK_CLOEXEC."
- [nbdkit PATCH 0/8] fd leak safety