From: "Cristian Rodríguez" <crrodriguez@opensuse.org>
To: Sergey Bugaev <bugaevc@gmail.com>
Cc: libc-alpha@sourceware.org, bug-hurd@gnu.org,
Samuel Thibault <samuel.thibault@gnu.org>,
Adhemerval Zanella Netto <adhemerval.zanella@linaro.org>
Subject: Re: [RFC PATCH v2 4/7] csu: Fix standard fds' mode
Date: Wed, 19 Apr 2023 15:13:04 -0400 [thread overview]
Message-ID: <CAPBLoAeAGnSFAmCCYJpZojya+mkU=-7ELkVf6-YRcsNhaNE=Jw@mail.gmail.com> (raw)
In-Reply-To: <20230419160207.65988-5-bugaevc@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1365 bytes --]
On Wed, Apr 19, 2023 at 12:02 PM Sergey Bugaev <bugaevc@gmail.com> 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.
next prev parent reply other threads:[~2023-04-19 19:13 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-19 16:02 [RFC PATCH v2 0/7] O_IGNORE_CTTY everywhere & misc fixes Sergey Bugaev
2023-04-19 16:02 ` [RFC PATCH v2 1/7] misc: Convert daemon () to GNU coding style Sergey Bugaev
2023-04-21 12:18 ` Adhemerval Zanella Netto
2023-04-22 11:47 ` Samuel Thibault
2023-04-19 16:02 ` [RFC PATCH v2 2/7] misc: Ignore SIGHUP in daemon () while forking Sergey Bugaev
2023-04-21 12:55 ` Adhemerval Zanella Netto
2023-04-19 16:02 ` [RFC PATCH v2 3/7] Use O_CLOEXEC in more places (BZ #15722) Sergey Bugaev
2023-04-21 12:55 ` Adhemerval Zanella Netto
2023-04-22 11:50 ` Samuel Thibault
2023-04-19 16:02 ` [RFC PATCH v2 4/7] csu: Fix standard fds' mode Sergey Bugaev
2023-04-19 19:13 ` Cristian Rodríguez [this message]
2023-04-19 19:40 ` Sergey Bugaev
2023-04-19 20:45 ` Adhemerval Zanella Netto
2023-04-19 21:16 ` Sergey Bugaev
2023-04-20 11:47 ` Adhemerval Zanella Netto
2023-04-20 12:06 ` Cristian Rodríguez
2023-04-20 15:13 ` Adhemerval Zanella Netto
2023-04-21 17:16 ` Paul Eggert
2023-04-19 16:02 ` [RFC PATCH v2 5/7] hurd: Make dl-sysdep's open () cope with O_IGNORE_CTTY Sergey Bugaev
2023-04-20 21:06 ` Samuel Thibault
2023-04-19 16:02 ` [RFC PATCH v2 6/7] include/fcntl.h: Define O_IGNORE_CTTY Sergey Bugaev
2023-04-19 16:02 ` [RFC PATCH v2 7/7] Use O_IGNORE_CTTY where appropriate Sergey Bugaev
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAPBLoAeAGnSFAmCCYJpZojya+mkU=-7ELkVf6-YRcsNhaNE=Jw@mail.gmail.com' \
--to=crrodriguez@opensuse.org \
--cc=adhemerval.zanella@linaro.org \
--cc=bug-hurd@gnu.org \
--cc=bugaevc@gmail.com \
--cc=libc-alpha@sourceware.org \
--cc=samuel.thibault@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).