-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Open all files with O_NOCTTY #24307
Comments
This seems like a somewhat obscure flag to be passing by default, but are you aware of any other libraries which do this by default? |
All software dealing with TTY (i.e. TUI tools, startup daemons…) does or should handle controlling TTY, including the libraries they could use (e.g. OpenSSL, ). Cf. Debian code for more examples. Anyway, it seems a sane default option needed for deterministic behavior. Not using If a daemon, which does/must not have a controlling TTY, open a file or file descriptor form an insecure location, it could get an unwanted controlling TTY. It need to take care of all This could also have an impact on sandboxing (e.g. with gaol) or cause unattended/inconsistent behavior because of signal handling. |
cc #26470 |
Triage: I am not aware of any changes here. @rust-lang/libs is this something we still want to consider? |
The flag does seem appropriate to use by default from reading the docs: "If set and path identifies a terminal device, open() shall not cause the terminal device to become the controlling terminal for the process." That implies to me that std is unsuitable for opening TTY devices. |
This was discussed during libs triage today and the decision was to close. This has been open quite awhile and looking back there doesn't seem to be strong motivation listed here for why we should pass this flag. If this is still an issue though please feel free to open a new issue! |
The documentation should mention, as says @brson, that the standard library is unsuitable for opening a TTY device. |
To avoid inconsistent behavior, especially for daemons, the libstd should (by default) use
O_NOCTTY
for all open files.The
OpenOptions
builder could be extended to switch this flag off.cc #24306
The text was updated successfully, but these errors were encountered: