From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=MAILING_LIST_MULTI, RCVD_IN_MSPIKE_H2,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 25537 invoked from network); 18 Aug 2022 10:40:52 -0000 Received: from second.openwall.net (193.110.157.125) by inbox.vuxu.org with ESMTPUTF8; 18 Aug 2022 10:40:52 -0000 Received: (qmail 9851 invoked by uid 550); 18 Aug 2022 10:40:50 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Reply-To: musl@lists.openwall.com Received: (qmail 9816 invoked from network); 18 Aug 2022 10:40:49 -0000 MIME-Version: 1.0 Date: Thu, 18 Aug 2022 13:40:36 +0300 From: Alexey Izbyshev To: musl@lists.openwall.com In-Reply-To: References: <20220810130311.dwk7zxwkz32igrdm@yandex.com> <20220818003531.GG7074@brightrain.aerifal.cx> User-Agent: Roundcube Webmail/1.4.4 Message-ID: <85f359ccc0304862e92c39f58b08b770@ispras.ru> X-Sender: izbyshev@ispras.ru Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Subject: Re: [musl] [PATCH] add close_range() syscall wrapper On 2022-08-18 13:11, Érico Nogueira wrote: > On Wed Aug 17, 2022 at 9:35 PM -03, Rich Felker wrote: >> On Wed, Aug 10, 2022 at 01:03:11PM +0000, Guilherme Janczak wrote: >> > close_range() is a syscall present in FreeBSD 8.0 and Linux 5.9. glibc >> > 2.34 added a wrapper. >> > --- >> >> The existence of this operation has been controversial, and it's >> arguable that it should be excluded by policy not to support UB (it's >> UB to close fds you don't own that might be used internally by the >> implementation) though I'm not sure it really helps since folks who >> want to use it will just make the syscall directly. We should probably >> at least consider it for inclusion. > > I remember an idea to implement fallback logic, in case the syscall is > unavailable, had been mentioned. It would then avoid whatever fallback > code the application tried to implement, which might not be as > relevant, > now that opendir() can be called in a forked child. And I don't know if > there's interest in implementing anything more complex at all. > Glibc doesn't implement a fallback and explicitly says it in the manual. Using a different implementation in musl seems undesirable. Note that CPython since 3.10 can use close_range() in fork/vfork child for subprocess.Popen(close_fds=True) (which is the default), so it expects close_range() to be async-signal-safe. Alexey