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=-2.8 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED 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 AD80126D57 for ; Thu, 26 Sep 2024 18:42:36 +0200 (CEST) Received: (qmail 5557 invoked by uid 550); 26 Sep 2024 16:42:31 -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 x-ms-reactions: disallow Received: (qmail 5523 invoked from network); 26 Sep 2024 16:42:30 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmx.net; s=s31663417; t=1727368942; x=1727973742; i=nullplan@gmx.net; bh=WkZ+0tppiMA0h8knK1doBZoOTi8ba83CgRs9gdsDqi4=; h=X-UI-Sender-Class:Date:From:To:Cc:Subject:Message-ID:References: MIME-Version:Content-Type:In-Reply-To:cc: content-transfer-encoding:content-type:date:from:message-id: mime-version:reply-to:subject:to; b=ffkG/3spi7HHz2fYvVyBjWukg6V/UvttGiyVX6vs3TKEzIpySAJVdd2vwGgLE3H4 Zew2H7cLZE8bGECjqU6z9QLaJKDzEGpBZPbAFensglNQSNH1D3gxhhRsmpBvQ4ax/ uoFlXSJFoTX1C3BXcQkOAtZh52XfCrU4wUWIpCTxk3ay3OwmpqNJsSqmpbgB7uyYO PY3Ro8VHjlC5bAsp/oksDZwxFNqO25jwHpvonVicLlJy6zkVuUuYCpD7ecZkpxkNK qfzHsuMQEQbgKtvy+cA5kJNH59wDmJAzX2OV3e4+dHoTEBnwMzm9tnontgxY0lUBK K9GwGyKbCSeM+tf3aA== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Date: Thu, 26 Sep 2024 18:42:20 +0200 From: Markus Wichmann To: musl@lists.openwall.com Cc: "Jef STEELANT (EXT)" Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Provags-ID: V03:K1:531M9Tke6uq1xeesUT9qD0lCe+v6JNfQFfVHAHatON4aQNOIAzE VFapF5HsREn5/HaDqNEKiVhYjcfgtIxZT0OBYBKBBJG2nSBFiSFcP+fq0tJxlQrHdjwVEVj urulYOGs108rn+ECsVFgqpcM3d8+0wLzdVz/CmlYGcjm/mXdDFqAqIvEvYj57rq3YiK6nxb z0oY7EURK+nxOWc3uvy+Q== UI-OutboundReport: notjunk:1;M01:P0:4L0GTuTuyfw=;OeB/heRdMG88oTHbzHlhPFpuiYt uZWVE/caRrJtbC4GugRGf001lUR6o5UVDRF94ohkqiUjuEL5OoTacrOyPm4vl503e2V1hMQ8e Heeokra2BtmkBTbsf4ldHNrJUR0FnBPSrmkEVUcbUfqNouCZy7hlP+beVLMO/xPAI/8N5hY5d MNs5eznsO5v+zGRmf8/bTPDyi0GB736OkPpszvfNr/J+Do7eTDle0yWKYXIte7dOb4h9DP48H oJ2PmIHUh5ae1sKKFE4mLhSJ2DRyidoF9G4o8YepYIbzZVS9w0kL+Rt7RPEBBYmGDjPNRfC9T ibf21h7OvI4wGHDYVdNltSpy5nrPYDTh80OZ6FIX65+K6sk3NxHbsq65XdJUdRTN83abSAcHZ +rVbcTUMA+zzAmZhrXXzA02NWRBb4xi2XTPRG8J9fw7cwpA7jCE06HbNw8S7MQst14PfJy1co /mRJMScNSLgofELNj303lcEXnN/krbM3cNe4FRivBHZ+Pc7hr4o6+Po8bxKUAFxObaNxo0tOv kFu3uDeQGT8iAVZ4h4EHGiIsNwHiKW2zjwJu6X8+B/Gv7NvV1jJ8knPRQWmfFpXuoap/jai2c g1Lhu36bFuFFA3Nz67/SqcELEwzEa6afgRdbd45JfdO9GgRgRxHpcmePrYva6yNODcpTmM9uJ PN7/UgVDEJCjmQMKJK/9FkzxXaDbiMM0HHZ/uo9qXQW9OtRStM7tZERVW6XkIjcZhOGAkDB5t FEoJPYCIO6KRRVQcWMtCeg7yK1WxUc6/JNEAyHr7NQEhNaMF9kkl23rnNgKMQxyInfTYxDWax EsX7nWNTPoQftPlNfZ8KMqtQ== Subject: Re: [musl] syslog does not detect a closed file descriptor Am Thu, Sep 26, 2024 at 09:08:59AM +0000 schrieb Jef STEELANT (EXT): > The syslog implementation does not detect if the file descriptor of > /dev/log is closed, and keeps on logging to an invalid fd. > This happens for instance when using lxc with musl libc ( see issue > https://github.com/lxc/lxc/issues/4485). LXC will at a certain point > close the fd of /dev/log, in the assumption that a next call to syslog > will detect an EBADF when writing data, and that the log will be > reopened. glibc does this, but musl does not. It would be better if > syslog would either stop logging to the invalid fd, or reopen the log > when s send returns EBADF. This is why you do not close FDs you do not own. The application does not own the socket FD for the syslog; it belongs to libc. And the application can portably request the FD be closed by calling closelog(). And it should, because that will restore the initial state in that file, and cause the log to be opened again. Using EBADF for anything is a bad idea in the lib, since the lib must work with multiple threads, and in a multi-threaded process EBADF means "you could have sent this data to the wrong FD". I think the simplest solution is for lxc to just call closelog() before closing the other FDs. Ciao, Markus