eBPF-based security platform
skills: add skills for writing unit, functional and end2end tests
Daniel Borkmann9432d3ec35a6
diff --git a/.agents/skills/end2end-tests/SKILL.md b/.agents/skills/end2end-tests/SKILL.mdnew file mode 100644index 00000000..f6f98615--- /dev/null+++ b/.agents/skills/end2end-tests/SKILL.md@@ -0,0 +1,210 @@+---+name: end2end-tests+description: Writes shirudo's end-to-end tests in testing/end2end/, the t90?? self-tests that run first on the host, the t91?? tests node A runs, and the host tests t9109 to t9114 that end2end/host.sh runs against fresh nodes. Covers host.sh and its rounds, node-lib.sh (node_wait, node_sh b and edge), pipeline-lib.sh, the operator VM and operator.sh, the node roles and their config images, the registry and the keepalive backend, wiring a test into the run and into t1007, what the host needs, and the logs to read. Use when adding or changing an end-to-end test, a step of host.sh or operator.sh, or what the nodes are prepared with.+paths:+ - "testing/end2end/**"+---++# End-to-end tests++The end2end tier shows a flow that crosses the operator, an OCI+registry, targets and the keepalive backend, which no lower tier can:+delivery, the keepalive pipeline, a tree's segments, a shield rolled out+and back. It is the costliest tier: a run builds the operator package+in a VM and boots up to five targets. A single command or hook goes in+a family, a function in a unit suite: "Choose a tier" in the `testing`+skill.++`Documentation/contribute/testing/testing.rst`, from "Run the+end-to-end tests" through "An application sandboxed and released", is+the reference for what the run does, with Figure 1 for its order. This+skill adds how to write a test into it.++## The run++`make -C testing end2end` runs the `t90??` tests of `testing/end2end/`+on the host, builds the bundle, and runs `testing/end2end/host.sh`. That+starts the containers and the operator VM, which runs `host.sh` again+with its own name: `operator.sh publish` builds and publishes, node B+boots, node A runs its tests, `operator.sh verify` checks node A's+evidence. Then host.sh runs the host tests in rounds, each on fresh+nodes. `<name>` below is `end2end-<pid>`, or `VM_NAME` when set.++| Test | Runs | Sources | Started by |+|---|---|---|---|+| `t90??`, as `t9001` | on the host, before any VM | `test-lib.sh` | `run-tests.sh end2end` |+| `t9101` to `t9107` | as root in node A, in number order, over SSH from the host | `integration-lib.sh`, `target_guard` | `run-target-tests.sh end2end` |+| `t9109` to `t9114` | on the host, as the user who runs make, root in CI | `test-lib.sh`, `vm/stack-lib.sh`, `end2end/node-lib.sh`, `end2end/pipeline-lib.sh` | `host_test` in `host.sh`, in the order it names them |++| Node | VM | Role | When |+|---|---|---|---|+| operator | `<name>-operator` | no TPM, no shirudo kernel arguments, the only VM with the signing key | until node A's evidence is verified |+| node A | `<name>-end2end` | `config-end2end`, `role=edge`, activated by `t9105` | beside node B |+| node B | `<name>-end2end-b` | `config-core`, `role=core` | through round 1 |+| edge node | `<name>-end2end-edge` | `config-edge`, `role=edge` | round 1: `t9109`, `t9110`, `t9112` |+| second pair | `<name>-2-end2end-edge`, `<name>-2-end2end-b` | as above | round 2: `t9111` |+| third edge node | `<name>-3-end2end-edge` | `role=edge` | round 3, x86-64 only: `t9113` |+| fourth edge node | `<name>-4-end2end-edge` | `role=edge` | round 4: `t9114` |++The nodes beside node A boot in node mode (`make -C testing+vm-node-end2end END2END_NODE=b|edge`): prepared like node A, with their+config image active, but they run no tests and start no timers. A test+starts what it needs (`unit_ok edge shirudo-bpm-tree-sync.service`,+`shirudo-keepalive.service`). Each round after the first boots fresh+nodes and a registry started again without a volume (`second_pair`,+`lone_node`); the backend stays the same for every round.++What runs on the host:++| Service | Address |+|---|---|+| Registry, TLS from the throwaway CA `$E2E/ca.pem` | `127.0.0.1:15443`; the operator VM and node A name it `registry.test:15443` |+| Collector and ClickHouse for node A's exports | `https://127.0.0.1:14318`, `http://127.0.0.1:18123` |+| Keepalive backend: collector and ClickHouse | `https://127.0.0.1:14320`, `http://127.0.0.1:18125` |++The containers are named `shirudo-end2end-*` (`STACK_NAME`). The guests+reach the host as `10.0.2.2`. A tree names each package by the address+it was appended through, so a node that syncs a tree appended at+`127.0.0.1:15443` first runs `node_reach`, which starts+`end2end/tcp_forward.py` in it.++## Write a host test++Most tests of the tier are host tests: the host holds the operator key,+the registry and the backend, and reaches every node.++1. Number it after the last `t91??`, checked as for any test (the+ `functional-tests` skill, "Place and number it"); the order it runs+ in is where `host.sh` names it.+2. Start from `t9113-shield-rollout.sh`. Its header says that `host.sh`+ runs it, after which test, against which nodes. It changes to+ `testing/`, sources `test-lib.sh`, and refuses to run without the+ run around it:++ ```sh+ [ -n "${END2END_BACKEND-}" ] && [ -n "${END2END_KEYS-}" ] ||+ test_skip_all "end2end/host.sh runs it after t9111, with a keepalive backend"+ ```++ then sources `./vm/stack-lib.sh`, `./end2end/node-lib.sh` and+ `./end2end/pipeline-lib.sh`, and waits with `node_wait edge 0`.+ `host_test` fails a test that skips (`<number> was skipped`), so each+ `test_skip_all` there marks a broken run, never a result.+3. Set what `pipeline-lib.sh` reads before calling it: `W`, `CHECKS`,+ `STATE`, `RUNTIME`, `E2E`, `STACK_NAME`, `TREE_ID` and `WINDOW` where+ used, and `S`, `KEYS`, `BACKEND`, `REGISTRY` and `TREE` for+ `tree_append_pushed`, `tree_ingest`, `sync_to` and `head_report`.+4. Act through the libraries rather than open-coding SSH, SQL or+ registry calls:+ - `node-lib.sh`: `node_wait <node> [<seconds>]`, `node_sh <node>+ <command line>` with the test's standard input and output,+ `node_builder_name <node> ak|ek`. `host_test` sets `NODES_DIR` and+ `NODES_HOST` for it.+ - `pipeline-lib.sh`: `on` (`node_sh` with no input), `unit_ok`,+ `node_reach`; `ch`, `ch_wait`, `ch_cmp` and `refresh` against the+ backend's ClickHouse; `node_view`, `view`, `ak_record`, `ak`,+ `latest_cmp`, `history_cmp`, `status_log` and `status_cmp` for a+ node's records against the backend's rows; `registry_mark` and+ `requests` to read what the registry served between two marks;+ `manifest_status`, `tree_append_pushed`, `tree_ingest`, `sync_to`+ and `head_report` for a package rolled out to the edge node.+ - `testing/vm/stack-lib.sh`: `stack_backend_schema`,+ `stack_backend_client`, `stack_oci_log`.+5. A test that needs an empty backend drops and loads it again, as the+ case `the backend starts empty` of `t9113` does; one that needs a+ tree from scratch checks that the registry holds none+ (`manifest_status ... = 404`).+6. Build what it publishes on the host: a Beefile under+ `testing/fixtures/pipeline/<package>/` built with `"$S" bpm build`+ (`t9109` builds `xfs-fix`), or a package published with+ `tools/put-shields` (`t9113`, `t9114`). What needs a JDK the operator+ VM builds (`build_shield_jars` in `operator.sh`) and `host.sh` copies+ to `$E2E/shield/`.+7. Wire it into the run, all in the same commit:+ - `host_test t91<NN>-<what>` in `host.sh`, in the round whose nodes it+ needs. A test that needs nodes that ran nothing gets a round of its+ own, `lone_node -<n> <ordinal>` before it and `node_down edge ""`+ and `node_clean edge` after, as `t9114`'s round has. Update the+ header comment of `host.sh`, which lists the rounds.+ - The file in the `case` of `testing/run-target-tests.sh` that+ leaves the host tests out, or node A runs it.+ - The case `the runners split the tests by number` of+ `testing/functional/build/t1007-test-vm-cli.sh`: a `test -e` of+ the file, the `grep -Fqx` of its `host_test` line (with the tab+ when the line is indented, as `t9113`'s), and of the+ `run-target-tests.sh` line.+ - `testing.rst`: the sentence that lists the host tests in their+ order, a section like "An application sandboxed and released",+ and the figure, `Documentation/figures/contribute-end2end-run.tex`+ with its SVG, when a round is added (the `docs` skill); its row in+ `test-coverage.rst` under ``end2end`` (9).++## Write a node A test++Node A is one VM for its whole suite, so a test finds what earlier ones+loaded and activated: `t9105` activates `config-end2end` and syncs the+operator's tree, `t9106` writes the evidence that `operator.sh verify`+checks. A test there:++- sources `integration-lib.sh`, calls `target_guard`, and never skips+ as a whole (`run-target-tests.sh` fails it; `t9107` without+ `build/test-vm/end2end/backend-tree.digest` is the runner's one+ exception);+- reads `$PWD/../build/test-vm/end2end/` (`ca.pem`, `nonce`) through the+ read-only checkout and writes what the host reads after into+ `/mnt/shirudo-out/end2end/`, `result/end2end/` of node A's VM;+- uses `end2end/kernel-obs-lib.sh` for a `kernel-obs` scenario, as+ `t9101` does;+- gets a package of its own from `operator.sh`: a `publish_<x>`+ function called from `publish()`, which pushes to+ `registry.test:15443` and appends to `shirudo/end2end-tree` with+ `role=edge`, and a check in `verify()` that the evidence names it.++## What the host needs++Everything a VM goal needs (the `testing` skill, "Before a VM goal" and+"Run unconfined"), and also: `docker`, which `host.sh` requires;+tpm2-tools, swtpm-tools, the swtpm TCTI `libtss2-tcti-swtpm0t64` and+`openssl` for the nodes' vTPM builder; network the first time, for the+operator VM's image (clang 23 from apt.llvm.org, a JDK);+`TEST_VM_HOST_PRIVATE_DIR` outside the checkout; and the memory of+three guests at once, about 10 GiB with the defaults, plus five+containers. `make -C testing end2end` builds the quote checker+`host.sh` needs. With `VM=0` only the `t90??` tests run.++## Run and read++1. Check what runs without a VM: `make -C testing end2end VM=0`,+ `shellcheck` on the files changed, as the `shell` skill runs it, and+ after wiring `make -C testing functional/build VM=0+ TEST_FILTER='^t1007-'`.+2. Run the whole tier; no test of it runs alone. `TEST_FILTER` reaches+ node A's runner, where it would leave out what later steps need,+ and `host.sh` runs every host test whatever it says.++ ```sh+ make -C testing end2end+ ```++3. Read the result. The `end2end:` lines say which step ran last.+ - `<number> failed; see build/test-vm/end2end/<number>.log` or `was+ skipped`: a host test. Its TAP is in that log.+ - `host.sh failed with status <n>`: the operator VM's serve command,+ that is the publication, node A or the verification. The+ `end2end operator:` lines say which step; the operator's+ `build/test-vm/vms/<name>-operator/result/operator-build.log` and+ `result/end2end/` hold its build and what it published.+ - node A's TAP is in `build/test-vm/vms/<name>-end2end/result/guest.log`;+ `the SSH session that ran the target tests failed` is the SSH+ channel, not a test.+ - `... did not boot; see build/test-vm/end2end/node-<b|edge><round>.log`+ (`node-edge-3.log` for round 3): the node's boot, with its state in+ `build/test-vm/vms/<name><round>-end2end-<b|edge>/`.+ - `status_cmp` prints each node's backend log, its records' tamper+ arrays and its counters when `node_status` differs.+4. Fix and run the tier again. While it runs, `make -C testing vm-ssh+ VM_NAME=<name>-operator` or `<name>-end2end` opens a shell; never+ stop, clean or reuse the run's VMs. A `pkill -f <pattern>` inside a+ `node_sh` command line also kills the remote shell that carries the+ pattern: write it as `pkill -f '[p]attern'`, which that shell's+ command line does not match.diff --git a/.agents/skills/functional-tests/SKILL.md b/.agents/skills/functional-tests/SKILL.mdnew file mode 100644index 00000000..562df6f6--- /dev/null+++ b/.agents/skills/functional-tests/SKILL.md@@ -0,0 +1,260 @@+---+name: functional-tests+description: Writes shirudo's shell tests in testing/functional/, the operator tests (t?0??) that run on the build host and the target tests (t?1??) that run as root in a fresh VM per family, and the tests of .github/scripts in testing/ci-checks/. Covers test-lib.sh and integration-lib.sh, choosing the family and a free number, signed upatch and config image fixtures, compiled helpers, the test-coverage row, why a target test never skips, the errexit, eval and dash traps of the harness, and reading guest.log and result/status. Use when adding, changing or debugging a shell test, a fixture or helper it uses, or a test of a CI script.+paths:+ - "testing/functional/**"+ - "testing/ci-checks/**"+ - "testing/test-lib.sh"+ - "testing/integration-lib.sh"+---++# Functional tests++A functional test shows one command, mechanism or attack: as an+operator test on the build host when it needs no root, kernel or TPM,+as a target test in its family's VM when it does. The tests of+`.github/scripts/` work the same way in `testing/ci-checks/`. A pure+function goes in a unit suite, a path across operator, registry,+target and backend in end2end: "Choose a tier" in the `testing` skill.++`Documentation/contribute/testing/testing.rst` is the reference: "Test+numbers and families", "Write a shell test" with both skeletons, and+"Add a fixture or a helper". This skill adds the procedure and the+traps.++## Place and number it++1. Take the family that owns the mechanism from the table in+ `testing.rst`. `K` is `0` for an operator test, `1` for a target+ test. The directories of one family share its numbers: `upatch` and+ `upatch-many`, `image` and `image-reboot`, `tamperproof` and `labels`,+ `bpm` and its `bpm-*`.+2. Take the next number after the highest of the family and kind, and+ check that no test ever had it:++ ```sh+ ls testing/functional/*/t<F><K>??-*.sh+ git log --format= --name-only -- 'testing/*t<F><K><NN>-*'+ ```++ A hit outside the family's directories comes from an older+ numbering and does not count.+3. Name it `t<F><K><NN>-<what>.sh`. A Python companion takes the same+ stem (`t5101-verity-boot-signers.py`) and only its shell test runs+ it. A file that is not a test takes no name of this form.++Nothing registers a test. `testing/run-tests.sh` runs every+`t?0??-*.sh` of the family in name order on the host,+`testing/run-target-tests.sh` every `t?1??-*.sh` in its VM, and+`testing/Makefile` makes a family of each directory that holds either.+A directory added is a family of its own: add it, where `make -C+testing help` lists it, to the families the case `the runners split+the tests by number` of `testing/functional/build/t1007-test-vm-cli.sh`+compares, and to the family tables of `testing.rst` and+`test-coverage.rst`. CI's `functional-ci-4` shard takes it,+`functional-ci-3` one named `bpm-*`.++## Operator tests++- Start from `testing/` (`cd "$(dirname "$0")/../.."`, then+ `. ./test-lib.sh`), as `testing.rst` shows. Name the binaries+ `S=../shirudo` and `SHB=../tools/shirudo-build/shirudo-build`; a test+ that runs `bpm build` exports `SHIRUDO_BUILD` with an absolute path,+ as `t7006-policy-labels.sh` does.+- `test_skip_all` only for what a host may lack, a tool or an unbuilt+ binary. On the host a skip passes, so it must never stand in for a+ result.+- CI runs the host tier as root (`sudo make` in+ `.github/scripts/tests.sh`); you run it as yourself. A case whose+ result depends on the user branches on `id -u`, as `t1006` does.+- The libtpms simulator stands in for a TPM on the host:+ `SHIRUDO_TPM_TCTI="cmd:exec $(pwd)/helper/tpmsim-cmd <state-dir>"`,+ as `t4005-tpm-session.sh` sets it.++## Target tests++Source `integration-lib.sh` and call `target_guard`, which skips+without root, `$SHIRUDO_BIN` or an attached LSM. The guest's+`/etc/shirudo-test-vm.env` sets:++| Variable | Value |+|---|---|+| `SHIRUDO_BIN` | `/usr/local/bin/shirudo-runtime`, the runtime image's command, with task authority; `/usr/local/bin/shirudo` is a copy without it, for what an unauthorized caller gets |+| `SHIRUDO_TEST_FIXTURES_DIR` | `/mnt/shirudo-bundle/fixtures`, the signed `.upatch` fixtures |+| `SHIRUDO_TEST_KEY_FIXTURES` | `/mnt/shirudo-bundle/verity`, the signed config images |+| `SHIRUDO_TEST_RESULTS` | `/mnt/shirudo-out/verity`, `result/verity/` on the host |++`integration-lib.sh` gives `require_loaded <fixture>` (loads a signed+fixture unless its pins exist), `report_field <key>` (a top-level field+of a `--report=-` document on stdin), `runtime_binary`, `keyring_mode`,+`fifo_release <fifo>`, and the `tree_*` helpers that `t7101` to `t7103`+share.++- Each family boots its own VM, so a test finds loaded only what its+ family loaded. Call `require_loaded` rather than counting on an+ earlier test (`t3104`, `t6117`).+- The tests of a family share one VM in number order, and state under+ `/var/lib/shirudo` is sealed, so nothing a test leaves there goes+ away. Unload in the `EXIT` trap what the test loaded, with+ `"$SHIRUDO_BIN" upatch unload <fixture>.unload.upatch --no-precheck`+ as `t8101` does. A probe that may damage labeled state works on the scratch+ image of `t6111-seal-scratch.sh`, never on `/var/lib/shirudo`.+- A target test never skips: `run-target-tests.sh` fails a test that+ prints `1..0 # SKIP` with `required target test was skipped`. Its+ `test_skip_all` lines catch a VM that lacks a tool or fixture, which+ should fail the family. For a kernel feature the test VM's kernel+ lacks, run a case that needs nothing and guard the feature's case+ with an `if`, as `t6153-xfs-attrmulti.sh` does for XFS.+- Read a tamper counter before and after, from `"$SHIRUDO_BIN" status+ --json` under `tamper_attempts.counters`, and compare with `-gt` or+ `-ge` (`t6118`).+- Every target command holds the config operation lock for its whole+ run, so two never run at once. A test that keeps one stopped, on a+ FIFO that `fifo_release` opens, reads `status` before and after it,+ not while it waits.+- To stop a command partway, start it in the background in the case,+ poll with builtins only (`kill -0`, `[ -e ]`) and bound the loop: a+ child that exited stays a zombie and `kill -0` succeeds until it is+ reaped (`stopped_load()` in `t6144`).+- What only the next boot shows goes in `image-reboot`, whose VM runs+ its tests, reboots and runs them again: a test reads+ `SHIRUDO_TEST_BOOT`, `1` or `2`, and keeps what it carries across+ under `SHIRUDO_TEST_RESULTS` (`t5106`).++## Fixtures and helpers++- A signed upatch fixture is `testing/fixtures/<name>.bpf.c` and a line+ `queue_fixture build_fixture <name>.bpf.c shirudo-test-<x>+ "$FIXTURE_WORK/trusted"` in `testing/vm/build-bundle-payload.sh`. Its+ unload directive takes a `<x>_payload=` read with `upatch info --json`+ and a line `shirudo-test-<x> $<x>_payload shirudo-test-<x>.unload.upatch`+ in the list `shirudo-build --unload` reads there. A fixture file the+ globs of `TEST_VM_BUNDLE_SOURCES` in `testing/Makefile` do not match,+ one in a subdirectory of `testing/fixtures/` not listed there, goes+ in that list, or a change to it does not rebuild the bundle.+- A signed config image is a name in the loop of+ `testing/vm/image-fixtures.sh` with a `case` for its files. The guest+ finds it as `$SHIRUDO_TEST_KEY_FIXTURES/<name>` and activates it with+ `"$SHIRUDO_BIN" image update`, as `tree_configure` does.+- A compiled helper is `testing/helper/<name>.c` with a rule and a+ `TEST_HELPERS` entry in `Makefile.shirudo`; one a target test runs is+ also in the helper list of `build-bundle-payload.sh`. `make` alone+ does not rebuild helpers: `make -C testing test-helpers`.++## Harness traps++The `shell` skill has the dash and errexit traps of every script; these+are the ones the harness adds or makes worse.++- `test-lib.sh` runs `set -eu`. A failing step of an `EXIT` trap ends+ the trap and the script exits 1 with every case `ok`; guard each step+ with `|| true` (`restore()` in `t6118`).+- A body runs as `if (eval "$body")`: errexit is off inside it, so a+ failing line followed by another passes. Chain every step with `&&`.+- A body's standard output is discarded; write what a failure needs+ to `>&2`, which comes back as `#` lines.+- A body is a subshell: a variable it sets never reaches the script or the+ next case, and `wait` there cannot reap a child the script started+ (it returns 127 at once). Keep state in files under the test's+ directory.+- Tests run under `sh`, dash on Ubuntu. A redirection that fails on a+ special builtin ends the whole case under dash, even negated:+ `! : >"$sealed/f"` reports `not ok`. Write `! true >"$sealed/f"` or+ `! touch "$sealed/f"`.+- `mv` across file systems copies and unlinks instead of renaming. A+ probe of the rename hook stages its source where `rename(2)` can+ reach the target, as `t6118` stages in `/var/lib/t6118-stage`; and+ `mv` of a directory onto an existing one moves it inside.+- Never `rm -rf` a scratch tree that may still hold a bind of `/run`:+ removing it empties the real `/run`. `cleanup()` in+ `t6120-umount-above.sh` unmounts the tree and removes it only when+ `$W/run` is no longer a mount point.+- `sync && echo 2 >/proc/sys/vm/drop_caches` evicts the seal's+ directory marks. The entry hooks read the label again, so eviction+ must open nothing: `t6115` and `t6118` try a rename after each+ eviction to show it. It is no way to plant an entry in sealed state.+- A `BUILD_CONTAINER` exported in the shell fails a case of `t1007`,+ which reads the default from `make -n`. Run the host tier without it.++Run `shellcheck <test>` from the root before the family and fix what+the lines you wrote add; the Lint workflow fails only at `-S error`,+which misses the bashisms the default severity names (the `shell`+skill).++## Run and read++1. Run the family's host tests first; they take seconds, and a failure+ there stops the family's run before its VM boots anyway:++ ```sh+ make -C testing functional/<family> VM=0+ ```++2. Run the family, which boots its VM (the `testing` skill, "Before a+ VM goal"). `TEST_FILTER` selects tests in the VM too:++ ```sh+ make -C testing functional/<family> TEST_FILTER='^t6118-'+ ```++3. Read the result. The run ends with `[test-vm] result: PASS` or+ `FAIL`, then:+ - `failed tests:` names each case that printed `not ok`;+ - `failed suites: ... (no individual TAP failure recorded)` is a+ script that exited non-zero with every case `ok`: its `EXIT` trap+ or a top-level command failed;+ - `failed tests: none recorded (failure occurred before the test+ suite)` is the guest's preparation: read `result/guest.log` from+ the top and `console.log`.++ The VM is `build/test-vm/vms/test-<family>-<suffix>/`. Its+ `result/guest.log` holds what every test printed,+ `result/verity/<test>.sh.log` one test's output, `result/status` the+ guest's exit status. A failed run keeps its disks and copies its logs+ to `build/test-vm/logs/<vm>/`.+4. Fix and run the family again. While a family runs, edit nothing and+ start no second run in the checkout: a run whose inputs changed+ rebuilds the bundle under the running guest, whose fixtures vanish+ mid-test (`No such file or directory` under `/mnt/shirudo-bundle`).+ `make -j` boots several families on one bundle.++A test run by hand in an interactive VM is no verdict. That VM enables+the timers, and the map export runs every 5 seconds and takes the config+operation lock, so a command there can print `waiting for another+shirudo command to release the config operation lock` or fail after 30+seconds with `Resource temporarily unavailable`. It keeps what earlier+runs left in sealed state. A suite started in the background from an+`ssh` session inherits its session keyring, which Ubuntu's PAM revokes+at logout, and every `add_key()` then fails with `Key has been revoked`.+`make -C testing functional/<family>` gives the verdict CI gives.++## Document it++Add the test's row to its family's table in+`Documentation/contribute/testing/test-coverage.rst`, `t<F><K><NN>-<what>`+and what it covers, and name it in "Coverage by area", in "Coverage by+threat" and the threat's `:Tests:` field in+`Documentation/security/threat-model.rst` when it covers one, and in+"Coverage of tamper counters" when it moves one. A test that closes a+line of "Not covered" removes it. `.github/scripts/check-docs.sh` fails+on a page that names a test that does not exist, never on a missing row.++## Tests of CI scripts++A script of `.github/scripts/` is tested in+`testing/ci-checks/t00<NN>-<what>.sh`, family 0, kind 0, as+`t0001-check-dco.sh` tests `check-dco.sh`:++- Start one level up, `cd "$(dirname "$0")/.."`, source `./test-lib.sh`,+ and name the script `$(cd .. && pwd)/.github/scripts/<script>`.+- Give it a throwaway repository or tree under `mktemp -d`, never the+ checkout (`t0001`).+- Put a stub of every command it would run first on `PATH`, as+ `t0011-main-status.sh` stubs `gh` in `$fixture/bin`. Stub the scripts+ it calls as well: several scripts there run `apt-get`, and+ `kernel-obs-apt-diagnostics.sh` runs `update-initramfs`, which must+ never reach the host.+- Run `make -C testing ci-checks`, or `sh testing/ci-checks/<test>.sh`.+ CI runs the tier with the unit tests (`tests.sh run unit`) and in the+ sanitizer jobs. Its row goes under ``ci-checks`` (0) in+ `test-coverage.rst`.diff --git a/.agents/skills/shell/SKILL.md b/.agents/skills/shell/SKILL.mdindex 742cb09b..0faa5ba8 100644--- a/.agents/skills/shell/SKILL.md+++ b/.agents/skills/shell/SKILL.md@@ -208,6 +208,7 @@ its traps, messages and exit status: start a script from it.`testing/ci-checks/t00<NN>-<script>.sh`, as `t0001-check-dco.sh`runs `check-dco.sh` on a throwaway repository. A script that onlysets up a throwaway machine is checked by the workflow that runs it.+ The `functional-tests` skill says how to write a test.- `t1007-test-vm-cli.sh` greps lines of `testing/vm/guest.sh` and`testing/vm/run.sh` as they are written, and `t1006-gen-initrd-cli.sh`checks the options of the initrd generator and installer: a change todiff --git a/.agents/skills/shell/skeleton.md b/.agents/skills/shell/skeleton.mdindex 3ee81b38..ee52c3e7 100644--- a/.agents/skills/shell/skeleton.md+++ b/.agents/skills/shell/skeleton.md@@ -5,7 +5,8 @@ runs under dash: the header, `set -eu`, the traps around one scratchdirectory, a usage error with status 2, every finding reported with anannotation under `GITHUB_ACTIONS`, status 1 with a count, and one lineon stdout when it passes. Start a script from it and cut what the-script does not need.+script does not need; a test starts from the `functional-tests` skill+instead.```sh#!/bin/shdiff --git a/.agents/skills/testing/SKILL.md b/.agents/skills/testing/SKILL.mdindex 646b5264..5a021347 100644--- a/.agents/skills/testing/SKILL.md+++ b/.agents/skills/testing/SKILL.md@@ -1,6 +1,6 @@---name: testing-description: Run shirudo's tests and its test VM. Covers the unit, ci-checks, functional and end2end tiers, one suite or family of them, the target tests that each boot a QEMU guest with a software TPM, sanitizer and fuzz runs, and booting, reusing or stopping an interactive VM. Use when asked to run, add or debug a test, to boot or use a test VM, or when a task needs shirudo running as a target, which the host cannot do. Takes an optional kernel for the VM, bpf-next by default or a release from 7.4 up.+description: Runs shirudo's tests and its test VM, and decides which tier a test belongs in. Covers the unit, ci-checks, functional and end2end tiers, one suite or family, the target tests that boot a QEMU guest with a software TPM, sanitizer and fuzz runs, and booting, reusing or stopping an interactive VM. Use when asked to run or debug a test, to choose where a new test goes, to boot or use a test VM, or when a task needs shirudo running as a target. Takes an optional kernel, bpf-next by default or a release from 7.4 up.---# Testing@@ -11,6 +11,25 @@ interactive VM" and "Run a target test by hand".`Documentation/contribute/testing/test-coverage.rst` lists what each testcovers and changes with every test added or removed.+## Choose a tier++Put a test in the lowest tier that can show the change works, then load+that tier's skill to write it:++| Under test | Tier and file | Cost | Reaches | CI runs it | Skill |+|---|---|---|---|---|---|+| A function or parser of `util/`, or an object a suite links through `UNIT_OBJS` | unit, `testing/unit/<m>.c` | seconds | the code in-process, files under `TMPDIR`, a private mount namespace as root; no BPF LSM, keyring, TPM or VM | Build with gcc and clang on every pull request, in the merge queue and on main; the CI suite's unit and arm64 host jobs; ASan, UBSan and MSan on pull requests, TSan on main | `unit-tests` |+| A script of `.github/scripts/` | ci-checks, `testing/ci-checks/t00<NN>-*.sh` | seconds | a throwaway repository and stubbed commands | the CI suite's unit and arm64 host jobs and the ASan and UBSan job, on pull requests and main | `functional-tests` |+| A command's behavior on the build host: build, sign, package, publish to a mock registry, `attest verify`, TPM structures under the libtpms simulator, the build and VM scripts | operator test `t<F>0<NN>` in its family's directory | seconds to a minute | the checkout's binaries and helpers, as the user who runs it, root in CI | the CI suite's functional shards and arm64 host job and the ASan and UBSan job, on pull requests and main | `functional-tests` |+| Enforcement or state on a booted target: an LSM hook, the seal, the keyrings, the register, load and unload, tree sync | target test `t<F>1<NN>` in its family's directory | a bundle build and a VM boot per family, minutes | root in a fresh VM with the test kernel, a software TPM, the initrd, signed fixtures and config images | the CI suite's functional shards, x86-64, on pull requests and main | `functional-tests` |+| A flow across the operator, a registry, targets and the backend | end2end, `testing/end2end/t91<NN>-*.sh` | the whole tier, the longest run: the operator package built in a VM and up to five target boots | the operator VM, fresh nodes, the registry and the keepalive backend | the CI suite's end-to-end job, x86-64, on pull requests and main | `end2end-tests` |++A parser of input from outside the host also gets a fuzz target (the+`fuzz-target` skill) and a CBMC proof where one fits (the `proofs`+skill), which CI runs on main only. The SQL of `tools/backend` is+tested by `tools/backend/test/<name>.sql`, as "Run the backend tests"+in `testing.rst` says. The merge queue runs none of the shell tiers.+## Tiers```sh@@ -32,46 +51,11 @@ tools/backend/test/run.sh <name>... # only the SQL tests namedmake -C tools/xtop tests # xtop: tsc and bun test, needs bun```-The end2end tier runs t9107, and t9109 to t9112 on the host, against-the keepalive backend of `tools/backend`, which `host.sh` starts for-every run. The tier boots two VMs at once, each with its own-swtpm: node A runs the tests, node B (`make -C testing vm-node-end2end`,-node mode of `vm/run.sh`) takes `role=core` from `config-core` and waits.-Node mode first runs `vm/tpm-builder.sh`, which creates the node's AK-and EK with tpm2-tools, writes their names to `tpm-names` in the VM's-state directory, and stores an EK certificate from a throwaway CA whose-certificate it leaves in `ek-ca.pem` beside them; host.sh verifies node-B against the names and t9109 enrolls it in the backend, t9112 enrolls-the edge node through credential activation against its CA, so node mode-needs tpm2-tools, the swtpm TCTI of tpm2-tss (`libtss2-tcti-swtpm0t64`),-swtpm-tools and openssl on the host. The tier needs the quote checker,-which `make -C testing end2end` builds first. A fresh edge node-(`END2END_NODE=edge`, `role=edge` from `config-edge`) boots once node A-has stopped, and `host.sh` runs t9109,-then t9110, which continues t9109's tree in segments, and t9112, on the-host against it and node B. Then a second fresh pair boots in their-place, as `<name>-2-end2end-edge` and `-b`, the registry restarts empty, and-`host.sh` runs t9111, the backward walk over sealed segments, against-them. On x86-64 a third fresh edge node then boots alone, as-`<name>-3-end2end-edge`, the registry restarts empty again, and `host.sh`-runs t9113 against it: the java-base64 shield published, appended to a-new tree, pulled and blocking `upatches/test/badDecoder.jar` in a JVM,-then deleted and gone. Last, on every architecture, a fourth fresh edge-node boots alone, as `<name>-4-end2end-edge`, the registry restarts-empty once more, and `host.sh` runs t9114 against it: the app-sandbox-upatch built with the sandbox of `testing/fixtures/app-sandbox`,-published, appended to a new tree, pulled and restricting what-`testing/end2end/app_sandbox_probe.py` executes, connects to and-writes, then deleted and gone. Their output is-`build/test-vm/end2end/t9109.log` to `t9114.log`.-A test reaches the nodes with `node_sh b` or `node_sh edge` of-`testing/end2end/node-lib.sh`, and does to them, the registry and the-backend what `testing/end2end/pipeline-lib.sh` offers. Their boot logs-are `build/test-vm/end2end/node-b.log` and `node-edge.log`, with `-2`-for the second pair, their state `build/test-vm/vms/<name>-end2end-b/`-and `-edge/`. Every node-declares the image of `testing/vm/files/end2end.os-release` without a-root hash, so the backend binds them `declared`.+The end2end tier runs node A's tests, t9101 to t9107, over SSH, then+the host tests t9109 to t9114 in rounds on fresh nodes, against the+keepalive backend `host.sh` starts. The `end2end-tests` skill says what+each round boots, what the host needs and where each log goes;+"Run the end-to-end tests" in `testing.rst` has the whole run.Host tests run as they are. A target test, `t?1??`, runs in a fresh VMper family, which needs KVM, an unlimited `ulimit -l`, the test kernel@@ -79,17 +63,16 @@ and the bundle, but not root; seebelow. The VM always boots the dm-verity runtime and the signed configfrom a dracut initrd. The runner caches the initrd by kernel, bundle andinitrd inputs, while each family keeps its own VM and guest state. CI-runs the same suite through `.github/scripts/tests.sh`. A change to-`util/<m>.c` adds or updates its cases in `testing/unit/<m>.c`, and a-parser of input from outside the host gets a target in `testing/fuzz/`.+runs the same suite through `.github/scripts/tests.sh`, as root.## Reading results- The host tiers print TAP. Look for `not ok`, `runtime error:` and`ERROR: AddressSanitizer`, and read the reason of every `# SKIP`: a- skip can hide a failure. t7005 and t7006 skip when `bpm build` fails,- so a sanitizer abort in `shirudo-build` reads as a skip there, and- t3004 skips when the arena serializer does not build.+ skip can hide a failure. `grep -nE '^not ok|runtime error:|ERROR:+ AddressSanitizer|# SKIP'` finds each. t3004 skips when the arena serializer does+ not build, so a sanitizer abort in `shirudo-build` reads as a skip+ there.- A family's target tests print only `[test-vm] result: PASS` or`FAIL`. Their TAP output is in`build/test-vm/vms/<name>/result/guest.log`, the exit status in@@ -108,19 +91,15 @@ parser of input from outside the host gets a target in `testing/fuzz/`.## Before a VM goal-- `vm`, `test-vm-bundle` and every family with target tests require a CI- kernel artifact under `artifacts/bpf-next-kernel-debs/`.- `testing/vm/kernel-artifact.sh` pins a build run and a SHA-256 for each- architecture. Dispatch Build kernel packages and Publish test kernel- on shirudo's main branch for a new pin. Update the run ID and both- checksums together. CI builds x86-64 and arm64 from `testing/kernel/`- for a run that changes the kernel inputs. Otherwise it downloads the pinned- prerelease. Local VM goals use `testing/vm/kernel-artifact.sh fetch`- when the kernel is missing. It downloads the prerelease ZIP with- `curl` and verifies its checksum before extraction. Use authenticated- `gh` with `KERNEL_RUN_ID` for a specific shirudo Actions run. A kernel- already staged is left alone: remove the directory to get the pinned- one.+- `vm`, `test-vm-bundle` and every family with target tests need a+ kernel staged under `artifacts/bpf-next-kernel-debs/`. When none is,+ the goal runs `testing/vm/kernel-artifact.sh fetch`, which downloads+ the prerelease the script pins with `curl` and checks its SHA-256+ before it unpacks it; `KERNEL_RUN_ID=<run>`, with an authenticated+ `gh`, fetches another run of Build kernel packages instead. A kernel+ already staged is used as it is: remove the directory to get the+ pinned one, and say so first. Building, staging or publishing a+ kernel and moving the pin are the `kernel` skill's.- The bundle builds in the build container (`testing/container/`) froma copy of the files git sees in the checkout, tracked and untracked butnot ignored, so uncommitted changes are tested; edit nothing until the@@ -145,8 +124,10 @@ No VM goal needs root. A terminal installed as a snap, such asAlacritty, gives everything it starts its `snap.<name>` AppArmor label(`cat /proc/self/attr/current`), and Ubuntu's `swtpm` profile takessignals only from unconfined processes and from `swtpm`: Ctrl-C, the-runner's cleanup and `vm-stop` then leave `swtpm` running. Run the goal-as a transient user service, which runs unconfined. It starts with the+runner's cleanup and `vm-stop` then leave `swtpm` running. When `cat+/proc/self/attr/current` prints anything but `unconfined`, run the+goal as a transient user service, which runs unconfined; otherwise run+it directly, with the shell's environment and limits. It starts with theenvironment and limits of the user manager, not the shell's. Thefamilies build the host tier on the host, and so does the bundle with`BUILD_CONTAINER=0`; pass on the `PATH` and `LD_LIBRARY_PATH` a host@@ -219,10 +200,11 @@ done```Use a VM that passes all three checks, and name it in every command with-`VM_NAME=<name>`. Ask the user what to do in any other case: when no VM-runs, when one runs a different kernel or a stale build, or when several-pass. Offer to boot a new VM, to stop or replace the old one, or to use it-anyway. Never stop, replace or clean a VM without that answer.+`VM_NAME=<name>`. When no VM of this checkout runs, boot one (`make -C+testing vm`) and say so. Ask the user when one runs a different kernel+or a stale build, or when several pass: offer to boot a new VM beside+it, to stop or replace the old one, or to use it anyway. Never stop,+replace or clean a VM without that answer.## Commandsdiff --git a/.agents/skills/unit-tests/SKILL.md b/.agents/skills/unit-tests/SKILL.mdnew file mode 100644index 00000000..84120365--- /dev/null+++ b/.agents/skills/unit-tests/SKILL.md@@ -0,0 +1,181 @@+---+name: unit-tests+description: Writes and changes shirudo's unit tests, the suites of testing/unit/ that call the util/ module of the same name in-process, and the few suites that link an object outside util/ through UNIT_OBJS. Covers the unit.h harness (UNIT_CASE, UNIT_SUITE, the EXPECT and ASSERT macros, unit_skip), the child each case runs in, building and running one suite or one case, fixtures under TMPDIR and in a memfd, link-time --wrap fakes, cases that need root, both compilers and what each sanitizer does and does not see. Use when adding or changing a function in util/, when a unit suite fails, or when touching testing/unit/.+paths:+ - "testing/unit/**"+ - "util/**/*.c"+---++# Unit tests++The unit tier calls the C of `util/` in-process on the build host and+runs in seconds. It reaches no BPF LSM, keyring, TPM or VM. A script, a+command's behavior, enforcement on a target and a delivery path belong+in other tiers: "Choose a tier" in the `testing` skill decides.++`Documentation/contribute/testing/testing.rst` ("Write a unit test",+"Run under the sanitizers", "Run under MemorySanitizer") is the+reference. This skill adds the procedure and the traps.++## A suite++`util/<m>.c` is tested by `testing/unit/<m>.c`. Copy the shape of+`testing/unit/hex.c`, a short suite: the module's header by its+bare name (`"hex.h"`, since `util/` is on the include path), then+`"unit.h"`, one static function per case, the table and+`UNIT_SUITE(<m>, cases);`. A suite's file starts with+`// SPDX-License-Identifier: BSD-2-Clause` and+`/* Copyright (c) 2026 Authors of shirudo */`.++- Name a case for what holds, `decode_wants_the_exact_length`: the+ function name is the TAP title and the substring a run selects.+- List every case in the table, which ends with `{}`. A case left out+ is an unused static function, and `-Werror` fails the build.+- `EXPECT_*` records a failure and goes on, `ASSERT_*` ends the case.+ Use `ASSERT_*` where a later line would dereference what failed.+- `EXPECT_EQ`, `_NE`, `_LT` and `_GT` compare as `__s64`; a `size_t` or+ `__u64` above `INT64_MAX` takes `EXPECT_UEQ` or `ASSERT_UEQ`. There is+ no `ASSERT_LT`: write `ASSERT_TRUE(a < b)`.+- `EXPECT_STREQ` fails on a NULL; `EXPECT_MEMEQ` prints the first byte+ that differs.+- `unit_skip("<reason>")` ends a case as `ok <n> - <case> # SKIP+ <reason>`. Skip only for what the host lacks, never for a result.+- A non-static function in a suite, such as a `__wrap_` fake, needs a+ prototype first or `-Wmissing-prototypes` fails the build: declare it+ above the definition, as `testing/unit/upatch_pins.c` does, or in+ `testing/unit/<m>_test.h`, as `curl_test.h` does.++The build needs no rule: `Makefile.shirudo` builds every+`testing/unit/*.c` into `build/unit/<m>` against+`build/unit/libshirudo.a`, the archive of the util objects, and+`testing/Makefile` lists it among the suites. A suite for code outside+`util/` names its object, as `quote_check` and `jar` do:++```make+build/unit/<m>: UNIT_OBJS := tools/<tool>/<file>.o+build/unit/<m>: tools/<tool>/<file>.o+```++## What a case runs in++`testing/unit/unit.c` forks each case from the suite's `main()`, with a+60-second `alarm()`:++- A crash, a sanitizer abort, an `ASSERT_*` or a hang fails that case+ alone (`# timed out`, `# Segmentation fault`).+- Nothing a case changes reaches the next: globals, `setenv()`, the+ working directory, a namespace. Each case starts from the state the+ suite had before the first, so set up inside the case, with a helper+ such as `use_log()` in `testing/unit/eventlog.c`.+- What a failing case wrote to standard error comes back as `#` lines.+ Standard output is the TAP stream itself: write diagnostics to+ `stderr`, never `printf()` in a case.++CI runs the suites as root, in the Build workflow's VM and under `sudo`+in the CI suite; on a workstation they run as you. Write each case to+pass both ways:++- A case that needs root skips without it: `need_root()` in+ `testing/unit/io.c` calls `unit_skip()` when `geteuid()` is not 0.+- A result that differs for root takes both, as `io.c` does with+ `geteuid() ? -EPERM : 0` for a sticky directory.+- A case whose result depends on the host checks the host and skips:+ `testing/unit/upatch_pins.c` skips when the host has shirudo pins.++## Fakes++The tree has no mocking library. These are its ways:++- Files. Make a directory with `mkdtemp()` under `$TMPDIR`, falling+ back to `/tmp`, write fixtures with `open()` and `write_complete()`,+ and remove them at the end of the case (`use_fixtures()` and+ `drop_fixtures()` in `testing/unit/sysinfo.c`). An anonymous file is+ a `memfd_create()`. `testing/unit/archive_test.h` writes a `.bee`+ archive into a descriptor with `archive_write()`.+- A path the code opens itself. Prefer a function that takes the path+ or a directory descriptor and test that. Where the code opens a fixed+ path, or a failure must happen that the kernel does not give on+ demand, wrap the libc call at link time: add+ `build/unit/<m>: LDFLAGS += -Wl,--wrap=<symbol>` to `Makefile.shirudo`,+ define `__wrap_<symbol>()` in the suite and call `__real_<symbol>()`+ from it. `upatch_pins.c` redirects `opendir()` to the case's+ directory and makes `readdir64()` fail with `EIO`; `curl.c` catches+ `curl_slist_free_all()` to read the memory before it is freed. An+ environment variable the code reads is another way in, one the+ target honors and `Documentation/reference/environment.rst` lists:+ use one that exists, as `eventlog.c` sets `SHIRUDO_EVENTLOG_PATH`,+ rather than adding one for a test.+- Mounts. A root case calls `unshare(CLONE_NEWNS)` and makes `/`+ private (`MS_REC | MS_PRIVATE`) before it mounts anything, as+ `open_beneath_same_mount_refuses_a_bind()` in `io.c` does. The+ namespace dies with the case's child.+- Races. Fork a child that does the other side until it is killed, and+ bound the parent's loop (the rename race in `io.c`).+- Time. There is no clock fake: the functions take the time as an+ argument, as `iso8601()` in `util/timefmt.h` does.+- Network. No suite runs a server. HTTP and OTLP parsing is reached by+ the fuzz targets (`oci-http`, `otel`) and by functional tests against+ `testing/helper/test-oci-registry.py` and `otel-mock.py`.++What a unit case cannot show, a C helper in `testing/helper/` and a+shell test can, without a VM: `t4001-tpm-wire.sh` runs+`helper/test-tpm-wire`, and the TPM tests run the libtpms simulator+through `helper/tpmsim-cmd`. The `functional-tests` skill covers those.++## Sanitizers++- ASan and UBSan run without recovery, so a report fails its case.+ CI runs them on every pull request with gcc, with gcc and clang on+ main.+- LeakSanitizer never checks a case: the child ends in `_exit()`, which+ skips the leak check. Free what a case allocates anyway; a leak shows+ only where a fuzz target reaches the code, as libFuzzer checks for+ leaks.+- MemorySanitizer needs instrumented libraries+ (`.github/scripts/msan-deps.sh`) and leaves out `upatch_decode`,+ whose values come from LuaJIT's assembly interpreter.+- ThreadSanitizer (`SANITIZE=thread CC=clang`) runs on main only.+- The build does not track flags: objects of another `CC` or+ `SANITIZE` stay behind. Run a sanitizer build in a `git worktree`+ from `make clean`, as the `pre-submit` skill says.++## Workflow++1. Write or change the cases in `testing/unit/<m>.c`.+2. Build and run that suite alone, after one `make` of the tree:++ ```sh+ make -f Makefile.shirudo build/unit/<m> && build/unit/<m>+ build/unit/<m> <substring> # only the cases whose name holds it+ ```++3. Run it as the tier runs it, which builds every suite first:++ ```sh+ make -C testing unit/<m>+ ```++4. Build and run it with both compilers:++ ```sh+ make -B -C testing unit/<m> CC=gcc+ make -B -C testing unit/<m> CC=clang-23+ ```++5. In a worktree, from `make clean`, under the sanitizers CI uses:++ ```sh+ make -C testing SANITIZE=address,undefined unit/<m>+ sh .github/scripts/msan-deps.sh && sh .github/scripts/msan-tests.sh 60+ ```++6. Read the TAP: every `not ok`, the `#` lines under it,+ `runtime error:`, `ERROR: AddressSanitizer`, and the reason of each+ `# SKIP`, which can hide a case that never ran. Fix the code or the+ case and go back to step 2.+7. Update `Documentation/contribute/testing/test-coverage.rst`: a+ suite added joins the list under "Unit suites and fuzz targets" and+ its count of modules, and the "Coverage by area" row of its area+ names it. A change to code a CBMC harness reads runs that proof too (the+ `proofs` skill); a parser of input from outside the host also gets a+ fuzz target (the `fuzz-target` skill).diff --git a/AGENTS.md b/AGENTS.mdindex f0f085a0..5e266f26 100644--- a/AGENTS.md+++ b/AGENTS.md@@ -20,7 +20,8 @@ tests, scripts and CI alike. Work another skill covers loads that skillas well:- `shell` for shell scripts-- `testing` for tests+- `testing` to run tests and the test VM, and `unit-tests`,+ `functional-tests` and `end2end-tests` to write them- `proofs` for proofs- `docs` for documentation- `upatch` for a upatch@@ -74,7 +75,7 @@ change, and a check of whether a reported issue is real, follow the| `Documentation/upatches/` | Authoring and shipping upatches: attach kinds, maps and serializers, decoders, the Beefile, publishing, debugging a failed load. || `Documentation/reference/` | Every command (`reference/cli/`), the formats (`reference/formats/`, including the `.upatch` container), the settings (`configuration.rst`), the eventlog, failure categories and exit status, files, units, environment variables, the cheat sheet. || `Documentation/contribute/` | Developer guide, test tiers and the test VM (read `testing.rst` before adding or moving a test), test coverage, the kernel coding style, commits and sign-off (read `contributing.rst` before crafting a commit), and the documentation style guide `writing-docs.rst`. |-| `.agents/skills/` | Skills for coding agents in the `SKILL.md` format of agentskills.io, which Codex reads there and Claude Code through the `.claude/skills` link, each a `SKILL.md` with the reference files it links beside it: `coding` writes C in the tree's style and grows `util/`, `commits` writes commit messages and shapes a series, `shell` writes POSIX shell for dash, `testing` runs the test tiers and the test VM, `pre-submit` the checks CI runs on a series, `upatch` writes for the target's preemption model and a low cost, builds, packages and publishes an upatch, `bpf-concurrency` checks upatch code whose runs share state, `bpf-coccinelle` runs and extends the Coccinelle rules for it, `docs` finds and checks the pages a change touches, `fuzz-target` adds a libFuzzer target for a parser, `proofs` runs and writes the CBMC and Lean 4 proofs, `kernel` moves the bpf-next pin and carries, rebases and drops kernel patches, `security-audit` audits the tree against the threat model, and the threat model and the proofs against the tree. |+| `.agents/skills/` | Skills for coding agents in the `SKILL.md` format of agentskills.io, which Codex reads there and Claude Code through the `.claude/skills` link, each a `SKILL.md` with the reference files it links beside it: `coding` writes C in the tree's style and grows `util/`, `commits` writes commit messages and shapes a series, `shell` writes POSIX shell for dash, `testing` runs the test tiers and the test VM, `unit-tests`, `functional-tests` and `end2end-tests` write a test in each tier, `pre-submit` the checks CI runs on a series, `upatch` writes for the target's preemption model and a low cost, builds, packages and publishes an upatch, `bpf-concurrency` checks upatch code whose runs share state, `bpf-coccinelle` runs and extends the Coccinelle rules for it, `docs` finds and checks the pages a change touches, `fuzz-target` adds a libFuzzer target for a parser, `proofs` runs and writes the CBMC and Lean 4 proofs, `kernel` moves the bpf-next pin and carries, rebases and drops kernel patches, `security-audit` audits the tree against the threat model, and the threat model and the proofs against the tree. |The kernel side of the signing design is the kernel's own`Documentation/bpf/signing.rst`; `bpf_prog_verify_signature()` runs