Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <em46e362eb-1420-4bf7-98b2-80583e9e97df@7a471302.com>
Date: Sat, 20 Sep 2025 11:45:41 +0000
From: "Laurent Bercot" <ska-dietlibc@...rnet.org>
To: musl@...ts.openwall.com
Subject: Re[2]: closefrom and close_range wrappers


>I actually found a case where it is *necessary* to close unknown fds
>for correctness.  Consider a wrapper program that runs a child process
>and waits for it to exit.  In this case, it is necessary to pass
>unknown fds into the child process, but they *must* be closed in the
>parent process!  Otherwise, the file descriptors would be kept open
>even after the child process had closed them, which is wrong.  For
>instance, code reading a pipe will not get EOF as long as the parent
>process has it open.

  If the parent is a wrapper program, shouldn't it have the exact same
behaviour as its child, and in particular exit (as close an
approximation as possible of) when the child does, with (a close
approximation of) the same exit code?

  Wrappers wrap everything, and events that usually trigger on a 
program's
death will this time trigger on the wrapper's death. This is expected
behaviour, and I don't think it's a valid use case for close_range.

--
  Laurent

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.