-
Notifications
You must be signed in to change notification settings - Fork 234
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
drivers: chown root mount to root in the userns #1564
Conversation
chown the root mount to root in the userns so that it can be used by the container. Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
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.
LGTM
if err != nil { | ||
return err | ||
} | ||
return os.Chown(dir, rootIDs.UID, rootIDs.GID) |
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.
This is the parent of the "diff" directory, whose permissions are what we see when the filesystem is mounted.
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.
isn't it the directory that is used by Get
and it is used as the rootfs for the container?
Running these commands:
bin/buildah pull --storage-driver vfs busybox
bin/buildah from --storage-driver vfs --userns-uid-map 0:1000:65535 --userns-gid-map 0:1000:65535 busybox
dir=$(bin/buildah mount --storage-driver vfs busybox-working-container)
ls -lnd $dir
bin/buildah rm --storage-driver vfs -a
bin/buildah rmi --storage-driver vfs -a
without the patch I see:
dr-xr-xr-x. 11 0 0 120 Apr 12 18:09 .
drwx------. 5 1000 1000 4096 Apr 12 18:09 ..
drwxr-xr-x. 2 1000 1000 12288 Apr 12 18:09 bin
drwxr-xr-x. 2 1000 1000 6 Mar 13 19:39 dev
drwxr-xr-x. 3 1000 1000 100 Mar 13 19:39 etc
drwxr-xr-x. 2 66534 66534 6 Mar 13 19:39 home
drwxr-xr-x. 2 1000 1000 4096 Mar 4 00:15 lib
lrwxrwxrwx. 1 1000 1000 3 Mar 4 00:15 lib64 -> lib
drwx------. 2 1000 1000 6 Mar 13 19:39 root
drwxrwxrwt. 2 1000 1000 6 Mar 13 19:39 tmp
drwxr-xr-x. 4 1000 1000 29 Mar 13 19:39 usr
drwxr-xr-x. 4 1000 1000 30 Mar 13 19:39 var
with the patch I get:
dr-xr-xr-x. 11 1000 1000 120 Apr 12 18:10 .
drwx------. 5 1000 1000 4096 Apr 12 18:10 ..
drwxr-xr-x. 2 1000 1000 12288 Apr 12 18:10 bin
drwxr-xr-x. 2 1000 1000 6 Mar 13 19:39 dev
drwxr-xr-x. 3 1000 1000 100 Mar 13 19:39 etc
drwxr-xr-x. 2 66534 66534 6 Mar 13 19:39 home
drwxr-xr-x. 2 1000 1000 4096 Mar 4 00:15 lib
lrwxrwxrwx. 1 1000 1000 3 Mar 4 00:15 lib64 -> lib
drwx------. 2 1000 1000 6 Mar 13 19:39 root
drwxrwxrwt. 2 1000 1000 6 Mar 13 19:39 tmp
drwxr-xr-x. 4 1000 1000 29 Mar 13 19:39 usr
drwxr-xr-x. 4 1000 1000 30 Mar 13 19:39 var
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.
You're right, that's my mistake - I thought this was also in the overlay driver.
chown the root mount to root in the userns so that it can be used by the container.