Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <6e064001-8a2a-4112-9180-7b26c5c86044@gmail.com>
Date: Sat, 20 Sep 2025 14:36:16 -0400
From: Demi Marie Obenour <demiobenour@...il.com>
To: musl@...ts.openwall.com, Laurent Bercot <ska-dietlibc@...rnet.org>
Subject: Re: closefrom and close_range wrappers

On 9/20/25 12:33, Laurent Bercot wrote:
> 
>> I think he was talking about a case where the wrapper's parent and child
>> are trying to communicate some sort of event through FD closure, and the
>> event is not necessarily the child's death. A use case might be a DHCP
>> client signalling to a network manager that a lease was obtained,
>> without using Freedesktop COM, I mean D-Bus. The DHCP client must
>> continue to run to renew the lease when it ends. Although the common
>> solution in the DHCP clients I am aware of is to background the program,
>> which would also make the wrapper exit.
> 
>   If the event is not the child's death, then the child needs to know
> the fd in order to close it. If it is a known fd, then the wrapper can
> close it as well. If the number of the fd is transmitted through a
> complex protocol that the wrapper cannot intercept, that's pretty bad
> architecture and a pretty bad place to insert a wrapper, and at this
> point close_range is just providing the pig with a vanity mirror to help
> it put the lipstick on.
The sad reality is that GLib decided [1] to not bother with setting
O_CLOEXEC.  GLib is incredibly widely used, so it isn't feasible
for a library to be incompatible with it.  In turn, this requires
that library code that spawns a process use close_range() or
an equivalent operation to do so.

Also, the use of GSubprocess means that leaked file descriptors are
not a reliable means of process supervision in 2025.  Linux cgroups
and illumos contracts *are*.  The BSDs don't have any reliable method
I know of beyond process groups

[1]: https://mail.gnome.org/archives/gtk-devel-list/2015-March/msg00038.html
-- 
Sincerely,
Demi Marie Obenour (she/her/hers)
Download attachment "OpenPGP_0xB288B55FFF9C22C1.asc" of type "application/pgp-keys" (7141 bytes)

Download attachment "OpenPGP_signature.asc" of type "application/pgp-signature" (834 bytes)

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.