dmz: remove SELinux special-casing

Now that runc-dmz is opt-in, we no longer need to try to detect whether
SELinux would cause issues for us. We can also remove the
special-purpose build-tag we added.

Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
This commit is contained in:
Aleksa Sarai
2024-03-13 16:23:36 +11:00
parent 1950892f69
commit 37581ad340
10 changed files with 30 additions and 69 deletions
+14
View File
@@ -538,6 +538,20 @@ function requires() {
done
}
# Allow a test to specify that it will not work properly on a given OS. The
# fingerprint for the OS used for this test is $ID-$VERSION_ID, using the
# variables in /etc/os-release. The arguments are regular expressions, and any
# match will cause the test to be skipped.
function exclude_os() {
local host
host="$(sh -c '. /etc/os-release ; echo "$ID-$VERSION_ID"')"
for bad_os in "$@"; do
if [[ "$host" =~ ^$bad_os$ ]]; then
skip "test doesn't work on $bad_os"
fi
done
}
# Retry a command $1 times until it succeeds. Wait $2 seconds between retries.
function retry() {
local attempts=$1
+12
View File
@@ -128,6 +128,10 @@ function teardown() {
}
@test "RUNC_DMZ=true runc run [runc-dmz]" {
# centos-7 has an outdated container-selinux (<2.224.0) which means
# runc-dmz won't work.
exclude_os centos-7
RUNC_DMZ=true runc --debug run test_hello
[ "$status" -eq 0 ]
[[ "$output" = *"Hello World"* ]]
@@ -136,6 +140,10 @@ function teardown() {
}
@test "RUNC_DMZ=true runc run [cap_sys_ptrace -> /proc/self/exe clone]" {
# centos-7 has an outdated container-selinux (<2.224.0) which means
# runc-dmz won't work.
exclude_os centos-7
# Add CAP_SYS_PTRACE to the bounding set, the minimum needed to indicate a
# container process _could_ get CAP_SYS_PTRACE.
update_config '.process.capabilities.bounding += ["CAP_SYS_PTRACE"]'
@@ -232,6 +240,10 @@ function teardown() {
}
@test "RUNC_DMZ=true runc run [exec error]" {
# centos-7 has an outdated container-selinux (<2.224.0) which means
# runc-dmz won't work.
exclude_os centos-7
cat <<EOF >rootfs/run.sh
#!/mmnnttbb foo bar
sh
+4
View File
@@ -40,6 +40,10 @@ function teardown() {
# https://github.com/opencontainers/runc/issues/4057
@test "runc run (custom selinux label, RUNC_DMZ=true)" {
# centos-7 has an outdated container-selinux (<2.224.0) which means
# runc-dmz won't work.
exclude_os centos-7
update_config ' .process.selinuxLabel |= "system_u:system_r:container_t:s0:c4,c5"
| .process.args = ["/bin/true"]'
RUNC_DMZ=true runc run tst