bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [RFC PATCH v2 4/7] csu: Fix standard fds' mode


From: Cristian Rodríguez
Subject: Re: [RFC PATCH v2 4/7] csu: Fix standard fds' mode
Date: Wed, 19 Apr 2023 15:13:04 -0400



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.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]