Skip to content

eBPF-based security platform

testing/end2end: deliver a CVE mitigation through the tree in t9105

John Fastabendc31c91d1a060
diff --git a/testing/end2end/operator.sh b/testing/end2end/operator.sh
index 44df03ba..0c456eec 100755
--- a/testing/end2end/operator.sh
+++ b/testing/end2end/operator.sh
@@ -61,6 +61,50 @@ publish_java() {
payload "$W/pkg/e2e-java-1.0.0/upatches/e2e-java.upatch" >"$W/java-payload"
}
+# The precise CVE-2026-31431 mitigation, a BPF kernel-bugfix upatch built
+# and signed here as an operator would, pushed and appended to the tree
+# after kernel-obs, for the same nodes: the delivery path carries a kernel
+# fix as well as the observability package and the Java agent.
+publish_cve() {
+ cve=$W/pkg/cve-2026-31431-alg-splice-block
+ src=$REPO/upatches/kernel-cve/sources/cve-2026-31431-crypto-algif-aead-copy-fail/mitigation
+ mkdir -p "$cve"
+ say "build the precise CVE-2026-31431 mitigation and sign it into a package"
+ cp "$src/cve-2026-31431-alg-splice-block.bpf.c" "$cve/"
+ # The node is selected by its role, as kernel-obs and e2e-java are, so
+ # the delivery is deterministic; the shipped Beefile selects the
+ # kernel config the fix needs instead.
+ cat >"$cve/Beefile" <<-'EOF'
+ [package]
+ name = "cve-2026-31431-alg-splice-block"
+ description = "Refuses zero-copy splice into AF_ALG sockets, CVE-2026-31431"
+ license = "GPL-2.0 OR BSD-2-Clause"
+ authors = ["Authors of shirudo"]
+
+ [[upatches]]
+ source = "cve-2026-31431-alg-splice-block.bpf.c"
+
+ [upatches.tree]
+ id = "cve-2026-31431-alg-splice-block"
+ fixes = ["CVE-2026-31431"]
+
+ [upatches.tree.selector.labels]
+ role = ["edge"]
+ EOF
+ (cd "$W/pkg" && shirudo bpm build cve-2026-31431-alg-splice-block \
+ --version 1.0.0 --keys-dir "$KEYS")
+ bee=$W/pkg/cve-2026-31431-alg-splice-block-1.0.0.bee
+ say "push it to oci://$REGISTRY and append it to the upatch tree"
+ shirudo bpm push "$bee" \
+ "oci://$REGISTRY/shirudo/cve-2026-31431-alg-splice-block" \
+ --keys-dir "$KEYS"
+ shirudo bpm tree append "$bee" "oci://$REGISTRY/shirudo/end2end-tree" \
+ --keys-dir "$KEYS" --tree-id kernel-obs
+ tar --no-same-owner -xzf "$bee" -C "$W/pkg"
+ payload "$W/pkg/cve-2026-31431-alg-splice-block-1.0.0/upatches/cve-2026-31431-alg-splice-block.upatch" \
+ >"$W/cve-payload"
+}
+
# The jars of t9113, built here because javac is here: the agent of the
# java-base64 shield, which the host signs into its package, and the
# program that shows whether a JVM runs it.
@@ -97,6 +141,7 @@ role = ["edge"]' "$W/pkg/kernel-obs/Beefile"
tar --no-same-owner -xzf "$bee" -C "$W/pkg"
payload "$W/pkg/kernel-obs-1.0.0/upatches/kernel-obs.upatch" >"$W/payload"
publish_java
+ publish_cve
build_shield_jars
payload "$POLICY_FIXTURE" >"$W/policy-payload"
openssl rand -hex 16 >"$W/nonce"
@@ -119,10 +164,11 @@ verify() {
# and tree operation they name are the target's.
python3 - "$W/evidence.json" "$(cat "$W/payload")" \
"$(cat "$W/policy-payload")" "$BPM_OCI_CA_FILE" "$REGISTRY" \
- "$(cat "$W/java-payload")" <<'PY' ||
+ "$(cat "$W/java-payload")" "$(cat "$W/cve-payload")" <<'PY' ||
import json, ssl, sys, urllib.request
-evidence, payload, policy_payload, ca, registry, java_payload = sys.argv[1:7]
+(evidence, payload, policy_payload, ca, registry, java_payload,
+ cve_payload) = sys.argv[1:8]
ctx = ssl.create_default_context(cafile=ca)
@@ -148,6 +194,8 @@ 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 {"name": "kernel-obs", "payload_sha256": payload} in loads, loads
+assert {"name": "cve-2026-31431-alg-splice-block",
+ "payload_sha256": cve_payload} in loads, loads
assert loads[-1] == {"name": "policy-exec-graph",
"payload_sha256": policy_payload}, loads[-1]
java_loads = [r["upatch"] for r in records if r["type"] == "java_load"]
diff --git a/testing/end2end/t9105-delivery.sh b/testing/end2end/t9105-delivery.sh
index 6d1283e5..0b916870 100755
--- a/testing/end2end/t9105-delivery.sh
+++ b/testing/end2end/t9105-delivery.sh
@@ -4,13 +4,16 @@
#
# t9105 -- the delivery path end to end. The operator VM built kernel-obs
# into a package, pushed it to an OCI registry and appended it to a signed
-# upatch tree, then did the same with the Java agent e2e-java it compiled,
-# and an OpenTelemetry Collector listens (end2end/host.sh). The target
-# activates the signed config that points at both, and the units it ships
-# pull the tree, verify and load both packages, and export what it
-# observes; a JVM a user manager starts picks up the agent from the sealed
-# jar; the TPM-signed evidence goes back to the operator, which checks it
-# against what it published.
+# upatch tree, then did the same with the Java agent e2e-java it compiled
+# and with the precise CVE-2026-31431 kernel-bugfix upatch, and an
+# OpenTelemetry Collector listens (end2end/host.sh). The target activates
+# the signed config that points at them, and the units it ships pull the
+# tree, verify and load every package, and export what it observes; a JVM
+# a user manager starts picks up the agent from the sealed jar; the
+# shipped CVE reproducer, which reached the zero-copy splice into an
+# AF_ALG socket before the sync, is refused once the delivered mitigation
+# is loaded; the TPM-signed evidence goes back to the operator, which
+# checks it against what it published.
cd "$(dirname "$0")/.."
. ./integration-lib.sh
@@ -20,6 +23,9 @@ command -v python3 >/dev/null 2>&1 || test_skip_all "no python3"
E2E=$PWD/../build/test-vm/end2end
CONFIG=/var/lib/shirudo/images/config-end2end
PIN=/run/shirudo/bpffs/upatches/kernel-obs/link_0
+CVE=cve-2026-31431-alg-splice-block
+PIN_CVE=/run/shirudo/bpffs/upatches/$CVE/link
+PROBE=${SHIRUDO_TEST_FIXTURES_DIR:-}/cve-2026-31431-splice-probe.py
OUT=/mnt/shirudo-out/end2end
JAR=/run/shirudo-java/e2e-java.jar
JAVA_USER=shirudo-e2e-java
@@ -27,7 +33,17 @@ JAVA_USER=shirudo-e2e-java
test_skip_all "no registry and collector: run make -C testing end2end"
[ -s "$CONFIG.img" ] || test_skip_all "missing config-end2end image"
[ ! -e "$PIN" ] || test_skip_all "kernel-obs is loaded"
+[ ! -e "$PIN_CVE" ] || test_skip_all "the CVE mitigation is loaded"
mkdir -p "$OUT"
+
+# The shipped probe reaches the zero-copy splice into an AF_ALG socket
+# (SPLICE_OK) until the delivered mitigation refuses it (SPLICE_BLOCKED);
+# UNSUPPORTED is a kernel with no AF_ALG aead interface to exercise. It is
+# read before the sync, while no mitigation is loaded.
+BEFORE=UNSUPPORTED
+if [ -s "$PROBE" ]; then
+ BEFORE=$(python3 "$PROBE" 2>/dev/null </dev/null)
+fi
# The tree names the registry as the operator pushed to it, at QEMU's
# address for the host.
sed -E -i '/^[^#]*[[:space:]]registry\.test([[:space:]]|$)/d' /etc/hosts
@@ -97,6 +113,19 @@ test_expect_success 'the tree sync unit pulls, verifies and loads the package' '
"$SHIRUDO_BIN" status --json >"$OUT/status.json"
'
+test_expect_success 'the same sync delivered and pinned the CVE mitigation' '
+ [ -e "$PIN_CVE" ]
+'
+
+# The effect is exercised only where the kernel offers the AF_ALG aead
+# path; the delivery above holds either way. SPLICE_OK before the sync
+# proves the probe reached the splice the mitigation now refuses.
+if [ "$BEFORE" = SPLICE_OK ]; then
+ test_expect_success 'the delivered mitigation blocks the zero-copy splice' '
+ [ "$(python3 "$PROBE" 2>/dev/null </dev/null)" = SPLICE_BLOCKED ]
+ '
+fi
+
test_expect_success 'the sync installs the Java agent and names it in JAVA_TOOL_OPTIONS' '
[ "$(stat -c %a "$JAR")" = 644 ] &&
grep -qxF "JAVA_TOOL_OPTIONS=\"\${JAVA_TOOL_OPTIONS:+\$JAVA_TOOL_OPTIONS }-javaagent:$JAR\"" \