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=-3.3 required=5.0 tests=MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 5812 invoked from network); 27 Jun 2022 10:39:04 -0000 Received: from mother.openwall.net (195.42.179.200) by inbox.vuxu.org with ESMTPUTF8; 27 Jun 2022 10:39:04 -0000 Received: (qmail 16002 invoked by uid 550); 27 Jun 2022 10:39:01 -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 15970 invoked from network); 27 Jun 2022 10:39:00 -0000 From: "Laurent Bercot" To: musl@lists.openwall.com, "Nick Peng" Date: Mon, 27 Jun 2022 10:38:50 +0000 Message-Id: In-Reply-To: References: <20220625125110.GV1320090@port70.net> User-Agent: eM_Client/9.0.1708.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable Subject: Re: [musl] BUG: Calling readdir/dirfd after vfork will cause deadlock. >We can't close all file handles by iterating over all file handles=20 >number, because the maximum number of files limit is set very large,=20 >the performance of this method is too poor. >And we can't use fork, fork will fail because of vm.overcommit_memory. >In order to optimize this, the method we used is to read the file=20 >handes in /proc/self/fd directory and close the file handles one by=20 >one. This may be a rare instance where close_range(2) is useful, if you don't mind being restricted to Linux (>=3D 5.9) and FreeBSD. https://man7.org/linux/man-pages/man2/close_range.2.html -- Laurent