mirror of
https://github.com/opencontainers/runc.git
synced 2026-07-11 06:03:57 +08:00
df9e32bc6a
Recently released codespell 2.2 adds some more false positives, such as: ./Makefile:78: ro ==> to, row, rob, rod, roe, rot ./Makefile:88: ro ==> to, row, rob, rod, roe, rot ./notify_socket.go:51: ro ==> to, row, rob, rod, roe, rot ./LICENSE:128: complies ==> compiles ./go.sum:59: BU ==> BY ./types/features/features.go:17: ro ==> to, row, rob, rod, roe, rot ./libcontainer/rootfs_linux.go:52: ro ==> to, row, rob, rod, roe, rot ./libcontainer/rootfs_linux.go:166: ro ==> to, row, rob, rod, roe, rot .... ./tests/integration/cgroup_delegation.bats:38: inh ==> in ... To fix: - exclude go.sum; - add ro and complies to the list of ignored words; - s/inh/inherit in cgroup_delegation.bats. Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
62 lines
1.7 KiB
Bash
62 lines
1.7 KiB
Bash
#!/usr/bin/env bats
|
|
|
|
load helpers
|
|
|
|
function teardown() {
|
|
teardown_bundle
|
|
}
|
|
|
|
function setup() {
|
|
requires root cgroups_v2 systemd
|
|
|
|
setup_busybox
|
|
|
|
# chown test temp dir to allow host user to read it
|
|
chown 100000 "$ROOT"
|
|
|
|
# chown rootfs to allow host user to mkdir mount points
|
|
chown 100000 "$ROOT"/bundle/rootfs
|
|
|
|
set_cgroups_path
|
|
|
|
# configure a user namespace
|
|
update_config ' .linux.namespaces += [{"type": "user"}]
|
|
| .linux.uidMappings += [{"hostID": 100000, "containerID": 0, "size": 65536}]
|
|
| .linux.gidMappings += [{"hostID": 100000, "containerID": 0, "size": 65536}]
|
|
'
|
|
}
|
|
|
|
@test "runc exec (cgroup v2, ro cgroupfs, new cgroupns) does not chown cgroup" {
|
|
runc run -d --console-socket "$CONSOLE_SOCKET" test_cgroup_chown
|
|
[ "$status" -eq 0 ]
|
|
|
|
runc exec test_cgroup_chown sh -c "stat -c %U /sys/fs/cgroup"
|
|
[ "$status" -eq 0 ]
|
|
[ "$output" = "nobody" ] # /sys/fs/cgroup owned by unmapped user
|
|
}
|
|
|
|
@test "runc exec (cgroup v2, rw cgroupfs, inherit cgroupns) does not chown cgroup" {
|
|
set_cgroup_mount_writable
|
|
|
|
# inherit cgroup namespace (remove cgroup from namespaces list)
|
|
update_config '.linux.namespaces |= map(select(.type != "cgroup"))'
|
|
|
|
runc run -d --console-socket "$CONSOLE_SOCKET" test_cgroup_chown
|
|
[ "$status" -eq 0 ]
|
|
|
|
runc exec test_cgroup_chown sh -c "stat -c %U /sys/fs/cgroup"
|
|
[ "$status" -eq 0 ]
|
|
[ "$output" = "nobody" ] # /sys/fs/cgroup owned by unmapped user
|
|
}
|
|
|
|
@test "runc exec (cgroup v2, rw cgroupfs, new cgroupns) does chown cgroup" {
|
|
set_cgroup_mount_writable
|
|
|
|
runc run -d --console-socket "$CONSOLE_SOCKET" test_cgroup_chown
|
|
[ "$status" -eq 0 ]
|
|
|
|
runc exec test_cgroup_chown sh -c "stat -c %U /sys/fs/cgroup"
|
|
[ "$status" -eq 0 ]
|
|
[ "$output" = "root" ] # /sys/fs/cgroup owned by root (of user namespace)
|
|
}
|