-
Notifications
You must be signed in to change notification settings - Fork 18.9k
pkg/archive: support overlayfs in userns (Ubuntu kernel only) #38038
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
Conversation
|
also cc @dhiltonp |
4c2473f to
90ea528
Compare
|
Looks good @AkihiroSuda; windows CI failure looks to be a teardown test flake; unrelated to changes |
cpuguy83
left a comment
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 haven't validated this yet, but just a minor comment on the code.
pkg/archive/archive_linux.go
Outdated
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.
Instead of the if/else here, could we have a wrapper for the userns case that catches the error and handles accordingly?
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.
Could you be more specific?
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 was thinking we could just wrap ConverRead with something like if err := c.wrapped.ConvertRead(...); err != nil && c.isInUserNS {...}
But looking back now, I think that may not be all that clean.
|
/cc @dmcgowan @tonistiigi |
90ea528 to
d73c7ff
Compare
Codecov Report
@@ Coverage Diff @@
## master #38038 +/- ##
=========================================
Coverage ? 36.53%
=========================================
Files ? 610
Lines ? 45371
Branches ? 0
=========================================
Hits ? 16575
Misses ? 26467
Partials ? 2329 |
pkg/archive/archive_linux.go
Outdated
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.
(only glancing over the code); It's not an exported function, so not a big deal; just thinking if it would be cleaner to pass the options struct, instead of adding a boolean
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.
What would be other fields of options?
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.
not sure 😅 . My train of thought was that in case more options appeared in future, we didn't have to change the signature
|
ping @cpuguy83 @dmcgowan @tonistiigi PTAL |
|
This seems sane. Is there a good way we can add this to the test suite? |
|
As this is Ubuntu-specific and planned to be deprecated in favor of containerd overlay snapshotter, I think manual testing is ok for now |
|
IMO, if it's not worth adding tests for it's not worth merging. |
d73c7ff to
cfb4b0b
Compare
|
Added The test passed locally on Ubuntu 18.04.1, kernel |
|
The PR now contains commit from #38292 so that the PR can be tested on recent kernels. |
pkg/archive/archive_unix_test.go
Outdated
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'm sure I don't know what this is doing, but why do we mention v3 and set 2 here, and then check 2 later?
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.
2 is just a filename and had nothing to do with the version
cpuguy83
left a comment
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
Ubuntu kernel supports overlayfs in user namespaces. However, Docker had previously crafting overlay opaques directly using mknod(2) and setxattr(2), which are not supported in userns. Tested with LXD, Ubuntu 18.04, kernel 4.15.0-36-generic moby#39-Ubuntu. Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
`rootlesskit go test ./pkg/archive` now succeeds Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
cfb4b0b to
ec153cc
Compare
|
@cpuguy83 @tonistiigi @dmcgowan mergeable? |
vdemeester
left a comment
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 🐯
|
@dmcgowan let us know if there's any changes needed after-the-fact 🤗 |
Signed-off-by: Akihiro Suda suda.akihiro@lab.ntt.co.jp
- What I did
Ubuntu kernel supports overlayfs in user namespaces.
However, Docker had previously crafting overlay opaques directly
using
mknod(2)andsetxattr(2), which are not supported in userns.This PR allows
pkg/archiveto craft opaques by creating overlayfs rather thanmknod/setxattr.Tested with LXD, Ubuntu 18.04, kernel
4.15.0-36-generic #39-Ubuntu.Cherry-picked from Usernetes patch set: https://github.com/rootless-containers/usernetes
- How I did it
mknod c 0 0:
lower,upper,merged,worklower/dummymerged/dummyupper/dummymkdir with
trusted.overlay.opaquexattr:lower,upper,merged,worklower/dummymerged/dummymerged/dummytrusted.overlay.opaquexattr is ready asupper/dummy- How to verify it
docker info)docker pull ubuntuWithout patch,
docker pull ubuntufails as follows:- Description for the changelog
pkg/archive: support overlayfs in userns (Ubuntu kernel only)
- A picture of a cute animal (not mandatory but encouraged)
🐧