Skip to content

eBPF-based security platform

testing: cover policy graph transitions in end-to-end fixture

John Fastabend7d7d4be7936d
diff --git a/Documentation/contribute/testing/test-coverage.rst b/Documentation/contribute/testing/test-coverage.rst
index 3fbc2cd0..79cb0599 100644
--- a/Documentation/contribute/testing/test-coverage.rst
+++ b/Documentation/contribute/testing/test-coverage.rst
@@ -459,6 +459,12 @@ signed config image.
- DNS over loopback
* - ``t9105-delivery``
- Registry, tree sync, load, export and attestation end to end
+ * - ``t9106-policy-exec-graph``
+ - A signed SHPL section labels five executables; its BPF policy
+ allows unlabeled tasks to exec unlabeled files and 0x1, allows
+ 0x1 to exec 0x2, and denies 0x1 and socket policy B from execing
+ unlabeled files; socket-storage bits allow 127.0.0.1 for policy A
+ and deny it for B; final evidence includes the loaded policy upatch
Unit suites and fuzz targets
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
diff --git a/Makefile.shirudo b/Makefile.shirudo
index 4d4c0160..557704dd 100644
--- a/Makefile.shirudo
+++ b/Makefile.shirudo
@@ -675,7 +675,8 @@ TEST_HELPERS := $(VERITY_TEST_HELPERS) \
testing/helper/test-signed-load \
testing/helper/test-upatch-link-lockdown \
testing/helper/test-exec-churn \
- testing/end2end/exec-paths
+ testing/end2end/exec-paths \
+ testing/end2end/policy-exec
TEST_HELPERS += testing/helper/test-nv-writer
TEST_HELPERS += testing/helper/test-keyring-seal
TEST_HELPERS += testing/helper/test-tpm-preopened
@@ -849,6 +850,10 @@ testing/end2end/exec-paths: testing/end2end/exec_paths.c
@printf ' CC $@\n'
$(Q)$(CC) $(CFLAGS) -pthread -o $@ $^
+testing/end2end/policy-exec: testing/end2end/policy_exec.c
+ @printf ' CC $@\n'
+ $(Q)$(CC) $(CFLAGS) -o $@ $^
+
testing/helper/test-config-image: testing/helper/test-config-image.c \
util/config_image.o util/crypto_openssl.o util/malloc.o \
util/io.o util/seal.o util/hex.o util/log.o \
diff --git a/testing/Makefile b/testing/Makefile
index 4a5a9e3b..cf8c984a 100644
--- a/testing/Makefile
+++ b/testing/Makefile
@@ -135,6 +135,7 @@ TEST_VM_BUNDLE_SOURCES := $(sort $(wildcard \
$(ROOT)/testing/fixtures/*.conf $(ROOT)/testing/fixtures/*.sh \
$(ROOT)/testing/fixtures/*.h \
$(ROOT)/testing/fixtures/policy-labels/* \
+ $(ROOT)/testing/fixtures/policy-exec-graph/* \
$(ROOT)/testing/fixtures/decoders/* \
$(ROOT)/upatches/kernel-obs/*.c $(ROOT)/upatches/kernel-obs/*.h $(ROOT)/upatches/kernel-obs/*.list \
$(ROOT)/upatches/kernel-obs/*.py $(ROOT)/upatches/kernel-obs/Beefile \
diff --git a/testing/end2end/host.sh b/testing/end2end/host.sh
index a68394c7..ff299e1e 100755
--- a/testing/end2end/host.sh
+++ b/testing/end2end/host.sh
@@ -29,6 +29,7 @@ export BPM_OCI_CA_FILE="$W/ca.pem"
VM_NAME=${VM_NAME:-end2end-$$}
export VM_NAME
RESULT=$REPO/build/test-vm/vms/$VM_NAME-end2end/result/end2end
+POLICY_FIXTURE=$TEST_VM_HOST_BUNDLE/fixtures/shirudo-test-policy-exec-graph.upatch
say() { printf 'end2end: %s\n' "$*"; }
die() { printf 'end2end: %s\n' "$*" >&2; exit 1; }
@@ -51,6 +52,7 @@ wait_https() {
command -v docker >/dev/null 2>&1 || die "docker is required"
[ -s "$KEYS/signing_key.pem" ] || die "no operator key beside the bundle: $KEYS"
+[ -s "$POLICY_FIXTURE" ] || die "no policy exec graph fixture: $POLICY_FIXTURE"
rm -rf "$W"
mkdir -p "$W/out" "$W/pkg"
chmod 0777 "$W/out"
@@ -105,6 +107,9 @@ tar -xzf "$BEE" -C "$W/pkg"
"$S" upatch info --json "$W/pkg/kernel-obs-1.0.0/upatches/kernel-obs.upatch" |
python3 -c 'import json, sys; print(json.load(sys.stdin)["payload_sha256"])' \
>"$W/payload"
+"$S" upatch info --json "$POLICY_FIXTURE" |
+ python3 -c 'import json, sys; print(json.load(sys.stdin)["payload_sha256"])' \
+ >"$W/policy-payload"
say "the target, in $VM_NAME-end2end"
"$@"
@@ -122,11 +127,12 @@ ak=$(python3 -c 'import json, sys; print(json.load(open(sys.argv[1]))["ak"]["nam
grep -qx 'verdict: ok' "$W/verify.out" || die "the evidence does not verify"
# The records replay to the register the TPM certified, so the last load
# and tree operation they name are the target's.
-python3 - "$RESULT/evidence.json" "$(cat "$W/payload")" "$W/ca.pem" \
- "$REGISTRY" <<'PY' || die "the target did not load what was published"
+python3 - "$RESULT/evidence.json" "$(cat "$W/payload")" \
+ "$(cat "$W/policy-payload")" "$W/ca.pem" "$REGISTRY" <<'PY' || \
+ die "the target did not load what was published"
import json, ssl, sys, urllib.request
-evidence, payload, ca, registry = sys.argv[1:5]
+evidence, payload, policy_payload, ca, registry = sys.argv[1:6]
ctx = ssl.create_default_context(cafile=ca)
@@ -151,7 +157,9 @@ for layer in manifest["layers"]:
assert published, "no publication in the tree"
records = json.load(open(evidence))["eventlog"]
loads = [r["upatch"] for r in records if r["type"] == "upatch_load"]
-assert loads[-1] == {"name": "kernel-obs", "payload_sha256": payload}, loads[-1]
+assert {"name": "kernel-obs", "payload_sha256": payload} in loads, loads
+assert loads[-1] == {"name": "policy-exec-graph",
+ "payload_sha256": policy_payload}, loads[-1]
ops = [r["tree"] for r in records if r["type"] == "tree_op"]
assert ops[-1] == {key: published[key] for key in
("seq", "op", "id", "operation_digest")}, (ops[-1], published)
diff --git a/testing/end2end/policy_exec.c b/testing/end2end/policy_exec.c
new file mode 100644
index 00000000..a3ca06ac
--- /dev/null
+++ b/testing/end2end/policy_exec.c
@@ -0,0 +1,175 @@
+// SPDX-License-Identifier: BSD-2-Clause
+/* Copyright (c) 2026 Authors of shirudo */
+
+#include <errno.h>
+#include <libgen.h>
+#include <netinet/in.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/socket.h>
+#include <sys/types.h>
+#include <sys/wait.h>
+#include <unistd.h>
+
+extern char **environ;
+
+#define EXEC_2 "/tmp/shirudo-policy-exec-graph/exec-2"
+#define EXEC_4 "/tmp/shirudo-policy-exec-graph/exec-4"
+#define EXEC_1 "/tmp/shirudo-policy-exec-graph/exec-1"
+#define EXEC_UNLABELED "/tmp/shirudo-policy-exec-graph/unlabeled"
+#define SOCKET_A "/tmp/shirudo-policy-exec-graph/socket-a"
+#define SOCKET_B "/tmp/shirudo-policy-exec-graph/socket-b"
+
+static int exec_child(const char *path, const char *name,
+ const char *mode, const char *arg)
+{
+ char *const argv[] = {(char *)name, (char *)mode, (char *)arg, NULL};
+ pid_t pid;
+ int status;
+
+ pid = fork();
+ if (pid < 0)
+ return -1;
+ if (!pid) {
+ execve(path, argv, environ);
+ _exit(errno == EACCES ? 100 : 101);
+ }
+ if (waitpid(pid, &status, 0) != pid || !WIFEXITED(status))
+ return -1;
+ return WEXITSTATUS(status);
+}
+
+static int listen_loopback(int *port)
+{
+ struct sockaddr_in address = {};
+ socklen_t address_len = sizeof(address);
+ int fd;
+
+ fd = socket(AF_INET, SOCK_STREAM, 0);
+ if (fd < 0)
+ return -1;
+ address.sin_family = AF_INET;
+ address.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
+ if (bind(fd, (struct sockaddr *)&address, sizeof(address)) ||
+ listen(fd, 1) ||
+ getsockname(fd, (struct sockaddr *)&address, &address_len)) {
+ close(fd);
+ return -1;
+ }
+ *port = ntohs(address.sin_port);
+ return fd;
+}
+
+static int socket_connect(const char *name, const char *port_string)
+{
+ struct sockaddr_in address = {};
+ int fd, port, rc;
+
+ port = atoi(port_string);
+ fd = socket(AF_INET, SOCK_STREAM, 0);
+ if (fd < 0)
+ return 101;
+ address.sin_family = AF_INET;
+ address.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
+ address.sin_port = htons(port);
+ rc = connect(fd, (struct sockaddr *)&address, sizeof(address));
+ if (!rc) {
+ close(fd);
+ return !strcmp(name, "socket-a") ? 28 : 29;
+ }
+ rc = errno;
+ close(fd);
+ return !strcmp(name, "socket-b") && rc == EACCES ? 100 : 101;
+}
+
+static void report(int *failed, int number, int passed, const char *title)
+{
+ if (passed) {
+ printf("ok %d - %s\n", number, title);
+ } else {
+ printf("not ok %d - %s\n", number, title);
+ *failed = 1;
+ }
+}
+
+int main(int argc, char **argv)
+{
+ const char *name = basename(argv[0]);
+ char port_string[8];
+ struct sockaddr_in peer = {};
+ socklen_t peer_len = sizeof(peer);
+ int listener, accepted, port, port_len, socket_a, socket_b;
+ int socket_b_probe;
+ int failed = 0;
+
+ if (argc > 1 && !strcmp(argv[1], "target")) {
+ if (!strcmp(name, "exec-1"))
+ return 11;
+ if (!strcmp(name, "exec-2"))
+ return 22;
+ if (!strcmp(name, "exec-4"))
+ return 44;
+ if (!strcmp(name, "unlabeled"))
+ return 45;
+ return 46;
+ }
+ if (argc > 2 && !strcmp(argv[1], "connect"))
+ return socket_connect(name, argv[2]);
+ if (!strcmp(name, "unlabeled") && argc > 1 &&
+ !strcmp(argv[1], "verify")) {
+ if (exec_child(EXEC_UNLABELED, "unlabeled", "target", NULL) != 45 ||
+ exec_child(EXEC_1, "exec-1", "target", NULL) != 11)
+ return 1;
+ return 0;
+ }
+ if (!strcmp(name, "socket-b") && argc > 1 &&
+ !strcmp(argv[1], "probe"))
+ return exec_child(EXEC_UNLABELED, "unlabeled", "target", NULL) == 100 ?
+ 0 : 1;
+ if (strcmp(name, "exec-1") || argc < 2 || strcmp(argv[1], "run"))
+ return 47;
+ report(&failed, 1, argc > 2 && !strcmp(argv[2], "ok"),
+ "unlabeled execs to unlabeled and policy 0x1 are allowed");
+ report(&failed, 2,
+ exec_child(EXEC_2, "exec-2", "target", NULL) == 22,
+ "policy 0x1 allows exec to policy 0x2");
+ report(&failed, 3,
+ exec_child(EXEC_4, "exec-4", "target", NULL) == 100,
+ "policy 0x1 denies exec to policy 0x4");
+ report(&failed, 4,
+ exec_child(EXEC_UNLABELED, "unlabeled", "target", NULL) == 100,
+ "policy 0x1 denies unlabeled exec");
+ listener = listen_loopback(&port);
+ port_len = listener < 0 ? -1 :
+ snprintf(port_string, sizeof(port_string), "%d", port);
+ if (listener < 0 || port_len < 0 ||
+ (size_t)port_len >= sizeof(port_string)) {
+ report(&failed, 5, 0,
+ "policy A connects to 127.0.0.1 using socket policy bits");
+ report(&failed, 6, 0,
+ "policy B denies exec to an unlabeled file");
+ report(&failed, 7, 0,
+ "policy B is denied 127.0.0.1 by socket policy bits");
+ } else {
+ socket_a = exec_child(SOCKET_A, "socket-a", "connect",
+ port_string);
+ accepted = socket_a == 28 ?
+ accept(listener, (struct sockaddr *)&peer, &peer_len) : -1;
+ if (accepted >= 0)
+ close(accepted);
+ report(&failed, 5, socket_a == 28 && accepted >= 0,
+ "policy A connects to 127.0.0.1 using socket policy bits");
+ socket_b_probe = exec_child(SOCKET_B, "socket-b", "probe", NULL);
+ report(&failed, 6, socket_b_probe == 0,
+ "policy B denies exec to an unlabeled file");
+ socket_b = exec_child(SOCKET_B, "socket-b", "connect",
+ port_string);
+ report(&failed, 7, socket_b == 100,
+ "policy B is denied 127.0.0.1 by socket policy bits");
+ }
+ if (listener >= 0)
+ close(listener);
+ puts("1..7");
+ return failed;
+}
diff --git a/testing/end2end/t9106-policy-exec-graph.sh b/testing/end2end/t9106-policy-exec-graph.sh
new file mode 100644
index 00000000..457fb5d6
--- /dev/null
+++ b/testing/end2end/t9106-policy-exec-graph.sh
@@ -0,0 +1,43 @@
+#!/bin/sh
+# SPDX-License-Identifier: BSD-2-Clause
+# Copyright (c) 2026 Authors of shirudo
+#
+# t9106 -- signed policy labels enforce exec and socket policy graphs.
+# This is the last end-to-end test and leaves the policy loaded for evidence.
+
+cd "$(dirname "$0")/.."
+. ./integration-lib.sh
+target_guard
+
+FIXTURES=${SHIRUDO_TEST_FIXTURES_DIR:?target fixture directory is not set}
+LOAD="$FIXTURES/shirudo-test-policy-exec-graph.upatch"
+WORK=/tmp/shirudo-policy-exec-graph
+HELPER=./end2end/policy-exec
+E2E=$PWD/../build/test-vm/end2end
+OUT=/mnt/shirudo-out/end2end
+
+[ -s "$LOAD" ] || test_skip_all "missing policy exec graph fixture"
+[ -x "$HELPER" ] || test_skip_all "policy exec graph helper is missing"
+[ -s "$E2E/nonce" ] && [ -d "$OUT" ] ||
+ test_skip_all "end-to-end evidence destination is missing"
+NONCE=$(cat "$E2E/nonce")
+
+rm -rf "$WORK"
+mkdir -p "$WORK"
+cp "$HELPER" "$WORK/exec-1"
+cp "$HELPER" "$WORK/exec-2"
+cp "$HELPER" "$WORK/exec-4"
+cp "$HELPER" "$WORK/unlabeled"
+cp "$HELPER" "$WORK/socket-a"
+cp "$HELPER" "$WORK/socket-b"
+chmod 0755 "$WORK"/*
+
+"$SHIRUDO_BIN" upatch load "$LOAD" --no-precheck >/dev/null 2>&1 ||
+ exit 1
+if "$WORK/unlabeled" verify; then
+ UNLABELED_RESULT=ok
+else
+ UNLABELED_RESULT=failed
+fi
+"$WORK/exec-1" run "$UNLABELED_RESULT" || exit 1
+"$SHIRUDO_BIN" attest --nonce="$NONCE" --out="$OUT/evidence.json"
diff --git a/testing/fixtures/policy-exec-graph/Beefile b/testing/fixtures/policy-exec-graph/Beefile
new file mode 100644
index 00000000..d9e12f46
--- /dev/null
+++ b/testing/fixtures/policy-exec-graph/Beefile
@@ -0,0 +1,32 @@
+[package]
+name = "policy-exec-graph"
+description = "exec policy graph end-to-end test"
+license = "GPL-2.0 OR BSD-2-Clause"
+
+[[upatches]]
+source = "policy-exec-graph.bpf.c"
+
+[[upatches.policy]]
+id = "entry"
+bit = 0x1
+paths = ["/tmp/shirudo-policy-exec-graph/exec-1"]
+
+[[upatches.policy]]
+id = "allowed-child"
+bit = 0x2
+paths = ["/tmp/shirudo-policy-exec-graph/exec-2"]
+
+[[upatches.policy]]
+id = "denied-child"
+bit = 0x4
+paths = ["/tmp/shirudo-policy-exec-graph/exec-4"]
+
+[[upatches.policy]]
+id = "socket-allow"
+bit = 0x8
+paths = ["/tmp/shirudo-policy-exec-graph/socket-a"]
+
+[[upatches.policy]]
+id = "socket-deny"
+bit = 0x10
+paths = ["/tmp/shirudo-policy-exec-graph/socket-b"]
diff --git a/testing/fixtures/policy-exec-graph/policy-exec-graph.bpf.c b/testing/fixtures/policy-exec-graph/policy-exec-graph.bpf.c
new file mode 100644
index 00000000..9cfb9d10
--- /dev/null
+++ b/testing/fixtures/policy-exec-graph/policy-exec-graph.bpf.c
@@ -0,0 +1,107 @@
+// SPDX-License-Identifier: GPL-2.0 OR BSD-2-Clause
+#include "vmlinux.h"
+#include <bpf/bpf_endian.h>
+#include <bpf/bpf_helpers.h>
+#include <bpf/bpf_tracing.h>
+#include "shirudo_policy_map.h"
+
+char _license[] SEC("license") = "Dual BSD/GPL";
+
+#define SHIRUDO_POLICY_XATTR "security.bpf.shirudo.policy"
+#define AF_INET 2
+#ifndef ENODATA
+#define ENODATA 61
+#endif
+#ifndef EOPNOTSUPP
+#define EOPNOTSUPP 95
+#endif
+
+struct policy_exec_scratch {
+ __u64 target;
+};
+
+struct {
+ __uint(type, BPF_MAP_TYPE_TASK_STORAGE);
+ __uint(map_flags, BPF_F_NO_PREALLOC);
+ __type(key, int);
+ __type(value, struct policy_exec_scratch);
+} policy_exec_scratch SEC(".maps");
+
+int bpf_get_file_xattr(struct file *file, const char *name__str,
+ struct bpf_dynptr *value_p) __ksym;
+
+SEC("lsm.s/bprm_check_security")
+int BPF_PROG(shirudo_test_policy_exec_graph,
+ struct linux_binprm *bprm, int ret)
+{
+ struct task_struct *task = bpf_get_current_task_btf();
+ struct shirudo_task_policy *policy;
+ struct policy_exec_scratch *scratch;
+ struct bpf_dynptr value_ptr;
+ __u64 target;
+ int len;
+
+ if (ret)
+ return ret;
+ if (!bprm || !bprm->file)
+ return -13;
+ scratch = bpf_task_storage_get(&policy_exec_scratch, task, NULL,
+ BPF_LOCAL_STORAGE_GET_F_CREATE);
+ if (!scratch ||
+ bpf_dynptr_from_mem(&scratch->target, sizeof(scratch->target),
+ 0, &value_ptr))
+ return -13;
+ len = bpf_get_file_xattr(bprm->file, SHIRUDO_POLICY_XATTR,
+ &value_ptr);
+ if (len == -ENODATA || len == -EOPNOTSUPP)
+ target = 0;
+ else if (len != sizeof(scratch->target))
+ return -13;
+ if (len == sizeof(scratch->target))
+ target = scratch->target;
+ policy = bpf_task_storage_get(&policy_map, task, NULL, 0);
+ if (!policy)
+ return -13;
+ if ((!policy->active && (target == 0 || target == 1)) ||
+ (policy->active == 1 &&
+ (target == 2 || target == 8 || target == 16)))
+ return 0;
+ return -13;
+}
+
+SEC("lsm.s/socket_connect")
+int BPF_PROG(shirudo_test_policy_socket_graph, struct socket *sock,
+ struct sockaddr *address, int addrlen, int ret)
+{
+ struct sockaddr_in sin = {};
+ struct sock *sk;
+ __u64 *socket_policy;
+ __u16 family;
+
+ if (ret)
+ return ret;
+ if (!address ||
+ bpf_probe_read_kernel(&family, sizeof(family),
+ &address->sa_family))
+ return -13;
+ if (family != AF_INET)
+ return 0;
+ if (addrlen < (int)sizeof(sin) ||
+ bpf_probe_read_kernel(&sin, sizeof(sin), address))
+ return -13;
+ if (bpf_ntohl(sin.sin_addr.s_addr) != 0x7f000001)
+ return 0;
+ if (!sock)
+ return -13;
+ sk = sock->sk;
+ if (!sk)
+ return -13;
+ socket_policy = bpf_sk_storage_get(&socket_policy_map, sk, NULL, 0);
+ if (!socket_policy)
+ return -13;
+ if (*socket_policy & 16)
+ return -13;
+ if (*socket_policy & 8)
+ return 0;
+ return -13;
+}
diff --git a/testing/run-target-tests.sh b/testing/run-target-tests.sh
index 51966667..2f9773d3 100755
--- a/testing/run-target-tests.sh
+++ b/testing/run-target-tests.sh
@@ -48,14 +48,33 @@ export SHIRUDO_TEST_CLI_RESULTS="$SHIRUDO_TEST_RESULTS/cli"
export SHIRUDO_TEST_REVOKE_RESULTS="$SHIRUDO_TEST_RESULTS/revocation"
fail=0
found=0
+# Keep post-test log handling in this shell; an end-to-end policy test may
+# have attached a hook that denies every new unlabeled executable.
+print_test_log()
+{
+ while IFS= read -r line || [ -n "$line" ]; do
+ printf '%s\n' "$line"
+ done <"$1"
+}
+
+test_log_skipped()
+{
+ first_line=
+ IFS= read -r first_line <"$1" || :
+ case "$first_line" in
+ '1..0 # SKIP'*) return 0 ;;
+ *) return 1 ;;
+ esac
+}
+
for t in "$dir"/t[0-9]1[0-9][0-9]-*.sh; do
[ -e "$t" ] || continue
found=1
log="$SHIRUDO_TEST_RESULTS/$(basename "$t").log"
rc=0
sh "$t" >"$log" 2>&1 || rc=$?
- cat "$log"
- if grep -q '^1\.\.0 # SKIP' "$log"; then
+ print_test_log "$log"
+ if test_log_skipped "$log"; then
printf 'required target test was skipped: %s\n' "$t" >&2
rc=1
fi
diff --git a/testing/vm/build-bundle.sh b/testing/vm/build-bundle.sh
index 9f8cf665..e83adef8 100755
--- a/testing/vm/build-bundle.sh
+++ b/testing/vm/build-bundle.sh
@@ -344,6 +344,7 @@ testing/helper/test-signed-load
testing/helper/test-upatch-link-lockdown
testing/helper/test-exec-churn
testing/end2end/exec-paths
+testing/end2end/policy-exec
testing/helper/otel-mock.py
testing/helper/test-oci-registry.py
EOF
@@ -616,6 +617,29 @@ build_policy_labels_fixture()
>"$TMP_DIR/fixtures/shirudo-test-policy-labels.unload.upatch"
}
+build_policy_exec_graph_fixture()
+{
+ local source_dir="$FIXTURE_WORK/policy-exec-graph"
+ local package="$FIXTURE_WORK/policy-exec-graph-1.0.0.bee"
+
+ mkdir -p "$source_dir"
+ cp "$REPO_ROOT/testing/fixtures/policy-exec-graph/Beefile" \
+ "$REPO_ROOT/testing/fixtures/policy-exec-graph/policy-exec-graph.bpf.c" \
+ "$source_dir/"
+ ln -s "$REPO_ROOT/vendor" "$source_dir/vendor"
+ ln -s "$REPO_ROOT/bpf" "$source_dir/bpf"
+ (
+ cd "$FIXTURE_WORK"
+ SHIRUDO_BUILD="$REPO_ROOT/tools/shirudo-build/shirudo-build" \
+ "$REPO_ROOT/shirudo" bpm build "$source_dir" \
+ --version 1.0.0 --keys-dir "$FIXTURE_WORK/trusted" \
+ --vmlinux "$REPO_ROOT/vendor/linux/vmlinux.h"
+ )
+ tar -xOf "$package" \
+ policy-exec-graph-1.0.0/upatches/policy-exec-graph.upatch \
+ >"$TMP_DIR/fixtures/shirudo-test-policy-exec-graph.upatch"
+}
+
log "building target-test fixtures on the operator host"
mkdir -p "$TMP_DIR/fixtures/decoders" "$FIXTURE_WORK/trusted" \
"$FIXTURE_WORK/foreign" "$FIXTURE_WORK/own" "$FIXTURE_WORK/third"
@@ -646,6 +670,7 @@ build_fixture scope-kprobe.bpf.c shirudo-test-scope-kprobe "$FIXTURE_WORK/truste
build_fixture basic.bpf.c shirudo-test-foreign "$FIXTURE_WORK/foreign"
build_fixture basic.bpf.c shirudo-test-own-keyring "$FIXTURE_WORK/own"
build_policy_labels_fixture
+build_policy_exec_graph_fixture
build_obs_fixture "$FIXTURE_WORK/trusted"
basic_payload="$($REPO_ROOT/shirudo upatch info \
diff --git a/testing/vm/run.sh b/testing/vm/run.sh
index f5405e11..40516558 100755
--- a/testing/vm/run.sh
+++ b/testing/vm/run.sh
@@ -417,7 +417,7 @@ validate_kernel_artifact()
validate_host_bundle()
{
- local runtime_key runtime_image
+ local runtime_key runtime_image policy_fixture
[[ -x "$TEST_VM_HOST_BUNDLE/root/usr/local/bin/shirudo" ]] ||
die "host VM bundle is missing; run 'make -C testing test-vm-bundle' first: $TEST_VM_HOST_BUNDLE"
[[ -s "$TEST_VM_HOST_BUNDLE/fixtures/cert.der" ]] ||
@@ -427,6 +427,9 @@ validate_host_bundle()
if [[ "$VM_SUITE" == end2end ]]; then
[[ -s "$TEST_VM_HOST_BUNDLE/fixtures/kernel-obs.upatch" ]] ||
die "host VM bundle has no kernel-obs fixture: $TEST_VM_HOST_BUNDLE"
+ policy_fixture="$TEST_VM_HOST_BUNDLE/fixtures/shirudo-test-policy-exec-graph.upatch"
+ [[ -s "$policy_fixture" ]] ||
+ die "host VM bundle has no policy exec graph fixture: $TEST_VM_HOST_BUNDLE"
elif [[ "$VM_SUITE" == bpm ]]; then
[[ -s "$TEST_VM_HOST_BUNDLE/fixtures/tree-oci/shirudo/upatch-tree/manifests/stable" &&
-s "$TEST_VM_HOST_BUNDLE/fixtures/shirudo-test-tree-match.upatch" &&