eBPF-based security platform
docs: fold the notes beside the code into a developer guide
Daniel Borkmann0b7eb1eb67a7
diff --git a/AGENTS.md b/AGENTS.mdindex bf667904..b861894c 100644--- a/AGENTS.md+++ b/AGENTS.md@@ -60,7 +60,7 @@ remote-management or transport layers.| `Documentation/requirements.rst` | Kernel options, operator toolchain, target runtime. || `Documentation/getting-started.rst` | Quickstart: build, sign, initialise a target, load and unload, publish and install packages. || `Documentation/telemetry.rst` | OTLP export of map snapshots and status keepalives, the signed Lua decoders, and collector integration (OpenTelemetry Collector, ClickHouse, Splunk, custom). |-| `Documentation/testing.rst` | The test tiers (unit, functional, end-to-end), the test numbers, running the tests and the test VM. Read it before adding or moving a test. |+| `Documentation/developer-guide.rst` | Working from a checkout, the operator-only tools, the test tiers (unit, functional, end-to-end), the test numbers, running the tests, the test VM and the open coverage gaps. Read it before adding or moving a test. || `Documentation/coding-style.rst` | The kernel's coding style, applied to all C here. || `Documentation/contributing.rst` | Commit message form, the mandatory `Signed-off-by:` and the kernel's attribution tags. Read it before crafting a commit. |@@ -349,7 +349,7 @@ one usually still compiles and passes tests.- `util/<m>.c` is unit tested by `testing/unit/<m>.c`: a change to a utilfunction adds or updates its cases there. A shell test is named`t<F><K><NN>`, family, operator (0) or target (1), and order, and lives in- its family's directory; `Documentation/testing.rst` has the families.+ its family's directory; `Documentation/developer-guide.rst` has the families.- `make -C testing fuzz [FUZZ_SECONDS=60]` runs the libFuzzer targets in`testing/fuzz/` for the parsers of input from outside the host, underASan and UBSan, on their seed corpora; CI runs them too. A parser thatdiff --git a/Documentation/testing.rst b/Documentation/developer-guide.rstsimilarity index 61%rename from Documentation/testing.rstrename to Documentation/developer-guide.rstindex 0295a6eb..94ee34b9 100644--- a/Documentation/testing.rst+++ b/Documentation/developer-guide.rst@@ -2,20 +2,56 @@SPDX-License-Identifier: BSD-2-ClauseCopyright (c) 2026 Authors of shirudo-Testing shirudo+Developer guide===============+This guide is for working on shirudo itself: building and running it from a+checkout, where the operator-only tools live, and writing and running the+tests. See `requirements <requirements.rst>`__ for what the build and test+hosts need, `contributing <contributing.rst>`__ for what to run before+sending a change and `coding-style <coding-style.rst>`__ for the style.++1) Working from a checkout+--------------------------++``make`` builds the operator binary ``shirudo``, ``make shirudo-build`` the+operator-only helper and ``make target`` the fully static target binary.+The core binary never compiles or signs: ``shirudo build``, ``keys vouch``+and the operator ``bpm`` commands hand their arguments to+``tools/shirudo-build/shirudo-build`` with ``execv``, found through+``SHIRUDO_BUILD``, then ``$(libexecdir)/shirudo/shirudo-build``, then+``PATH``, and ``shirudo bpm --help`` lists the operator subcommands only+when the helper resolves. From a checkout, put ``tools/shirudo-build`` and+the checkout root first on ``PATH`` or set ``SHIRUDO_BUILD``.++The helper hosts everything that compiles or signs: the ``.bpf.c`` to+``gen_loader`` to signed ``.upatch`` path, unload directives, ``keys+vouch``, ``bpm build``, ``bpm config update``, ``bpm push`` and ``bpm tree+append``, and ``upatch rewrite-rodata``, which re-signs an upatch whose BTF+watch arrays alone changed and which kernel-obs's ``rewrite_watch_upatch.py``+calls. ``bpm build`` compiles with the package directory as its working+directory, so a package built from a checkout finds ``vmlinux.h`` and the+BPF headers through ``vendor`` and ``bpf`` links to the checkout's, as+``testing/end2end/host.sh`` and the publishing test make them.++``tools/gen-image/`` holds the image scripts the helper and ``shirudo image+build`` run: ``shirudo-gen-image`` makes an ext4 image of a source tree,+``shirudo-gen-runtime`` collects the trusted binary, its libraries and the+public assets for the runtime image, ``shirudo-gen-verity`` formats the+hash tree and has the helper sign the root, and ``common.sh`` holds their+shared checks. The ``runtime-service*.conf.in`` templates beside them+belong to ``shirudo-gen-runtime``. `config-images <config-images.rst>`__+describes the images they make.++2) The test layout+------------------+shirudo is tested in tiers, each under its own directory of ``testing/``:unit tests for the functions of ``util/``, functional tests for one commandor mechanism at a time, end-to-end tests for whole delivery paths, tests ofthe scripts CI runs, and libFuzzer targets for the parsers of input fromoutside the host. A change comes with a test in the lowest tier that can-show it works. See `requirements <requirements.rst>`__ for what the test-hosts need and `contributing <contributing.rst>`__ for what to run before-sending a change.--1) The layout--------------+show it works.::@@ -34,10 +70,7 @@ sending a change.run-tests.sh the unit and operator testsrun-target-tests.sh one family's target tests, in its VM-Each ``functional/`` family may carry a ``test.plan.md`` that maps the cases-it must cover to the tests that do, and says which are not covered yet.--2) Test numbers+3) Test numbers---------------A shell test is named ``t<F><K><NN>-<what>.sh``, the way git numbers its@@ -66,14 +99,14 @@ F Directory What it coverskeyrings, bpffs and the TPM path7 ``functional/bpm/`` packages, repositories, the upatch tree8 ``functional/otel/`` map export, status, TLS policy-9 ``end2end/`` the kernel-obs package, delivery paths+9 ``end2end/`` the kernel-obs package, delivery paths=== ============================ ==========================================A new test takes the next free number of its family and kind; a number isnot reused for a different test. A file under ``testing/`` that is not atest does not take a name of this form.-3) Running the tests+4) Running the tests--------------------``make tests`` or ``make -C testing``@@ -109,7 +142,7 @@ rest under ASan and UBSan, as CI does.In CI, the tests workflow runs ``make tests`` and the sanitizer workflow``make tests VM=0`` under ASan and UBSan with gcc and clang.-4) Unit tests+5) Unit tests-------------``testing/unit/<m>.c`` tests the functions of ``util/<m>.c``. It calls them@@ -143,7 +176,7 @@ A change to a function of ``util/`` adds or updates its cases. What needsthe command line, root, the TPM simulator, the kernel or an implementationwritten apart from shirudo to compare against is a functional test.-5) Functional and end-to-end tests+6) Functional and end-to-end tests----------------------------------A shell test starts in ``testing/``, sources ``test-lib.sh``, and runs its@@ -167,13 +200,13 @@ it with ``bpm push`` and appends it to a signed upatch tree with ``bpmtree append``, all with the key the bundle's fixtures are signed with.The target activates the signed ``config-end2end`` image that points atthe tree and the collector, and the units it ships pull, verify and load-the package and export what it observes. The host then checks the TPM-evidence the target produced with ``attest verify``, which must find the-published payload loaded, and the collector's output, which must hold the-package's records. The registry and the collector need Docker on the+the package and export what it observes. The host then verifies the TPM+evidence the target produced with ``attest verify``, whose replayed records+must name the published payload and tree operation, and checks that the+collector holds the package's records. The registry and the collector need Docker on thehost; the guest reaches them through QEMU's address for the host.-6) The test VM+7) The test VM--------------``testing/vm/`` builds and runs the target side. ``build-kernel.sh``@@ -185,3 +218,43 @@ the dm-verity runtime image and the signed config images, whichguest with a software TPM and the bundle and, in test mode, has``guest.sh`` run one family's tests in it. ``testing/swtpm.sh`` runs asoftware TPM on the host for development without a VM.++8) Open work+------------++Cases no test covers yet, for whoever adds the next tamperproof test:++* creating a BPF map from an executable other than shirudo's, beside the+ loader's own creation as the positive control;+* obtaining or passing shirudo's map descriptors through+ ``/proc/<pid>/fd``, ``pidfd_getfd`` or ``SCM_RIGHTS``, and using one to+ change a protected map;+* repeated and concurrent serializer runs losing or changing records;+* an inode created under a labelled directory being born labelled;+* ``PTRACE_ATTACH`` to, or a perf event bound to, a running shirudo task;+* starting shirudo with ``LD_PRELOAD``, ``LD_AUDIT`` or+ ``LD_LIBRARY_PATH`` naming foreign code, and exec'ing it from a traced+ task;+* a trusted loader mutated with its userspace digest recomputed, which the+ kernel's signature check must refuse.++The export path has room for more exact assertions: endpoint, CA,+client-certificate and header precedence across the command line, the+signal-specific and generic environment, the config and the defaults;+every resource, scope and metric attribute of the OTLP payload; export+failure and drain across timer intervals; S3 with ``AWS_CA_BUNDLE``; and+the bounds of transport timeouts, response buffers and compression.+``upatch get`` is checked for the loaded source, not its JSON form.++The kernel-obs DNS parser correlates a UDP response with its request by the+network namespace, addresses, ports and transaction ID. It does not yet+compare the response's question name and class with the request's, check+its opcode, RCODE and TC bits, keep A and AAAA answers to the family asked+for, or age out pending requests; it does not reject fragments, check the+IP and UDP lengths against the packet or walk IPv6 extension headers; it+lets an embedded NUL through in a label and does not bound every+compression pointer it skips; and it counts neither a full pending table,+LRU displacement, stale responses nor answers past its cap of 75. A live+packet harness would let the target tests cover malformed packets, which+``end2end/dns_obs_matrix.py`` today only constructs. DNS over TCP, TLS or+HTTPS and ports other than 53 are outside its scope.diff --git a/Documentation/index.rst b/Documentation/index.rstindex 1783b615..79f54abf 100644--- a/Documentation/index.rst+++ b/Documentation/index.rst@@ -100,9 +100,10 @@ Reading or writing a ``.upatch```upatch-spec <upatch-spec.rst>`__ is the byte-level reference forthe signed artifact.-Testing- `testing <testing.rst>`__ describes the test tiers, how tests are- numbered and grouped, how to run them, and the test VM.+Developing shirudo+ `developer-guide <developer-guide.rst>`__ covers working from a+ checkout, the operator-only tools, writing and running the tests in+ their tiers, the test VM, and the coverage and parser gaps still open.Contributing`contributing <contributing.rst>`__ covers commit messages, thediff --git a/testing/functional/otel/test.plan.md b/testing/functional/otel/test.plan.mddeleted file mode 100644index e2e56b79..00000000--- a/testing/functional/otel/test.plan.md+++ /dev/null@@ -1,41 +0,0 @@-# OTEL test plan--## Scope--This plan records coverage for OpenTelemetry export across host-side serialization and transport, target map export, status keepalives, systemd/package wiring, and the shared TLS policy. Tests live primarily in `testing/functional/otel/`; related coverage includes `testing/functional/otel/t8005-tls-policy.sh`, `testing/functional/upatch/t3002-upatch-decoders.sh`, and `testing/fuzz/fuzz-otel.c`.--## Coverage--| Area | Checks |-| --- | --- |-| CLI and configuration | Invalid OTEL option combinations; map-export defaults, valid values, invalid values, bounds, unknown keys, tenant ID syntax, and duplicate handling. |-| Map classification and local rendering | Structural classification of unsigned per-CPU integer maps as metrics and other map categories as logs; aligned per-CPU strides in local JSON and OTLP log output. |-| OTLP payloads | Nested log body and map/upatch attributes; absent location; gauge and cumulative monotonic counter payloads; metric start time; selected logs/metrics paths and endpoint suffixing. |-| OTLP transport | JSON requests, decoded authorization, gzip, retry success, retryable status matrix (429/502/503/504), fatal statuses, retry exhaustion, partial rejection, zero-rejection partial success, malformed response, disconnect, timeout, delta/date `Retry-After` and cap, loopback cleartext policy, HTTPS verification and insecure override. |-| OTEL environment | Signal-specific endpoint, protocol, compression, and headers override generic values; explicit custom endpoints and base URL signal suffix behavior. |-| Payload limits | Decoded record and OTLP request accepted at and above a measured boundary, rejected one byte below, with no HTTP request for rejected payloads. Mock records decoded payload size after gzip. |-| Tenant handling | Header decoding and validation, configured tenant and CLI override on target mixed log/metric `--all`, and no tenant leakage into S3 PUT while applying it to the OTLP reference. |-| S3 export | Credential and bucket/region validation; path traversal and query rejection; escaped prefix; `AWS_DEFAULT_REGION` fallback; gzip snapshot, digest/checksum, SigV4, session token and metadata; compact reference; large serialized snapshot; retryable PUT status matrix (408/409/429/500/502/503/504), duplicate object, exhausted retries, reference retry without duplicate upload, and upload/reference failure ordering. |-| Status keepalive | Deterministic severity/body mapping for all documented statuses; status/version fields; no stdout output; JSON output retained with `--json --otel`; no implicit endpoint when none is configured. |-| Target map export | Detailed JSON records, JSON-lines append and I/O failure, mixed log/metric automatic export, CLI endpoint over config, and tenant propagation. |-| Target service and timer | Installed map-export service delivers decoder-backed maps; slow collector fixture checks the timer does not overlap an active export. |-| Serialized metrics | Two serializer pages, repeated peek, drain, subsequent empty interval, reload reset, and service export of decoder-backed cumulative metrics. |-| Services and packaging | Static service/timer ordering, conditions, environment file, command, cadence, install paths, operator exclusion, and Debian/RPM scriptlets. |-| TLS policy | `testing/functional/otel/t8005-tls-policy.sh` covers shared TLS policy; OTEL operator tests independently check certificate verification and insecure mode where TLS prerequisites are available. |--## Remaining gaps--The suggested execution order has been implemented. Useful follow-up coverage remains:--1. Full endpoint precedence across CLI, signal-specific environment, generic environment, config, and defaults, plus separate metrics-signal precedence.-2. OTEL endpoint precedence for signal-specific CA, client certificate/key, timeout, and header edge cases such as malformed escapes, reserved names, and duplicate tenant sources.-3. Exact payload-schema assertions for every documented resource, scope, map attribute, metric name/kind combination, and multiple datapoints; broader empty/large/signed map fixtures.-4. Target export failure/drain behavior across timer intervals, timer-delivered keepalive integration, optional system fields, and service failure status reporting.-5. S3 `AWS_CA_BUNDLE` TLS verification, partial collector reference responses, and exact reference/snapshot size metadata assertions.-6. Explicit upper bound and malformed configuration tests for transport timeouts, response-buffer boundary cases, and compression-size semantics beyond the current decoded payload assertions.--These are coverage opportunities, not findings that the implementation is incorrect. Do not count prerequisite-skipped TLS or target tests as exercising their assertions.--## Test commands--Operator coverage is the `t80NN` tests; `make -C testing functional/otel` runs them and the target ones. Target integration scripts `t8101`, `t8102`, and `t8103` require an initialized test VM and fixtures in `SHIRUDO_TEST_FIXTURES_DIR`. The shared TLS test is `testing/functional/otel/t8005-tls-policy.sh`. Run with the repository's documented `make -C testing test-op` and target harness when runtime validation is requested.diff --git a/testing/functional/tamperproof/test.plan.md b/testing/functional/tamperproof/test.plan.mddeleted file mode 100644index c7fd612c..00000000--- a/testing/functional/tamperproof/test.plan.md+++ /dev/null@@ -1,65 +0,0 @@-# Tamperproof test plan--This matrix records coverage reviewed on 2026-10-17. Update the status and-test reference when a case is implemented or re-reviewed. “Covered” means an-assertion exists in the named test; it does not mean the test was run during-this review.--## Priority finding--**Resolved bypass: root could invoke a pinned serializer with-`BPF_PROG_TEST_RUN`.** Kernel-obs serializers are pinned signed syscall-programs. A non-PEEK serializer context can flip arena buffers and clear-drained state, allowing a root caller to drain observations without a-writable map FD. The LSM now restricts userspace `BPF_PROG_TEST_RUN` to-Shirudo's recorded executable; verified kernel-context loader calls remain-allowed. `t6109-map-lockdown.sh` asserts the denial and then-checks that Shirudo can still export the pre-existing Python exec record.--## Coverage matrix--| ID | Attack or policy case | Status | Existing test | Planned assertion or notes |-|---|---|---|---|---|-| TP-01 | Unsigned userspace `BPF_PROG_LOAD` | Covered | `t6103-lsm-deny.sh`; baseline also in `t6105-mount-lockdown.sh` | Keep EACCES denial assertion. |-| TP-02 | Foreign-signed upatch, signer absent from trusted keyring | Covered | `t6102-siggate.sh` | Keep rejection assertion. |-| TP-03 | Valid signature presented through caller-selected, non-Shirudo keyring | Covered | `t6104-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 | 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 | `t6112-key-permission.sh`, `t6129-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 | `t6112-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 | `t6111-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 | `t6105-mount-lockdown.sh` | Keep mountpoint and enforcement-survival checks. |-| TP-09 | Obtain writable serializer-array or arena FD by pinned path | Covered | `t6109-map-lockdown.sh` | Current test covers `shirudo_ser` and `obs_i_arena`. |-| TP-10 | Obtain writable map FD by map ID | Covered | `t6109-map-lockdown.sh` | Current test covers both maps. |-| TP-11 | Read-only map FD access as a positive control | Covered | `t6109-map-lockdown.sh` | Preserve both path and map-ID read-only checks. |-| TP-12 | Update serializer map or freeze serializer/arena map directly | Covered | `t6109-map-lockdown.sh` | Current test attempts update on serializer array and freeze on both. |-| TP-13 | Writable mmap of arena | Covered | `t6109-map-lockdown.sh` | Preserve denial check. |-| TP-14 | Invoke pinned serializer with destructive `BPF_PROG_TEST_RUN` context | Covered | `t6109-map-lockdown.sh` | Root receives `EACCES`; Shirudo export still succeeds and contains the Python exec record created before the attempt. |-| TP-15 | Delete map element; update/delete batch; lookup-and-delete variants | Covered | `t6107-bpf-cmd-deny.sh` | Raw-syscall denial of each command with an empty attr. |-| TP-16 | Create a BPF map from a non-Shirudo executable | Not covered | None in tamperproof | Add direct negative test for `BPF_MAP_CREATE`; cover authorized Shirudo loader creation as positive control. |-| TP-17 | Create links, open raw tracepoints or pin objects from root | Covered | `t6107-bpf-cmd-deny.sh` | `BPF_LINK_CREATE`, `BPF_RAW_TRACEPOINT_OPEN` and `BPF_OBJ_PIN` are shirudo-only; root gets `EACCES`. |-| TP-18 | Detach/update links or attach/detach programs from root | Covered | `t6107-bpf-cmd-deny.sh` | Raw-syscall denial of `BPF_LINK_DETACH`, `BPF_LINK_UPDATE`, `BPF_PROG_ATTACH` and `BPF_PROG_DETACH`, plus two never-classified commands. |-| TP-19 | Root assigns Shirudo's executable identity using `PR_SET_MM` | Covered | `t6110-pr-set-mm-identity.sh` and `t6110-pr-set-mm-identity.py` | Requires `CAP_SYS_RESOURCE`; verify both `PR_SET_MM_EXE_FILE` and `PR_SET_MM_MAP` are denied to non-Shirudo callers. |-| TP-20 | Obtain or transfer Shirudo's open map FDs via `/proc/<pid>/fd`, `pidfd_getfd`, or `SCM_RIGHTS` | Not covered | None | Test each applicable acquisition/transfer route and verify a received FD cannot be used to mutate protected maps. |-| TP-21 | Concurrent or repeated serializer invocation changes/loses records | Not covered | None | Add after TP-14 policy fix; exercise repeated and concurrent export attempts and verify record integrity. |-| 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 | `t6111-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 | `t6111-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 | `t6111-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 | 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 | `t6106-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 | `t6108-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 | 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--- The default-deny branch in `bpf/bpf2.c` appears to reject several- untested map mutation and link teardown commands. Treat that as policy- implementation evidence, not test coverage.-- `t6109-map-lockdown.sh` proves direct writable-FD, update, freeze, and- mmap paths for the selected maps. It does not prove all indirect ways of- invoking signed code that mutates those maps.-- Run the target suite after implementing the open cases; this review was a- source and test inspection, not a test execution.diff --git a/testing/functional/upatch/test.plan.md b/testing/functional/upatch/test.plan.mddeleted file mode 100644index b2eb4890..00000000--- a/testing/functional/upatch/test.plan.md+++ /dev/null@@ -1,45 +0,0 @@-# Upatch infrastructure test plan--This matrix records coverage reviewed on 2026-10-19. Update the status and-test reference when a case is implemented or re-reviewed. “Covered” means an-assertion exists in the named test; it does not mean the test was run during-this review.--## Coverage matrix--| ID | Mechanism case | Status | Existing test | Planned assertion or notes |-|---|---|---|---|---|-| UI-01 | Operator signing accepts ML-DSA-87 and rejects RSA | Covered | `functional/signing/t2002-mldsa-sign.sh` | Keep the algorithm rejection, CMS structure, size, signed-content verification and tamper rejection checks. |-| UI-02 | Malformed `.upatch` files fail cleanly | Covered | `functional/upatch/t3001-upatch-parse.sh` | Empty, truncated, random, bogus-magic, missing-file and directory inputs must fail without a signal. |-| UI-03 | Reader validates file size, structured header and section bounds | Covered | `functional/upatch/t3001-upatch-parse.sh` | Oversized file, unsupported version, both reserved words, zero required lengths, header overlap, and out-of-file or overflowing ranges fail cleanly; a structured control parses. |-| UI-04 | Valid signed decoder metadata is reported and executed | Covered | `functional/upatch/t3002-upatch-decoders.sh` | Keep metadata fields, JSON output, OTLP value conversion, instruction and memory limits, and invalid UTF-8 checks. |-| UI-05 | Malformed decoder trailer and source ranges are handled as absent | Covered | `functional/upatch/t3002-upatch-decoders.sh` | Malformed trailer, offset, entry count, source range, and unterminated fixed string leave offline inspection successful with no decoders reported. |-| UI-06 | Supported attachment forms produce the expected build metadata | Covered | `functional/upatch/t3006-cgroup-skb-metadata.sh`, `functional/upatch/t3007-uprobe-multi-metadata.sh`, `functional/upatch/t3008-override-metadata.sh`, `functional/upatch/t3009-netfilter-metadata.sh` | Preserve checks for cgroup ingress/egress, uprobe.multi targets, kprobe override, fmod_ret, and netfilter metadata. |-| UI-07 | Unsupported attachment sections fail with actionable build errors | Covered | `functional/upatch/t3010-unsupported-network-sections.sh` | Preserve rejection checks for sk_skb, socket filters and generic cgroup skb sections. |-| UI-08 | Serializer metadata binds a serializer to its target map | Covered | `functional/upatch/t3004-upatch-serializer-metadata.sh` | Keep the signed arena-tree artifact metadata check. |-| UI-09 | Builder rejects invalid serializer declarations | Covered | `functional/upatch/t3004-upatch-serializer-metadata.sh` | Missing output map, missing or reserved target map, and duplicate serializer targets fail with the builder diagnostic. |-| UI-10 | Map type names and generic-read/serializer policy are stable | Covered | `functional/upatch/t3003-upatch-map-types.sh` | Keep arena naming, arena serializer requirement, array generic-read, and skipped-type naming assertions. |-| UI-11 | Serializer ABI, invocation nonce, locking and paged JSON shape | Covered | `functional/upatch/t3005-upatch-serializer-pages.sh` | The helper checks the serializer ABI and nonce validation, map-lock behavior, and a synthetic two-page JSON view. Keep the CLI path and NDJSON assertions. |-| UI-12 | Loaded arena serializer returns a complete multi-page snapshot | Covered | `functional/upatch/t3102-upatch-arena-serializer.sh` | Load the signed arena-tree fixture; verify all three pages, cursor progression, all records, completion, and a serializer error result. |-| UI-13 | Target load archives and pins an upatch; matching unload removes it | Covered | `functional/upatch/t3105-load-unload.sh`, `functional/upatch/t3101-target-fixtures.sh` | Keep positive lifecycle checks for attachment, pin, archive and unload. |-| UI-14 | Target refuses unload on payload mismatch and load on version mismatch | Covered | `functional/upatch/t3104-payload-mismatch.sh`, `functional/upatch/t3103-version-gate.sh` | Keep the refusal categories and checks that a mismatched unload leaves the pin intact. |-| UI-15 | Target rejects an artifact signed by an untrusted key | Covered | `functional/upatch/t3101-target-fixtures.sh` | Keep the foreign-signed fixture rejection and valid non-Shirudo keyring denial. |-| UI-16 | `upatch get` reads loaded source information from the kernel | Covered | `functional/upatch/t3106-upatch-get.sh` | The current assertion checks that the loaded marker source appears in output. Detailed JSON and line-location assertions are not present. |-| UI-17 | uprobe.multi verifies target identity and attaches all matched offsets | Covered | `functional/upatch/t3107-uprobe-multi.sh` | Keep build-ID mismatch refusal, target/function status, and execution of both matched functions. |-| UI-18 | `upatch map` emits detailed map JSON and appends NDJSON records | Covered | `functional/upatch/t3005-upatch-serializer-pages.sh`, `functional/otel/t8101-map-export-all.sh`, `functional/upatch/t3101-target-fixtures.sh` | Keep output-path validation, schema and per-map JSON checks. This row covers the upatch map interface, not exporter transport. |-| UI-19 | Target executes a serializer and decodes its output | Covered | `functional/otel/t8103-otel-serialized-metric.sh` | Keep the serialized-counter fixture assertions for decoded values and cumulative metric fields; generic exporter behavior is outside this matrix. |--## Review notes--- This plan covers the upatch artifact and loader mechanism, its build-time- metadata, and the direct map, serializer and decoder support paths.-- It does not track behavior of particular upatch payloads or package/tree- delivery and generic telemetry transport.-- The structured parser and decoder-metadata gaps correspond to validation- rules in `Documentation/upatch-spec.rst`; policy text alone is not test- coverage.-- `functional/upatch/t3102-upatch-arena-serializer.sh` loads the arena-tree fixture and checks- the real target serializer over its full three-page result and error path.-- `make -C testing unit functional` passed on- 2026-10-19, including the parser, decoder, metadata, tamper and target- arena-serializer assertions listed above.diff --git a/tools/gen-image/README.md b/tools/gen-image/README.mddeleted file mode 100644index a5e3bea6..00000000--- a/tools/gen-image/README.md+++ /dev/null@@ -1,104 +0,0 @@-# Building Shirudo images--The operator scripts use Bash and standard Linux tools:--* `shirudo-gen-image` builds an ext4 filesystem from a source directory.-* `shirudo-gen-runtime` collects the trusted binary, libraries and public assets,- then calls `shirudo-gen-image`.-* `shirudo-gen-verity` copies a prepared filesystem image, runs `veritysetup- format`, asks `shirudo-build` to sign the root, and verifies the result before- publishing the four output files. `shirudo image build` uses this script too.-* `common.sh` holds shared argument and output checks.--Install `mkfs.ext4` from `e2fsprogs` and `veritysetup` from `cryptsetup-bin`-(Debian/Ubuntu) or `cryptsetup` (Fedora/RHEL). The scripts use GNU coreutils.-`make install-operator` installs the scripts beside the operator helper under-`libexec/shirudo/gen-image/`.--Signing stays in the operator-only C helper and reuses Shirudo's ML-DSA-87 CMS-implementation. Offline `shirudo image verify` checks the signed root and exact-file sizes, then runs `veritysetup verify` on the retained data and hash files.-Target operations keep the C metadata reader and use kernel APIs. They need-none of these external tools.--The source directory becomes the image root. A config source contains-`etc/shirudo/` and additional `keys/trusted/` and `keys/revoked/` directories;-bootstrap settings and the initial BPF certificate belong in the executable-image. Keep private operator keys outside both images. Config symlinks and-special files are refused.--```sh-tools/gen-image/shirudo-gen-image --source config-root --output config \- --keys-dir operator-keys --builder tools/shirudo-build/shirudo-build-```--Use `--kind runtime` for the executable image. The deployment must arrange-for the dynamic loader and libraries to come from that image too. The host-root filesystem is not replaced.--The four outputs are `config.img`, `config.verity`, `config.roothash` and-`config.p7s`. Download the complete set before requesting activation. The-printed SHA-256 root is also suitable for authenticating a runtime image-from the UKI. Existing outputs are never overwritten.--The standard verity superblock occupies the first 4096-byte block; the-hash tree starts at block one. Format 1, SHA-256, 4096-byte blocks and a-32-byte salt are fixed. The `.roothash` file contains exactly 64 lowercase-ASCII hex bytes with no newline. The detached ML-DSA-87 CMS signature covers-those root bytes. `--kind` is a packaging hint only. The runtime must match-the exact UKI root, regardless of a config signature; config images never-grant executable authority.--The trusted initrd enrolls the config certificate into the kernel's-`.dm-verity` keyring and seals it before host startup. Boot requires-`dm_verity.keyring_unsealed=1`. Kernel built-in dm-verity trust remains-accepted. After interrupted config activation, Shirudo refuses further-updates and attestation while the node keeps running. The operator chooses-when to reboot; Shirudo never reboots automatically and has no same-boot-recovery command.--`shirudo-gen-runtime` packages the fully static target from `make target`.-The generated service runs `/run/shirudo/runtime/usr/bin/shirudo` directly,-without an ELF interpreter or shared libraries. For dynamic executables-supplied by the operator, the generator also packages their interpreter and-libraries. Use trusted native inputs: dynamic library inspection runs their-loader on the operator. Executable mappings outside the image are denied.--```sh-tools/gen-image/shirudo-gen-runtime --binary ./shirudo-target \- --bootstrap-conf bootstrap.conf --cert initial-bpf-cert.der \- --config-cert config-signing-cert.der --output runtime \- --keys-dir operator-keys --builder tools/shirudo-build/shirudo-build-```--The packaged config-verification certificate is-`/run/shirudo/runtime/etc/shirudo/config-cert.der`; use that absolute path-for `config.verification_key` in the bootstrap configuration. The initial-BPF certificate is `keys/cert.der` inside the image. Runtime images have no-shell or debugger unless the operator explicitly supplies one.--The generated service content is kept in `runtime-service-static.conf.in`-and `runtime-service.conf.in` beside the scripts. Keep both templates and-`common.sh` with the scripts when copying this directory.--Pass `--unit-output runtime-service.conf` to generate a systemd drop-in for-the root phase. Install it as-`/etc/systemd/system/shirudo.service.d/verity.conf`. It clears the writable-`init.env` file and starts the Shirudo binary from the runtime-image. Generate the initrd with `shirudo-gen-initrd --bootstrap-conf <file>`;-this bootstrap file carries `runtime.image` and `runtime.root_hash`, while-the file inside the runtime image carries config verification settings.-The initrd's first invocation still uses its authenticated bootstrap binary.-The state filesystem at `/sysroot/var/lib/shirudo` must be mounted writable-in the initrd for durable pending config selection. Shirudo is bootstrapped by the-trusted initrd before untrusted workloads start. It does not migrate a-running unprotected system: pre-existing writable mappings and held file-descriptors would fall outside that bootstrap guarantee. State entries must-be regular files or directories; symlinks, special files and failed labels-stop initialization. After attaching guards, initialization re-applies the-state labels to populate the inode protection cache.--`--extra-binary <trusted-ELF>` adds a deliberately trusted executable and its-library dependencies, for example a test probe. Every executable-in this image has equal authority; omit this option in deployment unless-that additional authority is intended.diff --git a/tools/shirudo-build/README.md b/tools/shirudo-build/README.mddeleted file mode 100644index 4647cea1..00000000--- a/tools/shirudo-build/README.md+++ /dev/null@@ -1,203 +0,0 @@-# shirudo-build--`shirudo-build` is the **operator-only** artifact-producing dispatcher-for shirudo. It compiles BPF source, runs libbpf's `gen_loader`, CMS--signs the resulting loader bytes with the operator's private key, and-serialises the result as a `.upatch` container ready for-direct target-side loading.--## Why a separate binary--Target-side `shirudo` never forks or execs. The operator-only-`shirudo build`, `shirudo keys vouch` and operator BPM commands-dispatch to this separate helper with `execv`; when compiling `.bpf.c`-input, the helper forks and execs `clang -target bpf`. The helper ships-only in the operator package, so no target-side code path can reach the-compiler or the operator signing code. It hosts the operator-only BPM-commands: `shirudo bpm build` (package definition to signed `.bee` archive), `shirudo bpm-push` (package and certificate referrer, with an optional signed index), and-`shirudo bpm tree append` (signed upatch tree). The CMS signer and these-command implementations are linked only into `shirudo-build`.--The core `shirudo` binary's `builtin-build.c` dispatches to the helper-using this resolution order: the `SHIRUDO_BUILD` environment override,-the compiled-in `$(libexecdir)/shirudo/shirudo-build` path, then-`shirudo-build` found on `$PATH`. The last case supports using a-checkout's locally built binaries without installing them. `shirudo-bpm build|push|tree append` hand their full argument vector to-`shirudo-build bpm ...` the same way.--The core binary includes those BPM subcommands in `shirudo bpm --help`-only when it can resolve this helper. If help shows only target-subcommands, set `SHIRUDO_BUILD` or add the helper directory to `PATH` as-shown below; otherwise `shirudo bpm build` is reported as unknown.--The rationale is in `Documentation/architecture.rst` (operator and-target boundary) and `AGENTS.md` (the no-subprocess invariant).--## Modes--| Input | Action |-|---|---|-| `<source.bpf.c>` | compile (fork/exec clang) → gen_loader → sign → package |-| `<file.bpf.o>` | gen_loader → sign → package (skip compile) |-| `--unload <name>` | emit signed UNLOAD directive `.upatch` |-| `upatch rewrite-rodata <original> <modified> -o <output> --data-range <offset:length>...` | verify an existing signed upatch, permit changes only to its BTF watch arrays, then re-sign it |-| `keys vouch <cert.der>` | sign a vouch for another certificate |-| `bpm build [context] --version <v> [-f <name>.bee] [--vmlinux <file>]` | compile, sign and package every Beefile upatch into a `.bee` |-| `bpm config update --base-package <package.bee|oci://host/repo:tag> --version <v> [-f <name>.bee]` | update existing signed upatches from packaged or local rodata configuration |-| `bpm push <pkg.bee> oci://...` | publish the package and certificate referrer; with signing material, also update the signed index |-| `bpm tree append <pkg.bee> oci://...` | publish the next generation of a signed upatch tree |--## Install location--`$(libexecdir)/shirudo/shirudo-build`, typically-`/usr/local/libexec/shirudo/shirudo-build`.--`make install-operator` installs it alongside `shirudo` at this path.-The operator package includes both binaries and depends on `clang` and-`llvm` to compile `.bpf.c` inputs. Building from source also needs a-`vmlinux.h` for the target kernel. BPM builds search from the command's-working directory before the package directory; pass `--vmlinux` to-select a different header explicitly.--For checkout/developer use, build both binaries and put their directories-first on `PATH`:--```sh-PATH="$PWD/tools/shirudo-build:$PWD:$PATH" \- shirudo bpm build --version 1.0.0 --keys-dir "$HOME/.config/bpm"-```--## From BPF source to an OCI upatch tree--For a single standalone upatch, build the source directly:--```sh-shirudo build ./shield.bpf.c --keys-dir /var/lib/shirudo/keys-shirudo upatch info ./shield.bpf.upatch-```--To publish an upatch through a tree, put the source in a package context with-a `Beefile`. `bpm build` compiles and signs the source into a `.upatch`,-generates its matching unload directive, and bundles both into a `.bee`.-`tree append` then publishes the artifacts and adds a signed operation to the-OCI tree. It builds the upatch from the Beefile source itself; the standalone-`shirudo build` command is not a prerequisite.--Example layout:--```text-example-shield/-├── example-shield.bee-└── shield.bpf.c-```--The local package definition uses the package name with a `.bee` suffix.-`bpm build` stores it inside the package archive as `Beefile`.--An upatch may define repeated `[[upatches.rodata]]` entries with a BTF-`symbol`, a default `input` file, and `generator` and `update` command-arrays. Commands run in the Beefile's directory without a shell. Shirudo-appends `--input <path> --symbol <name> --output <path>`; the program writes-the symbol's raw value bytes to that output file. Its length must match the-BTF variable. The input override name is the input file's basename through-its first dot, so `watch.list` is selected with-`--rodata-input watch=<path>`. Multiple entries can share that input name.-The default input resolves relative to the Beefile; an override resolves-relative to the command's working directory.--`bpm config update --base-package <package.bee|oci://host/repo:tag> --version <v>`-reuses the load upatches in the base package, invokes each configured `update`-command, re-signs changed `.rodata`, regenerates unload directives, and-writes a new package. It does not compile BPF. Without `-f`, the Beefile-and files named by its `[[files]]` entries come from the base package, and-the operator is choosing to trust and execute its updater programs; those-files are not covered by the upatch CMS signature. Pass `-f <name>.bee` to-select a local Beefile and its locally resolved updater files instead.-List every updater dependency and default input in `[[files]]` when-packaged updates should be self-contained.--Example `example-shield.bee`:--```toml-[package]-name = "example-shield"-description = "Example BPF shield"-license = "BSD-2-Clause"-authors = ["Example Org"]--[[upatches]]-source = "shield.bpf.c"-load_target = "upatches/shield.upatch"-unload_target = "upatches/shield.unload.upatch"--[upatches.tree]-id = "example-shield"-load_artifact = "upatches/shield.upatch"-unload_artifact = "upatches/shield.unload.upatch"-```--Build and inspect the package, then publish its tree entry:--```sh-shirudo bpm build ./example-shield --version 1.0.0 \- -f ./example-shield/example-shield.bee \- --keys-dir /var/lib/shirudo/keys-shirudo bpm info ./example-shield-1.0.0.bee-shirudo bpm tree append ./example-shield-1.0.0.bee \- oci://registry.example.com/shirudo/example-shield-tree \- --keys-dir /var/lib/shirudo/keys-```--Signing keys are supplied to the operator commands, not embedded in the BPF-source or `Beefile`. The directory passed with `--keys-dir` contains-`signing_key.pem` and `cert.der`; `bpm build` uses them to sign each upatch,-`bpm push` uses them to sign the repository index, and `tree append` uses them-to sign the tree publication.--Without an explicit directory, the commands use `SHIRUDO_KEYS_DIR` or the-compiled default `/var/lib/shirudo/keys`. `tree append` also accepts-`--key <signing_key.pem>` and `--cert <cert.der>` as individual overrides.-Keep the private key on the operator; the package carries the public-certificate.--The first append creates the tree; later appends extend its signed history.-Add selector fields under `[upatches.tree.selector]` to limit which kernel-releases, build IDs, architectures, Kconfig values, or node labels receive-the upatch. To publish the `.bee` as an installable package as well, push it-to the package repository with signing material so the signed repository-index is updated:--```sh-shirudo bpm push ./example-shield-1.0.0.bee \- oci://registry.example.com/shirudo/example-shield \- --keys-dir /var/lib/shirudo/keys-```--Package publication and tree publication are separate operations.--## Uprobe multi attach points--One upatch BPF program can attach to multiple entry points in one user-space-ELF with:--```c-SEC("uprobe.multi//absolute/path/to/program:*Func")-int probe(struct pt_regs *ctx)-{- return 0;-}-```--The portion after the colon is a standard libbpf glob: `*` matches any-sequence and `?` matches one character. Thus `*Func` can match unrelated-functions such as `fooFunc` and `barFunc`. Comma/`|` alternation is not-supported; use a single glob that covers the desired names. Each section-targets one absolute ELF path, entry probes only.--`shirudo-build` resolves matching `STT_FUNC` symbols to sorted, unique ELF-file offsets and records the ELF's GNU build ID in UPGM v2 metadata. The build-fails if the path is not absolute, the glob is empty or longer than 127 bytes,-no function matches, the ELF lacks a GNU build ID, or more than 1,048,576-offsets match. The target verifies the build ID before loading any BPF state.diff --git a/upatches/kernel-cve/REBUILD.md b/upatches/kernel-cve/REBUILD.mddeleted file mode 100644index 66f14051..00000000--- a/upatches/kernel-cve/REBUILD.md+++ /dev/null@@ -1,7 +0,0 @@-# Rebuilding exported kernel-CVE upatches--This bundle contains the generated `kernel-cve.bee` package definition, combined manifest, the shared `vmlinux.h`, BPF C sources, and (for entries that have them) signed payloads, object files, logs, certificates, and per-record JSON metadata.--From a compatible Shirudo checkout, copy this directory beneath `upatches/` and run the normal Jbrust shield builder for `kernel-cve` with the destination project's signer. Replace the package signer with the destination project's signer when rebuilding the signed entry.--The Beefile entries use recoverable `.bpf.c` sources. All sources include `vmlinux.h`; the single copy at `kernel-cve/vmlinux.h` is found because the shield builder runs with `kernel-cve/` as its working directory. Do not add per-entry copies under `sources/*/observability/`.diff --git a/upatches/kernel-cve/manifest.json b/upatches/kernel-cve/manifest.jsonindex 2309ccf3..7fe91bfa 100644--- a/upatches/kernel-cve/manifest.json+++ b/upatches/kernel-cve/manifest.json@@ -8,8 +8,7 @@"collateral": {"beefile": "kernel-cve/kernel-cve.bee","manifest": "kernel-cve/manifest.json",- "per_entry_source_dirs": "kernel-cve/sources/",- "rebuild_notes": "kernel-cve/REBUILD.md"+ "per_entry_source_dirs": "kernel-cve/sources/"},"count": 3,"generated_at": "2026-09-18T20:24:50Z",diff --git a/upatches/kernel-obs/README.md b/upatches/kernel-obs/README.mdindex 567bb60a..e29569a2 100644--- a/upatches/kernel-obs/README.md+++ b/upatches/kernel-obs/README.md@@ -154,5 +154,5 @@ from the exporter.DNS over TCP, TLS and HTTPS is not parsed; the resolvers are on thewatch list instead. IPv6 extension headers are not walked. Forwarded-traffic does not pass the cgroup hooks and is not counted. The-`dns.todo` file lists the remaining DNS parser gaps.+traffic does not pass the cgroup hooks and is not counted. shirudo's+developer guide lists the remaining DNS parser gaps.diff --git a/upatches/kernel-obs/dns.todo b/upatches/kernel-obs/dns.tododeleted file mode 100644index a470ae68..00000000--- a/upatches/kernel-obs/dns.todo+++ /dev/null@@ -1,74 +0,0 @@-# DNS observability follow-up--The UDP DNS parser correlates requests with a canonical key made from-the network-namespace cookie, address family, client/resolver addresses-and ports, and transaction ID, and attributes the answer to the querying-socket's owner. The items below are the remaining parser and-correlation gaps. `testing/end2end/dns_obs_matrix.py` now validates-case construction and batch encoding only. Its former target runner used-`BPF_PROG_TEST_RUN`, which is restricted to Shirudo. The target suite uses-live loopback UDP exchanges for representative query and response-coverage. Exact malformed-packet and mutation-fuzz coverage needs a live-packet harness before it can gate target changes.--## Matching and response integrity--- [ ] Decode and compare the response question name with the stored request.- DNS comparison must be ASCII case-insensitive and must safely handle- compression, pointer loops, and invalid pointer targets.-- [ ] Require query class IN and compare response qclass with the request.-- [ ] Validate response opcode, RCODE, and TC before accepting answers. Define- whether truncated responses produce no event or an explicitly partial- event.-- [ ] Constrain emitted addresses to the requested family: A queries may emit- A records and AAAA queries may emit AAAA records, while still skipping- CNAME and other intermediate records.-- [ ] Add request age to the pending value and reject stale responses. This- prevents a delayed response from matching a later reuse of the exact- same flow and transaction ID.-- [ ] Decide whether exact-flow, same-ID concurrent requests need multi-value- storage. Standards-compliant clients should avoid this reuse, but the- current map still replaces the older request.--## Packet validation--- [ ] Reject IPv4 and IPv6 fragments unless complete reassembly is guaranteed- before the cgroup hook.-- [ ] Enforce IPv4 total length, IPv6 payload length, and UDP length against- `data_end`; reject inconsistent or truncated packets.-- [ ] Enforce the intended 1232-byte UDP parsing budget on the actual packet,- not only on individual logical offsets.-- [ ] Walk supported IPv6 extension headers or reject packets containing any- extension header with a dedicated debug counter.-- [ ] Validate the IP version against the Ethernet protocol.-- [ ] Decide whether checksum validation belongs in this program. The case- builder includes invalid-checksum inputs, but target tests do not currently- inject those malformed packets over a live network path.--## Name and answer parsing--- [ ] Reject embedded NUL bytes in labels so stored names cannot be truncated- by C-string serialization.-- [ ] Validate every compression pointer target even when the owner name is- only skipped, including bounds, loops, and maximum traversal depth.-- [ ] Make the 75-answer cap observable with a counter or explicit truncation- status instead of silently ignoring later answers.-- [ ] Define atomic response behavior. At present, valid early answers remain- recorded when a later answer is malformed.--## Capacity and observability--- [x] Table overflow and lost records are reported in every export header.-- [ ] Add counters for request-map update failure, LRU displacement, stale- response rejection and tuple mismatch.-- [ ] Stress the 1024-entry pending-request LRU and document expected loss- behavior under sustained concurrent DNS traffic.-- [ ] Add namespace-isolation coverage proving identical tuples and IDs in two- network namespaces remain independent.--## Out of scope unless requirements change--- DNS over TCP, TLS, or HTTPS; the public DoH resolvers are on the- destination watch list instead.-- DNS traffic on ports other than 53, including mDNS and LLMNR.-- Full recursive DNS interpretation beyond correlating A/AAAA responses.