Skip to content

eBPF-based security platform

testing: remove target tests no runner runs

Daniel Borkmann04c9a81497ec
diff --git a/testing/out b/testing/out
deleted file mode 100644
index 42e857f0..00000000
--- a/testing/out
+++ /dev/null
@@ -1,2 +0,0 @@
-'remote' is not a shirudo command.
-See 'shirudo help'.
diff --git a/testing/tamperproof/t1101-seal.sh b/testing/tamperproof/t1101-seal.sh
deleted file mode 100644
index 6a723637..00000000
--- a/testing/tamperproof/t1101-seal.sh
+++ /dev/null
@@ -1,56 +0,0 @@
-#!/bin/sh
-# SPDX-License-Identifier: BSD-2-Clause
-# Copyright (c) 2026 Authors of shirudo
-#
-# t1101 -- filesystem-sealing LSM (bpf/seal.c): a non-shirudo process
-# cannot modify a labelled file under /var/lib/shirudo, even as root.
-# Non-destructive: the seal denies the tamper, so the file survives.
-
-cd "$(dirname "$0")/.."
-. ./integration-lib.sh
-target_guard
-
-CERT=/var/lib/shirudo/keys/cert.der
-ARCHIVE=/var/lib/shirudo/upatches/shirudo-test-basic.upatch
-FIXTURES=$SHIRUDO_TEST_FIXTURES_DIR
-[ -e "$CERT" ] || test_skip_all "no cert at $CERT"
-[ -s "$ARCHIVE" ] || test_skip_all "no archived basic upatch"
-before=$(sha256sum "$CERT" | cut -d' ' -f1)
-archive_before=$(sha256sum "$ARCHIVE" | cut -d' ' -f1)
-WORK=$(mktemp -d /root/.t1101.XXXXXX) ||
- test_skip_all "cannot make a scratch directory"
-[ "$(stat -c %d "$WORK")" = "$(stat -c %d "$ARCHIVE")" ] || {
- rm -rf "$WORK"
- test_skip_all "no unlabelled scratch directory on the archive filesystem"
-}
-replacement="$WORK/replacement"
-trap 'rm -f "$replacement"; rm -rf "$WORK"' EXIT
-
-test_expect_success 'seal denies a non-shirudo write to a labelled file' '
- ! dd if=/dev/zero of=/var/lib/shirudo/keys/cert.der bs=1 count=1 \
- conv=notrunc 2>/dev/null &&
- [ "$(sha256sum /var/lib/shirudo/keys/cert.der | cut -d" " -f1)" = "$before" ]
-'
-
-test_expect_success 'seal denies a non-shirudo setxattr on a labelled file' '
- ! python3 -c "import os,sys; os.setxattr(sys.argv[1], \"user.sealprobe\", b\"x\")" \
- /var/lib/shirudo/keys/cert.der 2>/dev/null
-'
-
-test_expect_success 'seal denies changes to an archived upatch' '
- ! dd if=/dev/zero of="$ARCHIVE" bs=1 count=1 conv=notrunc 2>/dev/null &&
- ! python3 -c "import os,sys; os.setxattr(sys.argv[1], \\"user.sealprobe\\", b\\"x\\")" \
- "$ARCHIVE" 2>/dev/null &&
- ! python3 -c "import os,sys; os.removexattr(sys.argv[1], \\"security.bpf.shirudo\\")" \
- "$ARCHIVE" 2>/dev/null &&
- [ "$(sha256sum "$ARCHIVE" | cut -d" " -f1)" = "$archive_before" ]
-'
-test_expect_success 'seal denies unlink, rename-away, and replacement of an archived upatch' '
- cp "$ARCHIVE" "$replacement" &&
- ! rm "$ARCHIVE" 2>/dev/null &&
- ! mv "$ARCHIVE" "$WORK/moved.upatch" 2>/dev/null &&
- ! python3 -c "import os,sys; os.replace(sys.argv[1],sys.argv[2])" \
- "$replacement" "$ARCHIVE" 2>/dev/null &&
- [ "$(sha256sum "$ARCHIVE" | cut -d" " -f1)" = "$archive_before" ]
-'
-test_done
diff --git a/testing/tamperproof/t1106-keyring-swap.sh b/testing/tamperproof/t1106-keyring-swap.sh
deleted file mode 100644
index 64fcae5e..00000000
--- a/testing/tamperproof/t1106-keyring-swap.sh
+++ /dev/null
@@ -1,59 +0,0 @@
-#!/bin/sh
-# SPDX-License-Identifier: BSD-2-Clause
-# Copyright (c) 2026 Authors of shirudo
-#
-# t1106 -- same-named keyring substitution: a root attacker who
-# displaces the sealed "shirudo" keyring in @u with a fake same-named
-# one is caught by the serial pin. `status` reports MISMATCH and a load
-# is refused with category tampered (before any BPF_PROG_LOAD). The
-# fake keyring is removed and a fresh sealed one re-created on EXIT.
-#
-# Caveat: the substitution displaces (unlinks) the original keyring from
-# @u, and the seal blocks re-linking it, so its serial cannot be
-# recovered. The lsm/bpf_prog_load gate binds the serial frozen into the
-# bpf2 identity map at the original init, so shirudo-signed loads stay
-# refused until the next boot re-inits from scratch. The host remains
-# fail-closed (enforcing) in the meantime -- the correct posture once the
-# trust anchor has been destroyed -- so this test should be run on a host
-# that will be rebooted, or last.
-
-cd "$(dirname "$0")/.."
-. ./integration-lib.sh
-target_guard
-
-# With the certificate enrolled in the kernel's bpf keyring there is no
-# user keyring to substitute; t1121 covers that trust anchor.
-[ "$("$SHIRUDO_BIN" status --json 2>/dev/null |
- python3 -c "import json, sys; print(json.load(sys.stdin).get(\"keyring_mode\", \"\"))")" != bpf ] ||
- test_skip_all "certificate is enrolled in the bpf keyring"
-
-command -v keyctl >/dev/null 2>&1 || test_skip_all "no keyctl"
-ARCH=$(ls /var/lib/shirudo/upatches/*.upatch 2>/dev/null | head -1)
-[ -n "$ARCH" ] || test_skip_all "no persisted .upatch to attempt loading"
-keyctl search @u keyring shirudo >/dev/null 2>&1 || test_skip_all "no shirudo keyring"
-
-restore() {
- # Drop whatever "shirudo" keyring is in @u now (fake or stale). The
- # anchor init froze names the original serial, so the re-run can
- # only report the swap; the test runs last for that reason.
- k=$(keyctl search @u keyring shirudo 2>/dev/null) &&
- keyctl unlink "$k" @u >/dev/null 2>&1
- "$SHIRUDO_BIN" init >/dev/null 2>&1 || true
-}
-trap restore EXIT
-
-# Displace the real keyring with a fake same-named one in @u.
-keyctl newring shirudo @u >/dev/null 2>&1 || test_skip_all "keyctl newring failed"
-
-test_expect_success 'after swap, status reports keyring_serial_matches=false' '
- m=$("$SHIRUDO_BIN" status --json 2>/dev/null | report_field keyring_serial_matches) &&
- [ "$m" = "False" ]
-'
-
-test_expect_success 'after swap, a load is refused with category tampered' '
- cat=$("$SHIRUDO_BIN" upatch load "$ARCH" --no-precheck --report=- \
- 2>/dev/null | report_field category) &&
- [ "$cat" = "tampered" ]
-'
-
-test_done
diff --git a/testing/tamperproof/t1121-bpf-keyring.sh b/testing/tamperproof/t1121-bpf-keyring.sh
deleted file mode 100644
index 80f0e8f2..00000000
--- a/testing/tamperproof/t1121-bpf-keyring.sh
+++ /dev/null
@@ -1,73 +0,0 @@
-#!/bin/sh
-# SPDX-License-Identifier: BSD-2-Clause
-# Copyright (c) 2026 Authors of shirudo
-#
-# t1121 -- the certificates live in the kernel's bpf keyring: init
-# enrolled the trusted set and sealed the keyring, status says so, a
-# re-run of init leaves it alone, and nothing can be linked into it any
-# more.
-
-cd "$(dirname "$0")/.."
-. ./integration-lib.sh
-target_guard
-
-[ "$(keyring_mode)" = bpf ] ||
- test_skip_all "certificate staged in the user keyring (kernel booted without bpf.keyring_unsealed=1)"
-
-FIXTURES=${SHIRUDO_TEST_FIXTURES_DIR:?target fixture directory is not set}
-# A certificate the keyring does not hold: the third one until t1124
-# adds it to the set on disk, which the keyring learns of at a reboot.
-FOREIGN_CERT="$FIXTURES/third.der"
-[ -s "$FOREIGN_CERT" ] || FOREIGN_CERT="$FIXTURES/own.der"
-LIFECYCLE="$FIXTURES/shirudo-test-lifecycle.upatch"
-LIFECYCLE_UNLOAD="$FIXTURES/shirudo-test-lifecycle.unload.upatch"
-LIFECYCLE_PIN=/run/shirudo/bpffs/upatches/shirudo-test-lifecycle/link
-[ -s "$FOREIGN_CERT" ] || test_skip_all "missing certificate fixtures"
-[ -s "$LIFECYCLE" ] && [ -s "$LIFECYCLE_UNLOAD" ] ||
- test_skip_all "missing lifecycle fixtures"
-keys_in_ring() {
- sed -nE "s/^.*keyring +\.bpf: ([0-9]+).*$/\1/p" /proc/keys
-}
-N_ENROLLED=$(keys_in_ring)
-
-test_expect_success 'the bpf keyring holds the trusted set and the pin names it' '
- [ -n "$N_ENROLLED" ] && [ "$N_ENROLLED" -ge 1 ] &&
- "$SHIRUDO_BIN" status --json | python3 -c "
-import json, sys
-d = json.load(sys.stdin)
-assert d[\"keyring_mode\"] == \"bpf\", d
-assert d[\"keyring_present\"] is True, d
-assert d[\"keyring_serial\"] == d[\"keyring_serial_pinned\"], d
-assert d[\"certs_enrolled\"] == len(d[\"certs\"]) == $N_ENROLLED, d
-"
-'
-
-test_expect_success 'a re-run of init keeps the enrolled keyring' '
- "$SHIRUDO_BIN" init &&
- [ "$(keyring_mode)" = bpf ] &&
- [ "$(keys_in_ring)" = "$N_ENROLLED" ]
-'
-
-test_expect_success 'a load and an unload pass the pre-flight check' '
- "$SHIRUDO_BIN" upatch load "$LIFECYCLE" >/dev/null 2>&1 &&
- test -e "$LIFECYCLE_PIN" &&
- "$SHIRUDO_BIN" upatch unload "$LIFECYCLE_UNLOAD" >/dev/null 2>&1 &&
- test ! -e "$LIFECYCLE_PIN"
-'
-
-test_expect_success 'the sealed bpf keyring refuses another key' '
- python3 - "$FOREIGN_CERT" <<"PY"
-import ctypes, errno, os, platform, sys
-nr = {"x86_64": 248, "aarch64": 217, "riscv64": 217}[platform.machine()]
-libc = ctypes.CDLL(None, use_errno=True)
-cert = open(sys.argv[1], "rb").read()
-ret = libc.syscall(nr, b"asymmetric", None, cert, len(cert), -9)
-err = ctypes.get_errno()
-# EPERM from the sealed keyring; EACCES when the certificate is already
-# a member and the add would update its key, which the LSM denies.
-assert ret == -1 and err in (errno.EPERM, errno.EACCES), (ret, os.strerror(err))
-PY
- [ "$(keys_in_ring)" = "$N_ENROLLED" ]
-'
-
-test_done
diff --git a/testing/tamperproof/t1132-upatch-integrity.sh b/testing/tamperproof/t1132-upatch-integrity.sh
deleted file mode 100644
index 2aaea938..00000000
--- a/testing/tamperproof/t1132-upatch-integrity.sh
+++ /dev/null
@@ -1,58 +0,0 @@
-#!/bin/sh
-# SPDX-License-Identifier: BSD-2-Clause
-# Copyright (c) 2026 Authors of shirudo
-#
-# t1132 -- target-side artifact signature, pin-xattr and link protection.
-
-cd "$(dirname "$0")/.."
-. ./integration-lib.sh
-target_guard
-command -v python3 >/dev/null 2>&1 || test_skip_all "no python3"
-FIXTURES=$SHIRUDO_TEST_FIXTURES_DIR
-NAME=shirudo-test-basic
-LOAD="$FIXTURES/$NAME.upatch"
-PIN="/run/shirudo/bpffs/upatches/$NAME/link"
-PINDIR="/run/shirudo/bpffs/upatches/$NAME"
-ARCHIVE="/var/lib/shirudo/upatches/$NAME.upatch"
-HELPER=helper/test-upatch-link-lockdown
-WORK=$(mktemp -d)
-trap 'rm -rf "$WORK"' EXIT
-[ -s "$LOAD" ] || test_skip_all "missing trusted basic upatch"
-[ -x "$HELPER" ] || test_skip_all "upatch link helper is not built"
-[ -e "$PIN" ] || test_skip_all "basic fixture is not loaded"
-[ -s "$ARCHIVE" ] || test_skip_all "basic fixture archive is missing"
-python3 - "$LOAD" "$WORK/mutated.upatch" <<'PY'
-import hashlib, pathlib, struct, sys
-src, dst = pathlib.Path(sys.argv[1]), pathlib.Path(sys.argv[2])
-data = bytearray(src.read_bytes())
-loader_off, loader_len = struct.unpack_from("<II", data, 304)
-data_off, data_len = struct.unpack_from("<II", data, 328)
-name = b"shirudo-tamper-invalid-signature"
-data[16:272] = name + bytes(256 - len(name))
-data[loader_off] ^= 1
-payload = data[loader_off:loader_off + loader_len]
-if data_len:
- payload += data[data_off:data_off + data_len]
-data[272:304] = hashlib.sha256(payload).digest()
-dst.write_bytes(data)
-PY
-test_expect_success 'trusted certificate cannot authorize a mutated loader' '
- "$SHIRUDO_BIN" upatch load "$WORK/mutated.upatch" --no-precheck \
- --report="$WORK/report.json" >/dev/null 2>&1 || true
- cat=$(report_field category <"$WORK/report.json") &&
- [ "$cat" = signature_rejected ] &&
- [ ! -e /run/shirudo/bpffs/upatches/shirudo-tamper-invalid-signature ] &&
- [ ! -e /var/lib/shirudo/upatches/shirudo-tamper-invalid-signature.upatch ]
-'
-test_expect_success 'root cannot change the live payload binding xattr' '
- before=$(python3 -c "import os,sys; print(os.getxattr(sys.argv[1], \"security.bpf.shirudo.payload\").hex())" "$PINDIR") &&
- ! python3 -c "import os,sys; os.setxattr(sys.argv[1], \"security.bpf.shirudo.payload\", bytes(32))" "$PINDIR" 2>/dev/null &&
- ! python3 -c "import os,sys; os.removexattr(sys.argv[1], \"security.bpf.shirudo.payload\")" "$PINDIR" 2>/dev/null &&
- after=$(python3 -c "import os,sys; print(os.getxattr(sys.argv[1], \"security.bpf.shirudo.payload\").hex())" "$PINDIR") &&
- [ "$before" = "$after" ]
-'
-test_expect_success 'root cannot detach or update a live upatch link' '
- "$HELPER" "$PIN" &&
- [ -e "$PIN" ]
-'
-test_done
diff --git a/testing/tamperproof/t1133-seal-init-xattr.sh b/testing/tamperproof/t1133-seal-init-xattr.sh
deleted file mode 100755
index c24007f3..00000000
--- a/testing/tamperproof/t1133-seal-init-xattr.sh
+++ /dev/null
@@ -1,87 +0,0 @@
-#!/bin/sh
-# SPDX-License-Identifier: BSD-2-Clause
-# Copyright (c) 2026 Authors of shirudo
-#
-# t1133 -- labelling at creation (bpf/seal.c inode_init_security): an
-# inode created under a labelled directory the seal has seen is born
-# with the label, whoever creates it, and is sealed from that instant.
-# Per-run probes live directly under /var/lib/shirudo and stay there:
-# sealed inodes cannot be removed by the test. Non-destructive otherwise.
-
-cd "$(dirname "$0")/.."
-. ./integration-lib.sh
-target_guard
-
-LABEL=94442b45cfcdc59aabc2a91364ed2ae129418e05a5c1985231b9c032e673f469
-LOCKS=/var/lib/shirudo/locks.t1133.$(cat /proc/sys/kernel/random/uuid)
-[ -e /run/shirudo/bpffs/seal_inode_init_security_link ] ||
- test_skip_all "the seal does not label at creation on this target"
-
-label_of() {
- python3 -c '
-import errno, os, sys
-try:
- print(os.getxattr(sys.argv[1], "security.bpf.shirudo",
- follow_symlinks=False).decode())
-except OSError as e:
- print("unsupported" if e.errno == errno.EOPNOTSUPP else "none")' "$1"
-}
-
-RUN_LABEL=$(label_of /run/shirudo)
-if [ "$RUN_LABEL" = unsupported ]; then
- echo "# SKIP /run does not support security xattrs"
-else
- test_expect_success 'the run directory carries the label' '
- [ "$(label_of /run/shirudo)" = "$LABEL" ]
- '
-fi
-
-# Opening the directory records its label for inode_init_security.
-# The write open is expected to fail after inode creation; test it in
-# a child shell so set -e does not skip the xattr assertion.
-test_expect_success 'a file root creates under a sealed directory is born labelled' '
- ls /var/lib/shirudo >/dev/null &&
- mkdir -p "$LOCKS" &&
- ls "$LOCKS" >/dev/null &&
- if ( : > "$LOCKS/t1133.probe" ) 2>/dev/null; then
- :
- fi
- label=$(label_of "$LOCKS/t1133.probe")
- [ -e "$LOCKS/t1133.probe" ] && [ "$label" = "$LABEL" ] || {
- echo "probe label: $label; directory label: $(label_of "$LOCKS")" >&2
- false
- }
-'
-
-test_expect_success 'and is sealed from that instant: no write, unlink or rename' '
- ! sh -c "echo x > \"$LOCKS/t1133.probe\"" 2>/dev/null &&
- ! rm "$LOCKS/t1133.probe" 2>/dev/null &&
- ! mv "$LOCKS/t1133.probe" "$LOCKS/t1133.moved" 2>/dev/null &&
- [ -e "$LOCKS/t1133.probe" ] &&
- [ ! -s "$LOCKS/t1133.probe" ]
-'
-
-test_expect_success 'a new directory is marked in turn: its child needs no reopen' '
- mkdir "$LOCKS/t1133.dir" &&
- [ "$(label_of "$LOCKS/t1133.dir")" = "$LABEL" ] &&
- mkfifo "$LOCKS/t1133.dir/child" &&
- [ "$(label_of "$LOCKS/t1133.dir/child")" = "$LABEL" ]
-'
-
-test_expect_success 'a symlink is born labelled as well' '
- ln -s t1133.probe "$LOCKS/t1133.link" &&
- [ "$(label_of "$LOCKS/t1133.link")" = "$LABEL" ]
-'
-
-test_expect_success 'an O_TMPFILE under the tree cannot be opened for writing' '
- ! python3 -c "import os,sys; os.open(sys.argv[1], os.O_TMPFILE | os.O_WRONLY, 0o600)" \
- "$LOCKS" 2>/dev/null
-'
-
-test_expect_success 'a file created outside the tree stays unlabelled' '
- f=$(mktemp /root/t1133.XXXXXX) &&
- [ "$(label_of "$f")" = none ] &&
- rm -f "$f"
-'
-
-test_done
diff --git a/testing/tamperproof/t1134-seal-task.sh b/testing/tamperproof/t1134-seal-task.sh
deleted file mode 100755
index 2a313e6b..00000000
--- a/testing/tamperproof/t1134-seal-task.sh
+++ /dev/null
@@ -1,102 +0,0 @@
-#!/bin/sh
-# SPDX-License-Identifier: BSD-2-Clause
-# Copyright (c) 2026 Authors of shirudo
-#
-# t1134 -- the seal's task hooks (bpf/seal.c ptrace_access_check and
-# perf_event_alloc): a task that runs the runtime shirudo binary can
-# neither be ptrace-attached nor have a perf event bound to it, even by
-# root. The task is a shirudo blocked on opening a fifo, released at
-# the end. Non-destructive.
-
-cd "$(dirname "$0")/.."
-. ./integration-lib.sh
-target_guard
-command -v python3 >/dev/null 2>&1 || test_skip_all "no python3"
-[ -e /run/shirudo/bpffs/seal_ptrace_access_check_link ] ||
- test_skip_all "the seal's task hooks are not attached on this target"
-
-W=$(mktemp -d) || test_skip_all "cannot make a scratch directory"
-PID=
-cleanup() {
- # A writer lets the blocked open return; shirudo then rejects the
- # input and exits. ENXIO means it is not waiting any more.
- [ -n "$PID" ] && python3 -c '
-import os, sys
-try:
- fd = os.open(sys.argv[1], os.O_WRONLY | os.O_NONBLOCK)
- os.write(fd, b"x")
- os.close(fd)
-except OSError:
- pass' "$W/fifo" 2>/dev/null
- if [ -n "$PID" ]; then
- wait "$PID" 2>/dev/null || :
- fi
- rm -rf "$W"
-}
-trap cleanup EXIT
-
-mkfifo "$W/fifo" || test_skip_all "cannot make a fifo"
-"$SHIRUDO_BIN" bpm info "$W/fifo" >/dev/null 2>&1 &
-PID=$!
-# Blocked in open(2) of the fifo: alive and sleeping.
-i=0
-while [ "$i" -lt 50 ]; do
- [ -d "/proc/$PID" ] || break
- [ "$(awk '{print $3}' "/proc/$PID/stat" 2>/dev/null)" = S ] && break
- sleep 0.1
- i=$((i + 1))
-done
-[ -d "/proc/$PID" ] || test_skip_all "shirudo did not stay around"
-
-# ptrace(PTRACE_ATTACH): 0 attached (and detached again), 1 refused by
-# the seal, 3 refused otherwise.
-ATTACH='
-import ctypes, sys
-libc = ctypes.CDLL(None, use_errno=True)
-pid = int(sys.argv[1])
-if libc.ptrace(16, pid, None, None) == 0:
- libc.ptrace(17, pid, None, None)
- sys.exit(0)
-sys.exit(1 if ctypes.get_errno() == 13 else 3)
-'
-# perf_event_open(PERF_COUNT_SW_CPU_CLOCK) bound to a task: the same
-# exit codes.
-PERF='
-import ctypes, os, struct, sys
-nr = {"x86_64": 298, "aarch64": 241, "riscv64": 241}.get(os.uname().machine)
-if nr is None:
- sys.exit(4)
-libc = ctypes.CDLL(None, use_errno=True)
-pid = os.getpid() if sys.argv[1] == "self" else int(sys.argv[1])
-attr = ctypes.create_string_buffer(
- struct.pack("IIQQQQQQQ", 1, 64, 0, 0, 0, 0, 0, 0, 0), 64)
-fd = libc.syscall(nr, attr, pid, -1, -1, 0)
-if fd >= 0:
- os.close(fd)
- sys.exit(0)
-sys.exit(1 if ctypes.get_errno() == 13 else 3)
-'
-
-test_expect_success 'root cannot ptrace-attach to a running shirudo' '
- python3 -c "$ATTACH" "$PID"; [ "$?" = 1 ]
-'
-
-if python3 -c "$PERF" self 2>/dev/null; then
- test_expect_success 'root cannot bind a perf event to a running shirudo' '
- python3 -c "$PERF" "$PID"; [ "$?" = 1 ]
- '
-else
- echo "# perf_event_open is unavailable here; the perf case is not run"
-fi
-
-test_expect_success 'the task is unharmed and finishes once released' '
- [ -d "/proc/$PID" ] &&
- python3 -c "
-import os, sys
-fd = os.open(sys.argv[1], os.O_WRONLY | os.O_NONBLOCK)
-os.write(fd, b\"x\")
-os.close(fd)" "$W/fifo" &&
- wait "$PID"; PID=; true
-'
-
-test_done
diff --git a/testing/tamperproof/t1138-secure-exec.sh b/testing/tamperproof/t1138-secure-exec.sh
deleted file mode 100644
index 4c93ac7f..00000000
--- a/testing/tamperproof/t1138-secure-exec.sh
+++ /dev/null
@@ -1,37 +0,0 @@
-#!/bin/sh
-# SPDX-License-Identifier: BSD-2-Clause
-# Copyright (c) 2026 Authors of shirudo
-#
-# t1138 -- shirudo's executable runs in secure-exec mode, so the dynamic
-# loader takes nothing from the environment of whoever started it.
-
-cd "$(dirname "$0")/.."
-. ./integration-lib.sh
-target_guard
-grep -qa '/ld-linux' "$SHIRUDO_BIN" ||
- test_skip_all "shirudo has no dynamic loader"
-ENV=$(command -v env) || test_skip_all "no env"
-W=$(mktemp -d)
-trap 'rm -f "$W/out" "$W/control" "$W/script"; rmdir "$W"' EXIT HUP INT TERM
-
-test_expect_success 'the loader shows other programs their auxiliary vector' '
- LD_SHOW_AUXV=1 "$ENV" true >"$W/out" &&
- grep -q "^AT_SECURE: *0$" "$W/out"
-'
-
-test_expect_success 'shirudo runs with AT_SECURE and its loader ignores LD_SHOW_AUXV' '
- LD_SHOW_AUXV=1 "$SHIRUDO_BIN" version >"$W/out" &&
- ! grep -q "^AT_" "$W/out"
-'
-
-test_expect_success 'shirudo started as a script interpreter runs with AT_SECURE too' '
- printf "#!%s true\n" "$ENV" >"$W/control" &&
- printf "#!%s\n" "$SHIRUDO_BIN" >"$W/script" &&
- chmod 0755 "$W/control" "$W/script" &&
- LD_SHOW_AUXV=1 "$W/control" >"$W/out" &&
- grep -q "^AT_SECURE: *0$" "$W/out" &&
- { LD_SHOW_AUXV=1 "$W/script" >"$W/out" 2>&1 || :; } &&
- ! grep -q "^AT_" "$W/out"
-'
-
-test_done
diff --git a/testing/tamperproof/t1139-traced-exec.sh b/testing/tamperproof/t1139-traced-exec.sh
deleted file mode 100644
index 51029909..00000000
--- a/testing/tamperproof/t1139-traced-exec.sh
+++ /dev/null
@@ -1,58 +0,0 @@
-#!/bin/sh
-# SPDX-License-Identifier: BSD-2-Clause
-# Copyright (c) 2026 Authors of shirudo
-#
-# t1139 -- no traced task can exec shirudo, so no tracer carries over
-# into it; the refusal is counted as ExecTraced.
-
-cd "$(dirname "$0")/.."
-. ./integration-lib.sh
-target_guard
-command -v python3 >/dev/null 2>&1 || test_skip_all "no python3"
-ENV=$(command -v env) || test_skip_all "no env"
-
-# Exec $@ in a child that asked to be traced: print the errno of a
-# refused exec, or "ran" once the child stopped at the exec and was let go.
-traced_exec() {
- python3 - "$@" <<'EOF'
-import ctypes, os, sys
-libc = ctypes.CDLL(None, use_errno=True)
-PTRACE_TRACEME, PTRACE_DETACH = 0, 17
-pid = os.fork()
-if pid == 0:
- libc.ptrace(PTRACE_TRACEME, 0, None, None)
- try:
- os.execv(sys.argv[1], sys.argv[1:])
- except OSError as e:
- os.write(1, b"%d\n" % e.errno)
- os._exit(0)
-_, status = os.waitpid(pid, 0)
-if os.WIFSTOPPED(status):
- libc.ptrace(PTRACE_DETACH, pid, None, None)
- os.waitpid(pid, 0)
- print("ran")
-EOF
-}
-
-counter() {
- "$SHIRUDO_BIN" status --json | python3 -c '
-import json, sys
-print(json.load(sys.stdin)["tamper_attempts"]["counters"][sys.argv[1]])
-' "$1"
-}
-
-test_expect_success 'a traced task execs an ordinary program' '
- [ "$(traced_exec "$ENV" true)" = ran ]
-'
-
-test_expect_success 'a traced task cannot exec shirudo, and the refusal is counted' '
- before=$(counter ExecTraced) &&
- [ "$(traced_exec "$SHIRUDO_BIN" version)" = 1 ] &&
- [ "$(counter ExecTraced)" -gt "$before" ]
-'
-
-test_expect_success 'shirudo still runs untraced' '
- "$SHIRUDO_BIN" version >/dev/null
-'
-
-test_done
diff --git a/testing/tamperproof/test.plan.md b/testing/tamperproof/test.plan.md
index e8abbf51..e938f7ab 100644
--- a/testing/tamperproof/test.plan.md
+++ b/testing/tamperproof/test.plan.md
@@ -23,10 +23,10 @@ checks that Shirudo can still export the pre-existing Python exec record.
| TP-01 | Unsigned userspace `BPF_PROG_LOAD` | Covered | `t1110-lsm-deny.sh`; baseline also in `t1113-mount-lockdown.sh` | Keep EACCES denial assertion. |
| TP-02 | Foreign-signed upatch, signer absent from trusted keyring | Covered | `t1105-siggate.sh` | Keep rejection assertion. |
| TP-03 | Valid signature presented through caller-selected, non-Shirudo keyring | Covered | `t1112-prog-load-keyring-gate.sh` | Keep assertion that distinguishes policy denial from signature failure. |
-| TP-04 | Replace the named Shirudo keyring with a same-named keyring | Covered | `t1106-keyring-swap.sh` | Keep status mismatch and load refusal checks; this destructive test runs last. |
-| TP-05 | Add a key to the sealed BPF keyring | Covered | `t1121-bpf-keyring.sh` | Keep sealing denial and enrollment checks. |
+| TP-04 | Replace the named Shirudo keyring with a same-named keyring | Not applicable | None | The anchor is the kernel's `.bpf` keyring, which has no user-keyring name to substitute. |
+| TP-05 | Add a key to the sealed BPF keyring | Covered | `t1125-key-permission.sh`, `t1170-keyring-seal.sh` | Keep the link denial and the exact-membership checks of the seal. |
| TP-06 | Unlink, clear, revoke, invalidate, re-permission, timeout, or link a key in the anchor | Covered | `t1125-key-permission.sh` | Keep per-operation denial assertions and status check. |
-| TP-07 | Root modifies a labelled file under `/var/lib/shirudo` or changes its xattr | Covered | `t1101-seal.sh` | Keep certificate and archived-upatch write, xattr, unlink, rename-away, and rename-over denial assertions. |
+| TP-07 | Root modifies a labelled file under `/var/lib/shirudo` or changes its xattr | Covered | `t1132-seal-scratch.sh` | Labelled files on the scratch image stand in for state; keep the write, xattr, unlink, rename-away and rename-over denial assertions. |
| TP-08 | Direct or lazy unmount, remount, or mount over private bpffs | Covered | `t1113-mount-lockdown.sh` | Keep mountpoint and enforcement-survival checks. |
| TP-09 | Obtain writable serializer-array or arena FD by pinned path | Covered | `t1130-map-lockdown.sh` | Current test covers `shirudo_ser` and `obs_i_arena`. |
| TP-10 | Obtain writable map FD by map ID | Covered | `t1130-map-lockdown.sh` | Current test covers both maps. |
@@ -44,15 +44,14 @@ checks that Shirudo can still export the pre-existing Python exec record.
| TP-22 | Root puts the public seal label on a file, or runs a binary a mounted file system labels, and then writes, renames, unlinks or relabels a labelled file | Covered | `t1132-seal-scratch.sh` | Only Shirudo may set the label, and the seal admits the executable `init` recorded, not one that carries the label. A failure is a bypass of the seal. |
| TP-23 | Root renames an unlabelled file over a labelled file and so replaces it | Covered | `t1132-seal-scratch.sh` | The seal checks the destination of a rename as well as its source; only the recorded executable may be replaced, as a package upgrade does. |
| TP-24 | Root truncates, chmods or chowns a labelled file without opening it | Covered | `t1132-seal-scratch.sh` | `truncate(2)` changes the contents without a write open, and `chmod` can make a labelled file unreadable to a caller that may still write it; the seal guards attribute changes like writes. |
-| TP-25 | Root creates a file, directory, symlink or O_TMPFILE under a labelled directory | Covered | `t1133-seal-init-xattr.sh` | The inode is born labelled and sealed from that instant; a child of a new directory needs no reopen; the run directory is labelled when its filesystem supports security xattrs; a file outside the tree is not. |
-| TP-26 | Root attaches a debugger to a running shirudo task with `PTRACE_ATTACH` | Covered | `t1134-seal-task.sh` | The seal refuses with `EACCES`, Yama's `EPERM` would not do; the task is unharmed and finishes. |
-| TP-27 | Root binds a perf event to a running shirudo task | Covered | `t1134-seal-task.sh` | `perf_event_open` on the task is refused with `EACCES`; the same event on the caller's own task is the positive control. |
+| TP-25 | Root creates a file, directory, symlink or O_TMPFILE under a labelled directory | Not covered | None | The test for this ran in no suite once the target suite went dm-verity only and was removed; rewrite it for the required suite. The inode is born labelled and sealed from that instant; a child of a new directory needs no reopen; the run directory is labelled when its filesystem supports security xattrs; a file outside the tree is not. |
+| TP-26 | Root attaches a debugger to a running shirudo task with `PTRACE_ATTACH` | Not covered | None | The test for this ran in no suite once the target suite went dm-verity only and was removed; rewrite it for the required suite. The seal refuses with `EACCES`, Yama's `EPERM` would not do; the task is unharmed and finishes. |
+| TP-27 | Root binds a perf event to a running shirudo task | Not covered | None | The test for this ran in no suite once the target suite went dm-verity only and was removed; rewrite it for the required suite. `perf_event_open` on the task is refused with `EACCES`; the same event on the caller's own task is the positive control. |
| TP-28 | Root renames a pin in the private bpffs, or renames one over the lsm/bpf link's pin | Covered | `t1135-pin-rename.sh` | Both are refused with `EPERM`; the pins stay and enforcement survives. Before `lsm/inode_rename` the rename over a pin dropped the link with no guard firing. |
| TP-29 | A refused attempt leaves no trace | Covered | `t1136-tamper-counters.sh` | Every guard counts its refusals by point in a frozen pinned map; `status` lists the non-zero counters, `status --json` and the keepalive carry them all, and root cannot reset them. |
-| TP-30 | Root starts shirudo with `LD_PRELOAD`, `LD_AUDIT` or `LD_LIBRARY_PATH` naming its own code, directly or through a script that names shirudo as its interpreter | Covered | `t1138-secure-exec.sh` | `lsm/bprm_check_security` puts the recorded executables in secure-exec mode; `LD_SHOW_AUXV`, which glibc also ignores then, stands in for the others, with `env` as the positive control. `/etc/ld.so.preload` and a tracer attached before the exec stay open (residual risk 2). |
-| TP-31 | Root execs shirudo from a traced task (`PTRACE_TRACEME`, or a tracer on the parent) so the tracer carries over into it | Covered | `t1139-traced-exec.sh` | `lsm/bprm_check_security` refuses the exec with `EPERM` when `LSM_UNSAFE_PTRACE` is set and counts `ExecTraced`; a traced exec of `env` is the positive control. |
-
-| TP-22 | Mutate a trusted upatch loader and recompute its userspace digest | Covered | `t1132-upatch-integrity.sh` | The kernel signature gate rejects the altered loader as `signature_rejected`; no pin or archive is created. |
+| TP-30 | Root starts shirudo with `LD_PRELOAD`, `LD_AUDIT` or `LD_LIBRARY_PATH` naming its own code, directly or through a script that names shirudo as its interpreter | Not covered | None | The test for this ran in no suite once the target suite went dm-verity only and was removed; rewrite it for the required suite. `lsm/bprm_check_security` puts the recorded executables in secure-exec mode; `LD_SHOW_AUXV`, which glibc also ignores then, stands in for the others, with `env` as the positive control. `/etc/ld.so.preload` and a tracer attached before the exec stay open (residual risk 2). |
+| TP-31 | Root execs shirudo from a traced task (`PTRACE_TRACEME`, or a tracer on the parent) so the tracer carries over into it | Not covered | None | The test for this ran in no suite once the target suite went dm-verity only and was removed; rewrite it for the required suite. `lsm/bprm_check_security` refuses the exec with `EPERM` when `LSM_UNSAFE_PTRACE` is set and counts `ExecTraced`; a traced exec of `env` is the positive control. |
+| TP-32 | Mutate a trusted upatch loader and recompute its userspace digest | Not covered | None | The test for this ran in no suite once the target suite went dm-verity only and was removed; rewrite it for the required suite. The kernel signature gate must reject the altered loader as `signature_rejected` and create no pin or archive. |
## Review notes
diff --git a/testing/tpm/t1102-eventlog-full.sh b/testing/tpm/t1102-eventlog-full.sh
deleted file mode 100644
index e56ad336..00000000
--- a/testing/tpm/t1102-eventlog-full.sh
+++ /dev/null
@@ -1,34 +0,0 @@
-#!/bin/sh
-# SPDX-License-Identifier: BSD-2-Clause
-# Copyright (c) 2026 Authors of shirudo
-#
-# t1102 -- eventlog cap: with eventlog.max_bytes set tiny in
-# shirudo.conf, a valid load refuses with category eventlog_full at
-# pre-flight. No BPF_PROG_LOAD, no chain extend, no append. Non-destructive.
-
-cd "$(dirname "$0")/.."
-. ./integration-lib.sh
-target_guard
-
-FIXTURES=${SHIRUDO_TEST_FIXTURES_DIR:?target fixture directory is not set}
-REAL="$FIXTURES/shirudo-test-lifecycle.upatch"
-[ -s "$REAL" ] || test_skip_all "missing lifecycle fixture"
-
-CONF=/etc/shirudo/shirudo.conf
-SAVED=$(mktemp)
-if [ -e "$CONF" ]; then HAD=yes; cp "$CONF" "$SAVED"; else HAD=no; fi
-cleanup() {
- if [ "$HAD" = yes ]; then cp "$SAVED" "$CONF"; else rm -f "$CONF"; fi
- rm -f "$SAVED"
-}
-trap cleanup EXIT
-mkdir -p /etc/shirudo
-printf 'eventlog.max_bytes = 100\n' > "$CONF"
-
-test_expect_success 'tiny eventlog cap -> category eventlog_full' '
- cat=$($SHIRUDO_BIN upatch load "$REAL" --no-precheck --report=- \
- 2>/dev/null | report_field category) &&
- [ "$cat" = "eventlog_full" ]
-'
-
-test_done