-
Notifications
You must be signed in to change notification settings - Fork 585
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
tty: Only store the stdin fd when it corresponds to a tty #1455
base: criu-dev
Are you sure you want to change the base?
Conversation
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## criu-dev #1455 +/- ##
============================================
- Coverage 70.68% 70.67% -0.01%
============================================
Files 133 133
Lines 33321 33317 -4
============================================
- Hits 23552 23548 -4
Misses 9769 9769
☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the code. I think that there is no point to put an fd into fdstore if it would not be used from fdstore, as self_stdin_fdid is currently only used if stdin_isatty == true.
Doing otherwise can lead to problems when using inherit-fd on stdin as
it gets closed.
But, can you please explain how adding the fd to fdstore can results in the original fd been closed?
When using Line 1599 in f1cc40c
This sends stdin into the fdstore, and closes stdin. From that point, fd=0 is now closed, and the tty code tried to use it again. |
Probably we can instead don't allow --inherit-fd on 0-2 standard io fds? upd: not instead but also |
I remember having a similar discussion in #681 |
Nice note. Seems like the problem of reusing 0-2 fds was already there with opts.ps_socket, and we've had "keep_fd" logic to protect from it, but we've removed it, relying that opts.ps_socket just would not use 0-2. |
A friendly reminder that this PR had no activity for 30 days. |
f392ea1
to
4d137b8
Compare
Let's save some place in fdstore by not adding fd when it is unused. Also let's remove now excess stdin_isatty. Co-authored-by: Nicolas Viennot <[email protected]> Signed-off-by: Pavel Tikhomirov <[email protected]>
@avagin I reworked it:
|
Else inherit_fd_move_to_fdstore will close std fds and options like --shell-job will be broken. Signed-off-by: Pavel Tikhomirov <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Doing otherwise can lead to problems when using inherit-fd on stdin as
it gets closed.