From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.1 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, 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: from second.openwall.net (second.openwall.net [193.110.157.125]) by inbox.vuxu.org (Postfix) with SMTP id D9E4022059 for ; Thu, 25 Jan 2024 16:29:02 +0100 (CET) Received: (qmail 3899 invoked by uid 550); 25 Jan 2024 15:26:49 -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 3864 invoked from network); 25 Jan 2024 15:26:49 -0000 Date: Thu, 25 Jan 2024 16:28:47 +0100 From: Ismael Luceno To: Rich Felker Cc: musl@lists.openwall.com Message-ID: References: <20240125070950.28673-1-ismael@iodev.co.uk> <20240125140503.GG4163@brightrain.aerifal.cx> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240125140503.GG4163@brightrain.aerifal.cx> X-Spam: Yes Subject: Re: [musl] [PATCH] fix avoidable segfault in catclose <...> > Generally in musl, we prefer to trap on UB rather than allowing > forward progress, especially when the natural default action without > special casing it is to trap. POSIX says: "The catclose() function may fail if: [EBADF] The catalog descriptor is not valid. ..." Implying a known invalid descriptor like -1, or an invalidated descriptor should be handled. Glibc manual says: "... Errors can occur if the catalog descriptor catalog_desc is not valid in which case errno is set to EBADF." The linux manpage also says that once closed, the descriptor gets invalidated, which isn't what we're doing here. -- Ismael Luceno http://iodev.co.uk/