Skip to content
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

Merged
merged 1 commit into from
Apr 12, 2023

Conversation

giuseppe
Copy link
Member

chown the root mount to root in the userns so that it can be used by the container.

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>
@rhatdan
Copy link
Member

rhatdan commented Apr 12, 2023

LGTM

Copy link
Collaborator

@flouthoc flouthoc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@flouthoc flouthoc merged commit 4cc5edf into containers:main Apr 12, 2023
if err != nil {
return err
}
return os.Chown(dir, rootIDs.UID, rootIDs.GID)
Copy link
Member

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.

Copy link
Member Author

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

Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants