From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-oa1-x35.google.com (mail-oa1-x35.google.com [IPv6:2001:4860:4864:20::35]) by sourceware.org (Postfix) with ESMTPS id 2C1B13858D33 for ; Wed, 19 Apr 2023 19:40:39 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 2C1B13858D33 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-oa1-x35.google.com with SMTP id 586e51a60fabf-1879e28ab04so124846fac.2 for ; Wed, 19 Apr 2023 12:40:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1681933238; x=1684525238; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=nmVaQKXtgVn/ycE5v21LG0vsyMD+VUaNYvkxsKygNKA=; b=k8ScgypxFgiVi04CVze/1rIsv2wgWaNuznkXAVQlT4CCAamUPpGZLg9QEN3/Kcrm0p 2sQwSJyAy6s9mrAlAhwyMQqBJs9kQW23nkg+GGYoOTyFDYzQDda0fVbc+AdyAbo6Lblz CJW+0NxcEN22153ex2EhNxH3IWleUhCGe40Q8NRctW/LC96lHsiRGkzUnlK87o0i661Y QRZ9mAXJNE3r6weFbSpaeek7ZfuzPnbh3CGHntdH4igCIgPAHDC3gOcA+G/t2dF/ubPP bFco3UgEL7V8kiIpWFWsX/WwmddHBZjDz+f0l8ntHlzq2GHNLpge6WMFN+jH1J+1OVH5 LcGA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681933238; x=1684525238; h=content-transfer-encoding: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=nmVaQKXtgVn/ycE5v21LG0vsyMD+VUaNYvkxsKygNKA=; b=Jzy8UiTduCVjFfKYOeIERe3u59K+/j8pzhrJEVDjgp1Gou4qNQQIxK7g4qWt6i00i/ vOg1y7pD4qUNCUEnCEtAlb5ZmNib+sMVzIH8KdePCLUnpjTI15AVhgHQzBhousGtYIxO HPjGQ+AdLN491zt+B04pr4GBeKsQIpWLCUL8UbXfy+ohYVhVjHwwdk73Br/dO2n+uJ+y /0Gns6/tBCUVN2+k3urXIOFJgv2kpZ04nJfL4Xua0T/rfPk8iCGR6UybrasRxMsiyCqq mukRbp01g2ghiaL1YQyUNa9qir1KHPNFJR3MrI9hLfRhyMi/r7/3nylJE2C6rC/YJrhw aiHQ== X-Gm-Message-State: AAQBX9cGSw6X3/BB4/M+kwl+91H8iU15itS+6armWMeR+sujw4FS++X/ /RrOxy8qSJ3ABl2d54CCCI+ebybY0OVZccj8M4k= X-Google-Smtp-Source: AKy350bVZ8uw3RNxhiZPCd5mK3TS7tHXduc3cv2nDYxnzQsic7TOIXCWpafXEcxZ6PEOWeZTZX75Qo1ZmXYm7Stn8lQ= X-Received: by 2002:a05:6870:9712:b0:17a:c102:b449 with SMTP id n18-20020a056870971200b0017ac102b449mr561837oaq.59.1681933238549; Wed, 19 Apr 2023 12:40:38 -0700 (PDT) MIME-Version: 1.0 References: <20230419160207.65988-1-bugaevc@gmail.com> <20230419160207.65988-5-bugaevc@gmail.com> In-Reply-To: From: Sergey Bugaev Date: Wed, 19 Apr 2023 22:40:27 +0300 Message-ID: Subject: Re: [RFC PATCH v2 4/7] csu: Fix standard fds' mode To: =?UTF-8?Q?Cristian_Rodr=C3=ADguez?= Cc: libc-alpha@sourceware.org, bug-hurd , Samuel Thibault , Adhemerval Zanella Netto Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.4 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Wed, Apr 19, 2023, 22:13 Cristian Rodr=C3=ADguez wrote: > 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.. Ah, I see, so I just failed to trace it through git blame / git log, because the commit renaming this file sysdeps/generic/check_fds.c -> csu/check_fds.c has been done wrong (or maybe this is an artefact of the migration to Git). So which way would you prefer it, left as-is (i.e. without this patch) or switched back? If we leave it as is, we should at least add a comment explaining what's going on, for the next person who stumbles into this and also fails to trace it through git blame. > I see it is used only for SUID statically linked binaries. I might be missing something, but why statically linked only? I don't see anything like that in elf/Makefile (but maybe I don't know where to look, please tell me!), and also the same behavior is certainly exhibited by dynamically linked executables too. That ls -l I posted above is from a dynamic executable. > is this really needed now? playing silly games with this fds will always = result in silly prices. Sergey