-
Notifications
You must be signed in to change notification settings - Fork 160
validation: LinuxUIDMapping: fix tests #597
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
validation: LinuxUIDMapping: fix tests #597
Conversation
|
On Thu, Mar 08, 2018 at 10:59:26AM -0800, Alban Crequy wrote:
Additionnally, …
nit: typo; should be “Additionally”. In the commit message too.
|
validation/linux_uid_mappings.go
Outdated
| err := util.RuntimeInsideValidate(g, func(path string) error { | ||
| _ = mkdir(path, "proc") | ||
| _ = mkdir(path, "dev") | ||
| _ = mkdir(path, "sys") |
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.
If we need these (and it sounds like we do for now), I think they should be part of PrepareBundle. Until we have clearer spec wording around creation, I'd rather not rely on the details of runc's “sometimes we can do this” implementation.
0247f07 to
7a436fd
Compare
|
I added The tests about uid/gid mappings now pass with runc: |
contrib/rootfs-builder/get-stage3.sh
Outdated
| DATE=$(echo "${LATEST}" | sed -n "s|/stage3-${STAGE3_ARCH}-[0-9]*[.]tar[.]bz2.*||p") | ||
| ARCH_URL="${ARCH_URL:-${BASE_ARCH_URL}${DATE}/}" | ||
| STAGE3="${STAGE3:-stage3-${STAGE3_ARCH}-${DATE}.tar.bz2}" | ||
| DATE=$(echo "${LATEST}" | sed -n "s|/.*stage3-${STAGE3_ARCH}-systemd-[0-9]*[.]tar[.]bz2.*||p" | tail -1) |
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.
Thanks for pointing out the current breakage :).
I don't think we want to use the systemd image, since we're just grabbing the BusyBox binary. It's currently quite a bit bigger:
20180308T214502Z/stage3-amd64-20180308T214502Z.tar.xz 188851072
…
20180303/systemd/stage3-amd64-systemd-20180303.tar.bz2 281873162
I'm in the process of updating the rootfs builder for the new format, but haven't gotten through the variable compression (xz, bz2, …) yet. I've filed a WIP #598 with where I am now.
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.
Ok, I'll rebase my PR when yours gets merged.
| .PRECIOUS: rootfs/%/bin/echo | ||
| rootfs/%/bin/echo: rootfs/%/bin/busybox | ||
| sudo sh -c 'COMMANDS=$$($< --list) || exit 1; for COMMAND in $${COMMANDS}; do \ | ||
| sudo sh -c 'COMMANDS=$$($< --list | grep -v "^busybox$$") || exit 1; for COMMAND in $${COMMANDS}; do \ |
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.
Why exclude it? It's a valid command in its own right. Ah, because you don't want to link it to itself, which makes sense. I wonder if this is new to recent BusyBox...
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.
Because the Makefile will call ln -rs busybox busybox and it will fail:
sudo sh -c 'COMMANDS=$(rootfs/amd64/bin/busybox --list) || exit 1; for COMMAND in ${COMMANDS}; do \
test -L "rootfs/amd64/bin/${COMMAND}" || ln -rs rootfs/amd64/bin/busybox "rootfs/amd64/bin/${COMMAND}" || exit; \
done'
ln: failed to create symbolic link 'rootfs/amd64/bin/busybox': File exists
The busybox command doesn't need a symlink.
This error is addressed separately in #599 |
c3978cc to
dabdc17
Compare
Don't validate uid mappings and gid mappings separately: containers with only user mappings or with only group mappings are not usable. The tests about uid/gid mappings now pass with runc: ``` $ sudo validation/linux_uid_mappings.t TAP version 13 ok 1 - root filesystem ok 2 - hostname ok 3 - process ok 4 - mounts ok 5 - user ok 6 - rlimits ok 7 - capabilities ok 8 - default symlinks ok 9 - default file system ok 10 - default devices ok 11 - linux devices ok 12 - linux process ok 13 - masked paths ok 14 - oom score adj ok 1 # SKIP syscall action SCMP_ACT_ALLOW ok 2 # SKIP syscall action SCMP_ACT_ALLOW ok 3 # SKIP syscall action SCMP_ACT_ALLOW ok 4 # SKIP syscall action SCMP_ACT_ALLOW ok 5 # SKIP syscall action SCMP_ACT_ALLOW ok 6 # SKIP syscall action SCMP_ACT_ALLOW ok 15 - seccomp ok 16 - read only paths ok 17 - rootfs propagation ok 18 - sysctls ok 19 - uid mappings ok 20 - gid mappings 1..20 ``` Signed-off-by: Alban Crequy <[email protected]>
dabdc17 to
0f3cf9d
Compare
Don't validate uid mappings and gid mappings separately: containers with
only user mappings or with only group mappings are not usable.
Additionally, don't rely on the runtime to create the directories to be
mounted. runc mounts them in the easy cases but it does not work with
user namespaces.
Marking as WIP/RFC because this is in discussion in opencontainers/runtime-spec#955
Signed-off-by: Alban Crequy [email protected]