-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
libpod: change mountpoint ownership when creating overlays on top of external rootfs #11937
libpod: change mountpoint ownership when creating overlays on top of external rootfs #11937
Conversation
@giuseppe PTAL |
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 still see an issue when using this patch:
# bin/podman run --uidmap 0:1000:1000 --rm --rootfs /tmp/foo:O bash
Error: make `/var/lib/containers/storage/overlay-containers/1df9c17515d7ebb92d6b36fa2790c5c7c501a7509a0acffefc03711c9b96909f/rootfs/merge` private: Permission denied: OCI permission denied
libpod/container_internal.go
Outdated
@@ -1515,6 +1515,10 @@ func (c *Container) mountStorage() (_ string, deferredErr error) { | |||
} | |||
|
|||
mountPoint = overlayMount.Source | |||
// change ownership of `merged` created from overlay on top of external rootfs | |||
if err := os.Chown(mountPoint, c.RootUID(), c.RootGID()); err != nil { |
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 think we need to map the /merge
directory for the overlay mount (and make sure it is accessible with makeAccessible
) not the mount point.
ff76123
to
0e0f607
Compare
b642825
to
638781e
Compare
libpod/container_internal.go
Outdated
if err != nil { | ||
return "", errors.Wrap(err, "unable to get host UID and host GID") | ||
} | ||
if err := chown.ChangeHostPathOwnership(mountPoint, true, int(hostUID), int(hostGID)); err != nil { |
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 can't be recursive, otherwise we change the ownership of each file in the underlying rootfs
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.
yes changed to false should we add to man page, that users are responsible for ownership configs of underlying rootfs.
…of external rootfs Allow chainging ownership of mountpoint created on top external overlay rootfs to support use-cases when custom --uidmap and --gidmap are specified. Signed-off-by: Aditya Rajan <[email protected]>
638781e
to
9500e11
Compare
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
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: flouthoc, giuseppe, rhatdan The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Allow chainging ownership of mountpoint created on top of external overlay
rootfs to support use-cases when custom --uidmap and --gidmap are
specified.
TLDR
Supports
uidmap
andgidmap
with overlays on top of external rootfs specified with--rootfs </path>:O
Example