On 19/04/23 18:16, Sergey Bugaev wrote: > On Wed, Apr 19, 2023 at 11:45 PM Adhemerval Zanella Netto >>>> is this really needed now? playing silly games with this fds will always >>>> result in silly prices. >> >> My understanding of this code is to enforce that on setuid program with >> stdin/stdout/stderr closed any operation fail. > > Yes, but is that still considered desirable / a good idea? As opposed > to making such operations no-op successfully (opening /dev/null with > the expected mode). > Good question, this is essentially a hardening for setsuid binaries since opening the file in the *expected* way is not the intended behavior (even though the C runtime expects that STDIN_FILENO, STDOUT_FILENO, and STDERR_FILENO are in fact opened). As far I could check, this is really a glibc extension (both FreeBSD and OpenBSD does not seem to add such hardening). I am not really sure how effective is this hardening, it seems more a development one to enforce that system daemon are spawned correctly.
- [RFC PATCH v2 1/7] misc: Convert daemon () to GNU... Sergey Bugaev
- Re: [RFC PATCH v2 1/7] misc: Convert daemon ... Adhemerval Zanella Netto
- Re: [RFC PATCH v2 1/7] misc: Convert dae... Samuel Thibault
- [RFC PATCH v2 2/7] misc: Ignore SIGHUP in daemon ... Sergey Bugaev
- Re: [RFC PATCH v2 2/7] misc: Ignore SIGHUP i... Adhemerval Zanella Netto
- [RFC PATCH v2 4/7] csu: Fix standard fds' mode Sergey Bugaev
- Re: [RFC PATCH v2 4/7] csu: Fix standard fds... Cristian Rodríguez
- Re: [RFC PATCH v2 4/7] csu: Fix standard... Sergey Bugaev
- Re: [RFC PATCH v2 4/7] csu: Fix stan... Adhemerval Zanella Netto
- Re: [RFC PATCH v2 4/7] csu: Fix ... Sergey Bugaev
- Re: [RFC PATCH v2 4/7] csu:... Adhemerval Zanella Netto
- Re: [RFC PATCH v2 4/7] ... Cristian Rodríguez
- Re: [RFC PATCH v2 4/7] ... Adhemerval Zanella Netto
- Re: [RFC PATCH v2 4/7] ... Paul Eggert
- [RFC PATCH v2 3/7] Use O_CLOEXEC in more places (... Sergey Bugaev
- Re: [RFC PATCH v2 3/7] Use O_CLOEXEC in more... Adhemerval Zanella Netto
- Re: [RFC PATCH v2 3/7] Use O_CLOEXEC in ... Samuel Thibault
- [RFC PATCH v2 6/7] include/fcntl.h: Define O_IGNO... Sergey Bugaev