Functionality for pseudoterminals in linux sandbox#14072
Functionality for pseudoterminals in linux sandbox#14072crydell-ericsson wants to merge 6 commits intobazelbuild:masterfrom
Conversation
aiuto
left a comment
There was a problem hiding this comment.
This review is just general comments. I don't know enough about the sandbox to determine if this is a general purpose patch, or if we'll be back for a new design the second someone wants it for BSD or NIX. Also, it is not clear to me from the comments in #5373 that we should even do this.
| "Explicitly enable the creation of pseudoterminals for sandboxed actions." | ||
| + " Some linux distributions require setting the group of the user to 'tty'" | ||
| + " inside the sandbox in order for pseudoterminals to function. If this is" | ||
| + " causing issues, this flag can be disabled to enable other groups to be used.") |
There was a problem hiding this comment.
It does not look like there is any option to use other gid values.
There was a problem hiding this comment.
The intended meaning is that setting the flag would override anything that would otherwise alter the gid within the user namespace, e.g. if --sandbox_fake_username is set or if REQUIRES_FAKEROOT evaluates to true. I could rephrase this if it's unclear.
|
We'll need to have someone who owns sandboxing review this. I added @philwo because of comments in the original bug. |
|
Thank you @crydell-ericsson! Ideally I'd like to avoid adding yet another flag... is there a way to automatically detect what the right thing to do is? Could we just always mount |
I think we should be able to always have
I'm not sure how this could be done in a way that would still let this functionality be used by an unprivileged user. From the man page of user_namespaces(7): Ideally you would be able to make two gid mappings, one tty->tty mapping and one arbitrary mapping for the gid in the parent namespace. This would not be possible if we want to run bazel as an unprivileged user, since only a single mapping can be done without granting the CAP_SETGID capability to the process in the parent namespace. |
|
Just thought I'd check in on the progress of this pull request; is there any additional information needed for this? |
|
Thank you for the information, @crydell-ericsson. It's too bad that the best solution requires CAP_SETGID. 😞 I agree with your thoughts. @larsrc-google Shall we merge this as is? Looks clean to me and all changed behavior is behind a flag. |
82212be to
d9c4266
Compare
4aef41d to
ab9ae7f
Compare
|
@crydell-ericsson This PR is out of date, could you update it? |
As brought up in issue #5373 , the Linux sandbox does not allow processes that run inside it to open pseudoterminals. These changes enable this by addressing the two main underlying issues:
/dev/ptscan not be read-only if a new pseudoterminal is to be created. These changes makedev/ptswritable when remounting file systems during sandbox initialization.These changes introduce the
-Pflag tolinux-sandboxin order to control whether or not the changes are applied, and the--sandbox-explicit-pseudoterminaltobazelin order to set this when calling bazel.