-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make newly created file descriptors non-inheritable #11399
Comments
I should link to the specific section of Python's PEP on the known issues with inheritable file descriptors. Note that there are both subtle bugs, as well as security issues, that can result from them. |
👍 For whatever value my opinion has, I do believe this is important, for the security reasons alone... |
It seems sensible to me to follow these other languages on this. |
Anyone know if node/io.js do this, or if they chose not to for some reason? edit: needed to read more carefully, I'm guessing they do since this is going through |
FWIW, this was also recently discussed by GLib developers: https://mail.gnome.org/archives/gtk-devel-list/2015-March/msg00038.html They decided that the only reliable solution is to close FDs before spawning new processes, as passing |
Cross referencing b3d6c25 here. Also, I believe that when EDIT: quoting from the PEP linked above:
|
Currently, when a subprocess is executed in julia, the child process inherits all julia file descriptors that are currently open at the moment of
exec
(this is true at least on Linux). There are many good reasons to instead make file descriptors non-inheritable by default -- I will point toward Python's PEP on the subject, which says it all much better than I could. In particular, it notes that (in addition to Python) Perl, Go, and Ruby each make non-inheritable file descriptors the default.As mentioned in #8295, libuv already opens all files with non-inheritable file descriptors. However, the
Base.open
function callsios_file
, which does not set theO_CLOEXEC
/FD_CLOEXEC
flag by default.So here's a possible path forward:
ios_file
is one; there are likely a few others, too.O_CLOEXEC
inios_file
leads to all tests passing in Julia, so this is a good sign.)The text was updated successfully, but these errors were encountered: