From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-vs1-f51.google.com (mail-vs1-f51.google.com [209.85.217.51]) by sourceware.org (Postfix) with ESMTPS id 578FC3858D33 for ; Wed, 19 Apr 2023 19:13:16 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 578FC3858D33 Authentication-Results: sourceware.org; dmarc=fail (p=none dis=none) header.from=opensuse.org Authentication-Results: sourceware.org; spf=none smtp.mailfrom=cristianrodriguez.net Received: by mail-vs1-f51.google.com with SMTP id ada2fe7eead31-42c4a6978fcso7437137.1 for ; Wed, 19 Apr 2023 12:13:16 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681931596; x=1684523596; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=jTKPXeu8V3vLWqwu1FFL4DrLzS3wMufn6WIkhf2ni1A=; b=TfTzqj9zKwi99kwcBjBJYAnOeDEMN2T0Q7mZWIUU/QWpty6MytTcrwMVAV6zXQuXrE Jyq8Fm8kbAIdWOXgfaWatfMJIuV2mooVmnc9jfYI96Z31guDQHGpcvjxNp9DWU2gSgHx fW5MJQpc2YMboq70wuPdmDN6wpcZaYFDejA/YS54rlxG+vQPRkflZASp92GZgq72/07c NOneR4tgZoTBJVwIqd58i0vrkPc/CXosm1hUmjTVtzTvp9U2MDJZJy37CH7a6zIcxwtV zlwSGCNwY04uEuzcSXdQz/U2+ueBB2UZof2suMapfOyFxRUroKRp3knx3Hads2wkyUV8 eaGw== X-Gm-Message-State: AAQBX9doPGhAX4f67UyP0IZJgKlE7JyMM2zlwyVMGGxZ/bmIjTyrnZjR H5sFha3OjAJkyONrNyjlZZ7xtWoQNUSWOZARIH0Kfw== X-Google-Smtp-Source: AKy350bQMmywg9G/a7KjBYZ7i6XfQBpmNFGcgx20eo0ROJv/Aswf8gMBXYmAt8zCjcLIqMqMb2ZxRQrX4PlESsAtZQQ= X-Received: by 2002:a05:6122:99d:b0:440:77f0:b344 with SMTP id g29-20020a056122099d00b0044077f0b344mr5971886vkd.0.1681931595759; Wed, 19 Apr 2023 12:13:15 -0700 (PDT) MIME-Version: 1.0 References: <20230419160207.65988-1-bugaevc@gmail.com> <20230419160207.65988-5-bugaevc@gmail.com> In-Reply-To: <20230419160207.65988-5-bugaevc@gmail.com> From: =?UTF-8?Q?Cristian_Rodr=C3=ADguez?= Date: Wed, 19 Apr 2023 15:13:04 -0400 Message-ID: Subject: Re: [RFC PATCH v2 4/7] csu: Fix standard fds' mode To: Sergey Bugaev Cc: libc-alpha@sourceware.org, bug-hurd@gnu.org, Samuel Thibault , Adhemerval Zanella Netto Content-Type: multipart/alternative; boundary="0000000000004d537305f9b537fd" X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,HEADER_FROM_DIFFERENT_DOMAINS,HTML_MESSAGE,KAM_DMARC_NONE,KAM_DMARC_STATUS,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: --0000000000004d537305f9b537fd Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Wed, Apr 19, 2023 at 12:02=E2=80=AFPM Sergey Bugaev = wrote: > stdin is supposed to be readable, stdout and stderr writable. Otherwise, > we get this: > > index de6dd716..ca4812cd 100644 > --- a/csu/check_fds.c > +++ b/csu/check_fds.c > @@ -90,7 +90,7 @@ __libc_check_standard_fds (void) > is really paranoid but some people actually are. If /dev/null > should happen to be a symlink to somewhere else and not the > device commonly known as "/dev/null" we bail out. */ > - check_one_fd (STDIN_FILENO, O_WRONLY | O_NOFOLLOW); > - check_one_fd (STDOUT_FILENO, O_RDONLY | O_NOFOLLOW); > - check_one_fd (STDERR_FILENO, O_RDONLY | O_NOFOLLOW); > + check_one_fd (STDIN_FILENO, O_RDONLY | O_NOFOLLOW); > + check_one_fd (STDOUT_FILENO, O_WRONLY | O_NOFOLLOW); > + check_one_fd (STDERR_FILENO, O_WRONLY | O_NOFOLLOW); > } > -- > 2.40.0 > Im a little bit lost on what it was supposed to do in this old form.. as the open flags are all wrong.. Changelog says: (__libc_check_standard_fds): Reverse modes so that common operations on the descriptors fail. So this was intended at some point in the past decades to make it fail.. I see it is used only for SUID statically linked binaries. is this really needed now? playing silly games with this fds will always result in silly prices. --0000000000004d537305f9b537fd--