-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Fix/improve pkg/storage.InitFSMounts #5676
Fix/improve pkg/storage.InitFSMounts #5676
Conversation
> $ ./bin/podman run -v /tmp:/tmp alpine true; echo $? > 0 > $ ./bin/podman run -v /tmp:/tmp:ro alpine true; echo $? > 0 > $ ./bin/podman run -v /tmp:/w0w:ro alpine true; echo $? > Error: container_linux.go:349: starting container process caused "process_linux.go:449: container init caused \"rootfs_linux.go:58: mounting \\\"/tmp\\\" to rootfs \\\"/home/kir/.local/share/containers/storage/overlay/7636ef3650fc91ee4996ccc026532bb3cff7182c0430db662fffb933e0bcadc9/merged\\\" at \\\"/home/kir/.local/share/containers/storage/overlay/7636ef3650fc91ee4996ccc026532bb3cff7182c0430db662fffb933e0bcadc9/merged/w0w\\\" caused \\\"operation not permitted\\\"\"": OCI runtime permission denied error > 126 The last command is not working because in-container mount point is used to search for a parent mount in /proc/self/mountinfo. And yet the following > $ ./bin/podman run -v /tmp:/run/test:ro alpine true; echo $? > 0 still works fine! Here's why: > $ mount | grep -E '/run |/tmp ' > tmpfs on /run type tmpfs (rw,nosuid,nodev,seclabel,mode=755) > tmpfs on /tmp type tmpfs (rw,nosuid,nodev,seclabel) This is the reason why previous commit modified in-container mount point. Fixes: 0f5ae3c Signed-off-by: Kir Kolyshkin <[email protected]>
Hi @kolyshkin. Thanks for your PR. I'm waiting for a containers member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
@giuseppe PTAL |
/approve |
LGTM, but you have compiler errors. |
/approve I love the simplification of the mount parsing - this is much, much cleaner. |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: giuseppe, kolyshkin, mheon 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 |
Looks like it needs to be gated to only compile on Linux, though, it's blowing up on Darwin. |
bd20786
to
9ee8013
Compare
|
done @mheon May I ask why do we care for darwin? |
Oh, any suggestions about how to add a regression test to CI for this are welcome. I tried it before (see e336840) but a CI has passed :-\ |
@kolyshkin containers/image which vendors in container/storage is used for skopeo on Macs. So we want to make sure the tool chain builds for Darwin. |
The Darwin stuff in Libpod is a result of the current remote darwin client situation. Hopefully, once Podmanv2 is done, we will no longer need to have Podman build on OS X. |
... rather than create a new slice and then make the caller replace the original with the new one. Signed-off-by: Kir Kolyshkin <[email protected]>
9ee8013
to
615f2d4
Compare
Instead of getting mount options from /proc/self/mountinfo, which is very costly to read/parse (and can even be unreliable), let's use statfs(2) to figure out the flags we need. [v2: move getting default options to pkg/util, make it linux-specific] Signed-off-by: Kir Kolyshkin <[email protected]>
615f2d4
to
e061436
Compare
I fixed the issues with my patch, current CI failures are (to my best knowledge) unrelated. |
Look like known flakes. Code LGTM |
For volume and bind mount tests, use the in-container mount point path that has no common ancestor with any host path (except for root). This might help to uncover bugs like [1]. Even if not, it seems lile a good cleanup regardless. [1] containers#5676 Signed-off-by: Kir Kolyshkin <[email protected]>
/lgtm |
@rhatdan CI is all green now |
/hold cancel |
For volume and bind mount tests, use the in-container mount point path that has no common ancestor with any host path (except for root). This might help to uncover bugs like [1]. Even if not, it seems lile a good cleanup regardless. [1] containers#5676 Signed-off-by: Kir Kolyshkin <[email protected]>
Fix
Found the bug by reading the source for
InitFSMounts()
, confirmed with:The last command is not working because in-container mount point
(i.e. mount destination, not the mount source) is used to search
for a parent mount in /proc/self/mountinfo.
And yet the following
still works fine! Here's why:
Fixes: #2432 (commit 0f5ae3c)
Related-to: #2312
Improve
Instead of getting mount options from /proc/self/mountinfo, which is
very costly to read/parse (and can even be unreliable), let's use
statfs(2) to figure out the flags we need.