test: add "runc run --no-pivot must not expose bare /proc"

For preventing regression like #2647

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
This commit is contained in:
Akihiro Suda
2020-10-20 23:17:11 +09:00
committed by Kir Kolyshkin
parent 17de6f803d
commit f5c345c30c
+22
View File
@@ -0,0 +1,22 @@
#!/usr/bin/env bats
load helpers
function setup() {
teardown_busybox
setup_busybox
}
function teardown() {
teardown_busybox
}
@test "runc run --no-pivot must not expose bare /proc" {
requires root
update_config '.process.args |= ["unshare", "-mrpf", "sh", "-euxc", "mount -t proc none /proc && echo h > /proc/sysrq-trigger"]'
runc run --no-pivot test_no_pivot
[ "$status" -eq 1 ]
[[ "$output" == *"mount: permission denied"* ]]
}