Closed yshui closed 1 year ago
my suggestion would be to do the /dev/null redirections earlier
This somehow reminds me of https://bugs.gentoo.org/547916.
I have a patch for this pending, but want to wait until next release cycle.
iirc, some libcs correct this automatically on startup (musl I think is the most prominent one here).
there is a forgotten patch of mine that I submitted to glibc, that never got merged, if need be, I could bring it up again: https://sourceware.org/pipermail/libc-alpha/2020-August/117083.html
adding this to the list of bugs found due to weird [012] FDs would probably help too
My opinion is that fixing that at *libc level is conceptually wrong - applications should be able to freely decide how to handle their descriptors. What does POSIX say about that?
@kaniini Please add you patch as a PR - I do not expect that to be too complex
the thread contains discussion about standards, my take is that it's a dangerous potential (and very real) footgun; glibc already exhibits this behavior for SUID binaries, and as said, musl does too for all binaries
@kaniini Please share your patch
PS. I already proposed a fix in #266
No sure if this should be considered a bug or not.
If udevd is started without any fd, some of the fd created during setup will occupy fd 0, 1, 2. And they will be overridden by:
https://github.com/gentoo/eudev/blob/79f7650b59c4f9261b5e9e76e3c57cfc90b2dc6b/src/udev/udevd.c#L1293-L1295
cause udevd to loss those essential fds and fail.