mirror of
https://github.com/opencontainers/runc.git
synced 2026-07-11 06:03:57 +08:00
@@ -64,17 +64,26 @@ function teardown() {
|
||||
[ "$status" -eq 0 ]
|
||||
}
|
||||
|
||||
# https://github.com/opencontainers/runc/security/advisories/GHSA-m8cg-xc2p-r3fc
|
||||
@test "runc run [ro /sys/fs/cgroup mount]" {
|
||||
# With cgroup namespace
|
||||
update_config '.process.args |= ["sh", "-euc", "for f in `grep /sys/fs/cgroup /proc/mounts | awk \"{print \\\\$2}\"| uniq`; do grep -w $f /proc/mounts | tail -n1; done"]'
|
||||
runc run test_busybox
|
||||
[ "$status" -eq 0 ]
|
||||
[ "${#lines[@]}" -ne 0 ]
|
||||
for line in "${lines[@]}"; do [[ "${line}" == *'ro,'* ]]; done
|
||||
|
||||
# Without cgroup namespace
|
||||
@test "runc run [ro /sys/fs/cgroup mounts]" {
|
||||
# Without cgroup namespace.
|
||||
update_config '.linux.namespaces -= [{"type": "cgroup"}]'
|
||||
test_ro_cgroup_mount
|
||||
}
|
||||
|
||||
# shellcheck disable=SC2030
|
||||
@test "runc run [ro /sys/fs/cgroup mounts + cgroupns]" {
|
||||
requires cgroupns
|
||||
# With cgroup namespace.
|
||||
update_config '.linux.namespaces |= if index({"type": "cgroup"}) then . else . + [{"type": "cgroup"}] end'
|
||||
test_ro_cgroup_mount
|
||||
}
|
||||
|
||||
# https://github.com/opencontainers/runc/security/advisories/GHSA-m8cg-xc2p-r3fc
|
||||
# shellcheck disable=SC2031
|
||||
function test_ro_cgroup_mount() {
|
||||
local lines status
|
||||
# shellcheck disable=SC2016
|
||||
update_config '.process.args |= ["sh", "-euc", "for f in `grep /sys/fs/cgroup /proc/mounts | awk \"{print \\\\$2}\"| uniq`; do test -e $f && grep -w $f /proc/mounts | tail -n1; done"]'
|
||||
runc run test_busybox
|
||||
[ "$status" -eq 0 ]
|
||||
[ "${#lines[@]}" -ne 0 ]
|
||||
|
||||
Reference in New Issue
Block a user