-
Notifications
You must be signed in to change notification settings - Fork 427
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
Set workable permissions on OCI -> sandbox rootless builds #4522
Conversation
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
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.
looks good. Fixes the issue when testing locally for me
I did a build with this patch to test it, and it works with setuid-root singularity, but I still get this error when I run with -u:
|
Noting here that I chatted with @mem out of band on this, with particular reference to the comment above. The current state of this work is that:
Upshot is that I don't think this should be rushed for a 3.4.2. It is probably wise there is some thought on it over the weekend, and that it is picked up in the working group meeting Sylabs developers have, and we look to comment from other developers here too. |
There has been some general discussion about the permissions issue, thinking about the context of changes for
Note that with regard to the above, as @mem has pointed out above, you can create true With these points in mind, we plan to move forward to:
|
Setting WIP on this as need to ensure the perm change only comes in on sandbox destinations, and not in oci->sandbox->sif intermediate step to avoid regressing on #3880 in sif (via a different mechanism) |
Well - turns out we cant do the perm change on only sandbox destinations as we will hit #4532 then. Will revert to the full <=3.3. behavior of modifying perms directly on OCI extraction. This means that with regard to #3880 permissions changes on subsequent layers are honored properly during umoci extraction, but then mangled by us... so may not match 100% docker perms, even in a SIF. #4532 is going to need to be addressed by different means on |
This fix addresses #4524, where the recent change to use the umoci extracter for OCI layers can lead to sandboxes that cannot be mv'd across filesystems (leading to a build failure), or deleted/modified by the user. Return to the <=3.3 behaviour here, by modifying permissions on the temporary rootfs sandbox once it is extracted, and before the mv to its final location.
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.
It looks good for what we need right now.
Note that because walk is doing a depth-first traversal, and because readDirNames is reading all the directory entries at once, this is going to consume quite a bit of memory for large and deep directory structures (it's going to allocate memory for all the entries in a directory, recurse into one directory, allocate memory for all the entries there and keep going until it finds a directory without any further subdirectories; only when going back up it's going to start releasing the slices it allocated along the way). No need to fix this right now, but it's worth keeping it in mind.
Note for those looking at this in the future: this fix is only in the 3.4 branch. At this time the master (3.5) branch does not always make directories user-writable (and therefore deletable) and the current plan is to not change the permissions there, even though it is not backward compatible, in order to make it more compatible with other OCI compliant tools. |
With regard to the above comment, we have discussion sought on the mailing list here: https://groups.google.com/a/lbl.gov/forum/#!topic/singularity/wScrzv7_fxc |
Description of the Pull Request (PR):
We previously used a patched version of
image-tools
to extract OCI layers into a rootfs. This was patched to ensure all files and dirs extracted from a layer had minimum permissions such that when performing a rootless sandbox build:000
or similar permissionsIn 3.4.0 we switched to
umoci
for extractions, as it is more faithful to the content of the layers thanimage-tools
.umoci
handles (1) above. However, we need to fix (2) ourself, asumoci
will faithfully create a rootfs with000
files in it, which cannot be moved or triviallyrm'd
by the non-root user.This fixes or addresses the following GitHub issues:
Before submitting a PR, make sure you have done the following:
make testall
Attn: @singularity-maintainers