eBPF-based security platform
Documentation: group the upatches and Contribute pages into submenus
Daniel Borkmann158c1cb29e06
diff --git a/.github/scripts/build-commits.sh b/.github/scripts/build-commits.shindex 682e1119..3f421d3e 100755--- a/.github/scripts/build-commits.sh+++ b/.github/scripts/build-commits.sh@@ -4,7 +4,7 @@## .github/scripts/build-commits.sh -- build every commit in a range on its# own, oldest first, so that the history bisects as-# Documentation/contribute/contributing.rst asks: the binary, the+# Documentation/contribute/code/contributing.rst asks: the binary, the# shirudo-build helper and the test helpers. The first commit that does# not build is named and the ones after it are not tried.#diff --git a/.github/scripts/check-dco.sh b/.github/scripts/check-dco.shindex f5d822f0..194621a3 100755--- a/.github/scripts/check-dco.sh+++ b/.github/scripts/check-dco.sh@@ -3,7 +3,7 @@# Copyright (c) 2026 Authors of shirudo## .github/scripts/check-dco.sh -- verify that every commit in a range has-# the message Documentation/contribute/contributing.rst asks for: a+# the message Documentation/contribute/code/contributing.rst asks for: a# one-line subject, a body that says more than its tags, and the# Signed-off-by of its author, the Developer's Certificate of Origin, from# an identity a person answers at: a noreply address or a bot is nodiff --git a/.github/scripts/check-docs.sh b/.github/scripts/check-docs.shindex 9a656268..914da89d 100755--- a/.github/scripts/check-docs.sh+++ b/.github/scripts/check-docs.sh@@ -29,7 +29,7 @@ report() {}find Documentation -name '*.rst' -not -path 'Documentation/output*' \- -not -path 'Documentation/contribute/coding-style.rst' | sort >"$work/pages"+ -not -path 'Documentation/contribute/code/coding-style.rst' | sort >"$work/pages"# The options of the command lines in console blocks, by page.while IFS= read -r page; dodiff --git a/.github/scripts/check-spdx.sh b/.github/scripts/check-spdx.shindex 8ac4c374..8c928ce0 100755--- a/.github/scripts/check-spdx.sh+++ b/.github/scripts/check-spdx.sh@@ -39,7 +39,7 @@ report() {# generated from BTF.excluded() {case "$1" in- Documentation/contribute/coding-style.rst|vmlinux.h|*/vmlinux.h)+ Documentation/contribute/code/coding-style.rst|vmlinux.h|*/vmlinux.h)return 0 ;;esacreturn 1diff --git a/.github/scripts/check-style.sh b/.github/scripts/check-style.shindex cff8ab6c..9aa673c9 100755--- a/.github/scripts/check-style.sh+++ b/.github/scripts/check-style.sh@@ -312,7 +312,7 @@ check_spellings() {# checkpatch enforces the kernel's block-comment form everywhere but at# the opener, which only the netdev trees have an opinion on, and theirs-# is the opposite of Documentation/contribute/coding-style.rst: a comment+# is the opposite of Documentation/contribute/code/coding-style.rst: a comment# that runs on past its first line opens with /* alone on that line.# Report an added line that opens a comment with text and does not close# it, in the form checkpatch reports in. String literals are blankeddiff --git a/.github/workflows/build-commits.yml b/.github/workflows/build-commits.ymlindex 3016f1f4..f15db934 100644--- a/.github/workflows/build-commits.yml+++ b/.github/workflows/build-commits.yml@@ -23,7 +23,7 @@ jobs:with:fetch-depth: 0- # Documentation/contribute/contributing.rst asks for every commit to+ # Documentation/contribute/code/contributing.rst asks for every commit to# build on its own, so that the history bisects; the other workflows# build the head of the pull request alone. The BPF objects need the BTF# of a signed-BPF capable bpf-next kernel, so the builds run in thediff --git a/AGENTS.md b/AGENTS.mdindex 7e2194f2..d2f1961f 100644--- a/AGENTS.md+++ b/AGENTS.md@@ -75,7 +75,7 @@ the code is a bug, whichever of the two is wrong.the author's to check.New documentation extends an existing page or adds one to its section's-toctree, and follows `Documentation/contribute/writing-docs.rst`. Only+toctree, and follows `Documentation/contribute/documentation/writing-docs.rst`. Onlywhat concerns the project as a whole goes in the top-level directory(`README.md`, `CONTRIBUTING.md`, `SECURITY.md` and their kind). NoREADME, plan or notes file goes beside the code; the exceptions are@@ -129,7 +129,7 @@ package for `bpm info`.earlier local must stay after it (correctness wins over the sort).Apply this whenever you add or touch a declaration block.- **Linux kernel coding style**- (`Documentation/contribute/coding-style.rst` — the kernel's own+ (`Documentation/contribute/code/coding-style.rst` — the kernel's owncoding-style.rst, copied into this tree). Tabs (8-wide), 80-col softlimit and 100-col hard limit (checkpatch), K&R braces, no spacesinside parens.@@ -155,7 +155,7 @@ package for `bpm info`.This applies to every block comment — function-head doc comments,TODO blocks, struct-internal explanations, multi-line trailingcomments inside a function body. The rule mirrors the kernel- example in `Documentation/contribute/coding-style.rst` §8.+ example in `Documentation/contribute/code/coding-style.rst` §8.- **`//` is for SPDX only.** Per the kernel convention, .c filesuse `// SPDX-License-Identifier: …` and nothing else `//`-style;.h files use `/* SPDX-License-Identifier: … */` and nothing else@@ -177,7 +177,7 @@ package for `bpm info`.## Commits-`Documentation/contribute/contributing.rst` is the kernel's process+`Documentation/contribute/code/contributing.rst` is the kernel's processapplied here and is the reference for every commit an agent prepares: asubject of the form `area: imperative summary`, a body that explains whybefore what, and the `Co-developed-by`, `Fixes`, `Reported-by`,@@ -366,7 +366,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/contribute/testing.rst` has the+ its family's directory; `Documentation/contribute/testing/testing.rst` has thefamilies.- `make -C testing fuzz [FUZZ_SECONDS=60]` runs the libFuzzer targets in`testing/fuzz/` for the parsers of input from outside the host, underdiff --git a/CONTRIBUTING.md b/CONTRIBUTING.mdindex 73763936..e50397dc 100644--- a/CONTRIBUTING.md+++ b/CONTRIBUTING.md@@ -1,3 +1,3 @@# Contributing-Thanks for your interest in contributing to shirudo. Please see the [contribution guide](Documentation/contribute/contributing.rst) for instructions.+Thanks for your interest in contributing to shirudo. Please see the [contribution guide](Documentation/contribute/code/contributing.rst) for instructions.diff --git a/Documentation/concepts/background/bpf.rst b/Documentation/concepts/background/bpf.rstindex 04fc48fb..a16107e3 100644--- a/Documentation/concepts/background/bpf.rst+++ b/Documentation/concepts/background/bpf.rst@@ -139,7 +139,7 @@ signature, runs it with ``BPF_PROG_TEST_RUN``, attaches the payloadprograms the loader created and pins their links under``/run/shirudo/bpffs/upatches/<name>/``, with the upatch's maps under``maps/`` beside them. See-:doc:`/internals/signed-loader` and :doc:`/upatches/attach-kinds`.+:doc:`/internals/signed-loader` and :doc:`/upatches/write/attach-kinds`.Because the pins are all that hold these links, shirudo's LSM programsrefuse to remove or rename an entry in the private bpffs for any task@@ -154,5 +154,5 @@ The verifier bounds what a program can do to the kernel, not what itdecides. An upatch that passes the verifier can still break a workload bydenying the wrong operation. shirudo signs and measures upatches so thatan operator knows which programs run; it does not judge whether they are-correct. See :doc:`/upatches/testing` for testing an upatch before it+correct. See :doc:`/upatches/test/testing` for testing an upatch before itships.diff --git a/Documentation/concepts/background/co-re-btf.rst b/Documentation/concepts/background/co-re-btf.rstindex 43a423e4..04e20aae 100644--- a/Documentation/concepts/background/co-re-btf.rst+++ b/Documentation/concepts/background/co-re-btf.rst@@ -141,7 +141,7 @@ An upatch that touches a field the target kernel lacks fails when theloader loads the payload. ``shirudo upatch load`` reports category``verifier_rejected`` in phase ``payload_load`` and includes the loader'slog, where the verifier's message for the payload appears. See-:doc:`/upatches/debugging` for reading that log and+:doc:`/upatches/test/debugging` for reading that log and:doc:`/reference/failure-categories` for the categories.A program that hard-codes an offset carries no relocation, so nothing@@ -156,4 +156,4 @@ CO-RE matches types and fields by name and layout, not by meaning. Afield that keeps its name but changes what it holds relocates withoutcomplaint, and a renamed field fails to relocate even if its meaning isunchanged. An upatch built for one kernel release still needs testing on-every kernel it ships to; see :doc:`/upatches/testing`.+every kernel it ships to; see :doc:`/upatches/test/testing`.diff --git a/Documentation/concepts/background/luajit.rst b/Documentation/concepts/background/luajit.rstindex bc2be094..c2ad6f70 100644--- a/Documentation/concepts/background/luajit.rst+++ b/Documentation/concepts/background/luajit.rst@@ -128,7 +128,7 @@ A metric decoder returns a list of OpenTelemetry metric objects. shirudoserializes the result itself, refuses nesting deeper than 32 levels andoutput larger than its size limits, and drops the snapshot with adiagnostic on any error rather than export a partial record.-:doc:`/upatches/decoders` describes the input table, the helpers and the+:doc:`/upatches/write/decoders` describes the input table, the helpers and thereturn contract in full.How shirudo uses it@@ -175,8 +175,8 @@ lists the residual risks in :doc:`/security/threat-model`.Related--------- :doc:`/upatches/decoders` for writing a decoder-- :doc:`/upatches/maps-arenas-serializers` for the records a decoder+- :doc:`/upatches/write/decoders` for writing a decoder+- :doc:`/upatches/write/maps-arenas-serializers` for the records a decoderreads- :doc:`opentelemetry` for the records a decoder produces- :doc:`/security/threat-model` for the residual risksdiff --git a/Documentation/concepts/background/oci.rst b/Documentation/concepts/background/oci.rstindex 1840c760..d9843b45 100644--- a/Documentation/concepts/background/oci.rst+++ b/Documentation/concepts/background/oci.rst@@ -235,7 +235,7 @@ Related-------- :doc:`/operate/run/deliver-packages`-- :doc:`/upatches/publishing`+- :doc:`/upatches/publish/publishing`- :doc:`/reference/formats/bpm-formats`- :doc:`/reference/cli/bpm`- :doc:`/reference/environment`diff --git a/Documentation/concepts/background/opentelemetry.rst b/Documentation/concepts/background/opentelemetry.rstindex 226861b4..59464e86 100644--- a/Documentation/concepts/background/opentelemetry.rst+++ b/Documentation/concepts/background/opentelemetry.rst@@ -203,4 +203,4 @@ Related- :doc:`/reference/formats/otlp` for the exported documents- :doc:`/reference/systemd-units` for the timers and services- :doc:`luajit` for the decoder sandbox-- :doc:`/upatches/decoders` for writing a decoder+- :doc:`/upatches/write/decoders` for writing a decoderdiff --git a/Documentation/concepts/comparisons.rst b/Documentation/concepts/comparisons.rstindex 2e69a7f5..83cc17a0 100644--- a/Documentation/concepts/comparisons.rst+++ b/Documentation/concepts/comparisons.rst@@ -38,7 +38,7 @@ shirudo complements live patching. An upatch cannot replace a functionbody. It can refuse a call before the function runs, at an LSM hook, a``security_*`` function, a system call entry or a function marked forerror injection, and it can observe or filter-(:doc:`/upatches/attach-kinds`). In exchange, the BPF verifier checks+(:doc:`/upatches/write/attach-kinds`). In exchange, the BPF verifier checksevery program, CO-RE lets one artifact load on more than one kernelbuild, and each load and unload is measured. A target can run both:shirudo does not gate module loading (:doc:`/operate/plan/interoperability`).diff --git a/Documentation/concepts/glossary.rst b/Documentation/concepts/glossary.rstindex 0c90394d..cd524763 100644--- a/Documentation/concepts/glossary.rst+++ b/Documentation/concepts/glossary.rst@@ -30,7 +30,7 @@ it.consistent snapshot and can reset between exports.``upatches/kernel-obs/obs_table.h`` is the template for adouble-buffered arena table. See- :doc:`/upatches/maps-arenas-serializers`.+ :doc:`/upatches/write/maps-arenas-serializers`.attach metadataThe signed ``UPGM`` section of a load artifact that tells shirudo@@ -56,7 +56,7 @@ it.package directory, that names the package and lists its upatchsources, read-only data generators, extra files and tree selectors.``shirudo bpm build`` reads ``Beefile`` in the package directory, or- the file that ``-f`` names. See :doc:`/upatches/beefile`.+ the file that ``-f`` names. See :doc:`/upatches/publish/beefile`.BPF keyringThe kernel's ``.bpf`` keyring, which the kernel uses for a signed@@ -113,7 +113,7 @@ it.a ``struct shirudo_decoder_manifest`` in ``.rodata``,``shirudo-build`` embeds the source in the signed ``DCDB`` section,and ``shirudo upatch map`` runs it under LuaJIT. See- :doc:`/upatches/decoders`.+ :doc:`/upatches/write/decoders`.endorsement keyA key that identifies a TPM, derived from its endorsement seed with@@ -345,7 +345,7 @@ it.values and node labels. ``shirudo bpm tree sync`` evaluates it onthe target and applies only matching operations, and anon-matching operation is skipped for good. See- :doc:`/upatches/publishing`.+ :doc:`/upatches/publish/publishing`.serializerA ``SEC("syscall")`` program in an upatch, named@@ -353,7 +353,8 @@ it.upatch's ``shirudo_ser`` output map in chunks of 4096 bytes.``shirudo upatch map`` runs it with ``BPF_PROG_TEST_RUN``, whichgives one consistent snapshot of an arena and lets the serializer- reset what it exported. See :doc:`/upatches/maps-arenas-serializers`.+ reset what it exported. See+ :doc:`/upatches/write/maps-arenas-serializers`.``shirudo-build``The operator-only helper that the core ``shirudo`` binary executes@@ -439,7 +440,7 @@ it.A signed BPF object, one or more programs with their maps and attachmetadata, that a target loads, pins, archives and measures as oneunit. It ships as a load artifact and leaves through an unload- directive. See :doc:`/upatches/concepts`.+ directive. See :doc:`/upatches/learn/concepts`.upatch treeA signed, append-only, ordered list of operations, each adding ordiff --git a/Documentation/concepts/upatches-and-packages.rst b/Documentation/concepts/upatches-and-packages.rstindex 88d8e335..59846700 100644--- a/Documentation/concepts/upatches-and-packages.rst+++ b/Documentation/concepts/upatches-and-packages.rst@@ -75,14 +75,14 @@ entry carries a role, an attach kind and, for kprobes, the symbol andoffset. Uprobe entries add the target binary's path, its GNU build ID andthe probe offsets. After attaching, shirudo compares the link the kernelreports with the metadata and refuses with ``attach_scope_mismatch`` when-they differ. :doc:`/upatches/attach-kinds` lists the kinds and the check+they differ. :doc:`/upatches/write/attach-kinds` lists the kinds and the checkfor each.The role says what shirudo does with a program. An attach program isattached and pinned. A serializer, named ``shirudo_serialize__<map>``, ispinned and run by ``shirudo upatch map`` to read one of the upatch's maps.A test-run program is run once at load, after the attachments, and a-negative return fails the load. :doc:`/upatches/maps-arenas-serializers`+negative return fails the load. :doc:`/upatches/write/maps-arenas-serializers`covers serializers.Unload directives@@ -118,7 +118,7 @@ Its definition is a Beefile, a file in a subset of TOML in the packagedirectory. The Beefile names the package and lists its upatch sources,optional generators for read-only data, extra files to ship and, perupatch, the selector it gets when published to an upatch tree.-:doc:`/upatches/beefile` describes every key.+:doc:`/upatches/publish/beefile` describes every key.``shirudo bpm build`` builds and signs every upatch the Beefile lists,together with its unload directive, and writes ``<name>-<version>.bee``.@@ -186,8 +186,8 @@ does not bring it back.The target keeps a projection root, a hash chain over the operations itapplied, and the next boot's init event includes it. The register valuean operator predicts therefore covers the tree as well as the archived-upatches. :doc:`/upatches/publishing` shows how to publish to a tree, and-:doc:`/reference/formats/bpm-formats` gives the document formats.+upatches. :doc:`/upatches/publish/publishing` shows how to publish to a tree,+and :doc:`/reference/formats/bpm-formats` gives the document formats.How the objects relate----------------------@@ -247,6 +247,6 @@ Related-------- :doc:`/start/how-it-works` for the path of one upatch-- :doc:`/upatches/concepts` for authoring upatches+- :doc:`/upatches/learn/concepts` for authoring upatches- :doc:`/concepts/measurement-register` for the events- :doc:`/internals/signed-loader` for the load in detaildiff --git a/Documentation/contribute/coding-style.rst b/Documentation/contribute/code/coding-style.rstsimilarity index 100%rename from Documentation/contribute/coding-style.rstrename to Documentation/contribute/code/coding-style.rstdiff --git a/Documentation/contribute/contributing.rst b/Documentation/contribute/code/contributing.rstsimilarity index 97%rename from Documentation/contribute/contributing.rstrename to Documentation/contribute/code/contributing.rstindex 434fff93..9e6b4760 100644--- a/Documentation/contribute/contributing.rst+++ b/Documentation/contribute/code/contributing.rst@@ -9,8 +9,8 @@ Commits and sign-off====================shirudo follows the Linux kernel's development conventions for commits:-the coding style in :doc:`coding-style`, a kernel-style commit message,-a mandatory ``Signed-off-by:`` line, and the same set of attribution+the coding style in :doc:`/contribute/code/coding-style`, a kernel-style commit+message, a mandatory ``Signed-off-by:`` line, and the same set of attributiontags. This page states the parts of that process that apply here. Thekernel's ``Documentation/process/submitting-patches.rst`` is thereference for anything not covered.@@ -216,7 +216,7 @@ its author has not seen.Before sending---------------:doc:`developer-guide` shows how to run each of these locally.+:doc:`/contribute/code/developer-guide` shows how to run each of these locally.- Build the operator binary, the helper and the target binary(``make``, ``make shirudo-build``, ``make target``) and run ``make@@ -224,10 +224,10 @@ Before sendingruns the families the change touches while you work on it. Run``make tests VM=0 SANITIZE=address,undefined`` from a clean tree whenthe change touches memory handling or binary formats. CI runs the- same sweep. See :doc:`testing`.+ same sweep. See :doc:`/contribute/testing/testing`.- Run ``make -C Documentation html`` when the change touches``Documentation/``. The build turns every Sphinx warning into an- error. See :doc:`writing-docs`.+ error. See :doc:`/contribute/documentation/writing-docs`.- Run ``.github/scripts/check-spdx.sh`` when the change adds a file.Every source carries an SPDX tag in the kernel's form for its type,``BSD-2-Clause`` for userspace and ``GPL-2.0 OR BSD-2-Clause`` fordiff --git a/Documentation/contribute/develop-locally.rst b/Documentation/contribute/code/develop-locally.rstsimilarity index 97%rename from Documentation/contribute/develop-locally.rstrename to Documentation/contribute/code/develop-locally.rstindex 6caf749d..1614933b 100644--- a/Documentation/contribute/develop-locally.rst+++ b/Documentation/contribute/code/develop-locally.rst@@ -33,7 +33,7 @@ last section shows how to rebuild after a change to shirudo itself.Before you begin------------------ A checkout that builds, as :doc:`developer-guide` describes.+- A checkout that builds, as :doc:`/contribute/code/developer-guide` describes.- The test VM's prerequisites and root on the host, as:doc:`/start/quickstart` lists them. Run every host command on thispage as root, in the root of your checkout.@@ -124,7 +124,7 @@ Boot the targetoperator$ make -C testing vm VM_NAME=devThe first run builds the kernel, the disk image and the bundle, which- takes a while. :doc:`testing` describes the test VM.+ takes a while. :doc:`/contribute/testing/testing` describes the test VM.2. Name the bundle's signing key in the operator shell:@@ -260,10 +260,10 @@ way a real upatch's data reaches a collector.The program runs at every successful ``execve(2)`` and adds one to theentry of the new command's name in the hash map ``execs``. Themanifest in ``.rodata`` names the Lua decoder for the map and the- signal it produces, a log record. :doc:`/upatches/decoders` explains+ signal it produces, a log record. :doc:`/upatches/write/decoders` explainseach field. A upatch that keeps records rather than counters keepsthem in an arena with a serializer, see- :doc:`/upatches/maps-arenas-serializers`.+ :doc:`/upatches/write/maps-arenas-serializers`.3. Write ``build/dev/exec-count/decoders/execs.lua``:@@ -537,7 +537,8 @@ target runs takes a new bundle and a new VM.operator$ make -C testing functional/<family> VM=0Then run the target tests your change touches by hand in the VM, and- the whole family for a verdict, as :doc:`testing` describes.+ the whole family for a verdict, as :doc:`/contribute/testing/testing`+ describes.Clean up--------@@ -557,9 +558,9 @@ Clean upNext steps------------ :doc:`/upatches/decoders` for decoders and metrics-- :doc:`/upatches/maps-arenas-serializers` for upatches that keep+- :doc:`/upatches/write/decoders` for decoders and metrics+- :doc:`/upatches/write/maps-arenas-serializers` for upatches that keeprecords- :doc:`/operate/run/deliver-packages` and :doc:`/operate/run/telemetry` for theproduction setup this page reproduces-- :doc:`testing` to write and run tests+- :doc:`/contribute/testing/testing` to write and run testsdiff --git a/Documentation/contribute/develop-locally/exec-count.bpf.c b/Documentation/contribute/code/develop-locally/exec-count.bpf.csimilarity index 100%rename from Documentation/contribute/develop-locally/exec-count.bpf.crename to Documentation/contribute/code/develop-locally/exec-count.bpf.cdiff --git a/Documentation/contribute/develop-locally/execs-1.0.lua b/Documentation/contribute/code/develop-locally/execs-1.0.luasimilarity index 100%rename from Documentation/contribute/develop-locally/execs-1.0.luarename to Documentation/contribute/code/develop-locally/execs-1.0.luadiff --git a/Documentation/contribute/develop-locally/execs-1.1.lua b/Documentation/contribute/code/develop-locally/execs-1.1.luasimilarity index 100%rename from Documentation/contribute/develop-locally/execs-1.1.luarename to Documentation/contribute/code/develop-locally/execs-1.1.luadiff --git a/Documentation/contribute/developer-guide.rst b/Documentation/contribute/code/developer-guide.rstsimilarity index 94%rename from Documentation/contribute/developer-guide.rstrename to Documentation/contribute/code/developer-guide.rstindex ebf44da8..3d192a0a 100644--- a/Documentation/contribute/developer-guide.rst+++ b/Documentation/contribute/code/developer-guide.rst@@ -11,8 +11,8 @@ Work from a checkoutThis page takes you from a clone of the repository to the operatorbinary, the operator-only helper and the static target binary, showswhere the parts of the tree live and how to run the checks CI runs-before you send a change. :doc:`testing` covers the tests and the test-VM.+before you send a change. :doc:`/contribute/testing/testing` covers the tests+and the test VM.Before you begin----------------@@ -140,8 +140,8 @@ The build takes the first of these sources:``vendor/linux/.vmlinux-btf-source`` records the source used. When youselect another one, the next build regenerates the header.-1. Build the test kernel, which also writes its BTF. :doc:`testing`- describes the kernel build:+1. Build the test kernel, which also writes its BTF.+ :doc:`/contribute/testing/testing` describes the kernel build:.. code-block:: console@@ -195,7 +195,7 @@ variables change it:- Leaves out ``-g``.* - ``SANITIZE=address,undefined``- Instruments the host binaries and the test helpers with ASan and- UBSan. See :doc:`testing`.+ UBSan. See :doc:`/contribute/testing/testing`.Build the shirudo-build helper------------------------------@@ -315,7 +315,8 @@ Other make targets:doc:`/start/install`.* - ``make docs``- Renders the documentation and serves it on- ``http://127.0.0.1:8000``. See :doc:`writing-docs`.+ ``http://127.0.0.1:8000``. See+ :doc:`/contribute/documentation/writing-docs`.* - ``make clean``, ``make distclean``- Remove the build products, and with ``distclean`` also``config.mk``, the target dependencies and the vendored libbpf@@ -385,7 +386,7 @@ Project layout- The tar, deb and rpm packaging.* - ``testing/``- Unit, functional, end-to-end and fuzz tests, the test VM and- their helpers. See :doc:`testing`.+ their helpers. See :doc:`/contribute/testing/testing`.* - ``Documentation/``- This documentation.* - ``.github/``@@ -415,7 +416,7 @@ the commit at ``HEAD`` alone without them.- Checks* - ``check-dco.sh <range>``- A one-line subject, a body beyond the tags and the author's- ``Signed-off-by:``. See :doc:`contributing`.+ ``Signed-off-by:``. See :doc:`/contribute/code/contributing`.* - ``check-style.sh <range>``- The kernel's ``checkpatch.pl`` in strict mode over the C eachcommit touches and over its message, plus the project rules.@@ -456,7 +457,7 @@ Before you send a change:$ .github/scripts/build-commits.sh origin/main..HEAD2. Run the tests the change touches, and ``make tests`` before you- send. See :doc:`testing`.+ send. See :doc:`/contribute/testing/testing`.3. Render the documentation if you changed it:@@ -470,9 +471,9 @@ Before you send a change:Next steps------------ :doc:`develop-locally` to run both roles on one machine and change- shirudo end to end-- :doc:`testing` to run and write tests-- :doc:`contributing` for the commit message and the sign-off-- :doc:`coding-style` for the C code+- :doc:`/contribute/code/develop-locally` to run both roles on one machine and+ change shirudo end to end+- :doc:`/contribute/testing/testing` to run and write tests+- :doc:`/contribute/code/contributing` for the commit message and the sign-off+- :doc:`/contribute/code/coding-style` for the C code- :doc:`/reference/cli/index` for the commandsdiff --git a/Documentation/contribute/code/index.rst b/Documentation/contribute/code/index.rstnew file mode 100644index 00000000..bf360d32--- /dev/null+++ b/Documentation/contribute/code/index.rst@@ -0,0 +1,18 @@+..+ SPDX-License-Identifier: BSD-2-Clause+ Copyright (c) 2026 Authors of shirudo++Code+====++Build shirudo from a checkout, run the operator and a target on one+machine, follow the kernel coding style, and prepare commits with a+sign-off.++.. toctree::+ :titlesonly:++ developer-guide+ develop-locally+ coding-style+ contributingdiff --git a/Documentation/contribute/documentation/index.rst b/Documentation/contribute/documentation/index.rstnew file mode 100644index 00000000..e32f43ef--- /dev/null+++ b/Documentation/contribute/documentation/index.rst@@ -0,0 +1,13 @@+..+ SPDX-License-Identifier: BSD-2-Clause+ Copyright (c) 2026 Authors of shirudo++Documentation+=============++How this documentation is written, built and checked.++.. toctree::+ :titlesonly:++ writing-docsdiff --git a/Documentation/contribute/writing-docs.rst b/Documentation/contribute/documentation/writing-docs.rstsimilarity index 98%rename from Documentation/contribute/writing-docs.rstrename to Documentation/contribute/documentation/writing-docs.rstindex ef6b0739..7a5928bc 100644--- a/Documentation/contribute/writing-docs.rst+++ b/Documentation/contribute/documentation/writing-docs.rst@@ -239,5 +239,5 @@ tests and units a page names exist in the tree.Related--------- :doc:`contributing` for commit messages and the sign-off-- :doc:`coding-style` for the C code+- :doc:`/contribute/code/contributing` for commit messages and the sign-off+- :doc:`/contribute/code/coding-style` for the C codediff --git a/Documentation/contribute/index.rst b/Documentation/contribute/index.rstindex 239ee792..7231da48 100644--- a/Documentation/contribute/index.rst+++ b/Documentation/contribute/index.rst@@ -7,25 +7,28 @@ ContributeThese pages are for developers who change shirudo itself: its code, itstests, its build and this documentation. Start with-:doc:`/contribute/developer-guide` to build from a clone, then-:doc:`/contribute/develop-locally` to run the operator and a target on-one machine and take a package through its life, and-:doc:`/contribute/testing` to run the tests in the test VM that plays a-target. :doc:`/contribute/test-coverage` shows what the tests cover and-what they do not. Before you send a change, read-:doc:`/contribute/contributing` and :doc:`/contribute/coding-style`, and-read :doc:`/security/threat-model` first when the change touches a+:doc:`/contribute/code/developer-guide` to build from a clone, then+:doc:`/contribute/code/develop-locally` to run the operator and a target+on one machine and take a package through its life, and+:doc:`/contribute/testing/testing` to run the tests in the test VM that+plays a target. :doc:`/contribute/testing/test-coverage` shows what the+tests cover and what they do not. Before you send a change, read+:doc:`/contribute/code/contributing` and+:doc:`/contribute/code/coding-style`, and read+:doc:`/security/threat-model` first when the change touches asecurity-relevant path. :doc:`/contribute/support` lists where to askquestions and report problems.+- :doc:`code/index`: work from a checkout, develop locally, the coding+ style, and commits and sign-off+- :doc:`testing/index`: run and write tests, and test coverage+- :doc:`documentation/index`: writing documentation+- :doc:`support`: where to ask questions and report problems+.. toctree::- :titlesonly:+ :hidden:- developer-guide- develop-locally- testing- test-coverage- coding-style- contributing- writing-docs+ code/index+ testing/index+ documentation/indexsupportdiff --git a/Documentation/contribute/testing/index.rst b/Documentation/contribute/testing/index.rstnew file mode 100644index 00000000..01c10cc3--- /dev/null+++ b/Documentation/contribute/testing/index.rst@@ -0,0 +1,15 @@+..+ SPDX-License-Identifier: BSD-2-Clause+ Copyright (c) 2026 Authors of shirudo++Testing+=======++Run the test tiers and the test VM, write a test, and see what the tests+cover and what they do not.++.. toctree::+ :titlesonly:++ testing+ test-coveragediff --git a/Documentation/contribute/test-coverage.rst b/Documentation/contribute/testing/test-coverage.rstsimilarity index 99%rename from Documentation/contribute/test-coverage.rstrename to Documentation/contribute/testing/test-coverage.rstindex 85f1a2e7..d5affd8c 100644--- a/Documentation/contribute/test-coverage.rst+++ b/Documentation/contribute/testing/test-coverage.rst@@ -11,8 +11,8 @@ Test coverageThis page lists what the tests under ``testing/`` cover, by family, byarea and by threat, and what no test covers. A test is named by itsnumber here, and by its file name without ``.sh`` in the family-tables. :doc:`testing` explains the families, the numbering and how to-run them.+tables. :doc:`/contribute/testing/testing` explains the families, the numbering+and how to run them.Families--------@@ -807,6 +807,6 @@ Parsers and unitsRelated--------- :doc:`testing` to run the tests and write one+- :doc:`/contribute/testing/testing` to run the tests and write one- :doc:`/security/threat-model` for the threats and residual risks- :doc:`/security/tamper-counters` for what each counter meansdiff --git a/Documentation/contribute/testing.rst b/Documentation/contribute/testing/testing.rstsimilarity index 97%rename from Documentation/contribute/testing.rstrename to Documentation/contribute/testing/testing.rstindex a6234d71..a8bac5dc 100644--- a/Documentation/contribute/testing.rst+++ b/Documentation/contribute/testing/testing.rst@@ -10,14 +10,14 @@ Run and write testsThis page shows how to run shirudo's tests, from one unit suite to thefull run CI makes, how to use the test VM that plays the target, and-where a test you add goes. :doc:`test-coverage` lists what the tests-cover.+where a test you add goes. :doc:`/contribute/testing/test-coverage` lists what+the tests cover.Before you begin------------------ A tree that builds, see :doc:`developer-guide`. ``make -C testing``- builds the binaries, the helper and the test helpers it needs+- A tree that builds, see :doc:`/contribute/code/developer-guide`. ``make -C+ testing`` builds the binaries, the helper and the test helpers it needsitself.- For the unit and operator tests: ``python3``, ``clang``, OpenSSL 3.5or newer and the ``openssl`` command. ``veritysetup`` from@@ -640,7 +640,7 @@ Add a fixture or a helperNext steps------------ :doc:`test-coverage` for what each family covers and what no test- covers-- :doc:`/upatches/testing` to test a upatch on a target-- :doc:`contributing` before you send the change+- :doc:`/contribute/testing/test-coverage` for what each family covers and what+ no test covers+- :doc:`/upatches/test/testing` to test a upatch on a target+- :doc:`/contribute/code/contributing` before you send the changediff --git a/Documentation/internals/design-decisions.rst b/Documentation/internals/design-decisions.rstindex 9f1cc2f4..b258877a 100644--- a/Documentation/internals/design-decisions.rst+++ b/Documentation/internals/design-decisions.rst@@ -184,7 +184,7 @@ An arena gives one consistent snapshot, memory the serializer can resetbetween exports, and an overflow count the exported record carries. Anelement-by-element read of a plain map gives a torn view, and a fulltable drops records without saying so. ``upatches/kernel-obs/obs_table.h``-is the template. :doc:`/upatches/maps-arenas-serializers` explains it.+is the template. :doc:`/upatches/write/maps-arenas-serializers` explains it.No target shell-outs--------------------diff --git a/Documentation/internals/kernel-interfaces.rst b/Documentation/internals/kernel-interfaces.rstindex 7590e9cb..373ef292 100644--- a/Documentation/internals/kernel-interfaces.rst+++ b/Documentation/internals/kernel-interfaces.rst@@ -456,7 +456,7 @@ Kconfig``CONFIG_DM_VERITY_VERIFY_ROOTHASH_SIG_PLATFORM_KEYRING`` widen the keysthat verify a config; see :doc:`config-images`. ``CONFIG_SECCOMP=n``is handled: the seal then sees no seccomp state. The attach kinds of-upatches can need further options; see :doc:`/upatches/attach-kinds`.+upatches can need further options; see :doc:`/upatches/write/attach-kinds`.``testing/vm/build-kernel.sh`` enforces its own list with``require_config``, which also covers what the test fixtures and the testdiff --git a/Documentation/internals/kernel-patches.rst b/Documentation/internals/kernel-patches.rstindex ccdd3e13..4592856d 100644--- a/Documentation/internals/kernel-patches.rst+++ b/Documentation/internals/kernel-patches.rst@@ -136,4 +136,4 @@ Related-------- :doc:`kernel-interfaces` for the other kernel requirements-- :doc:`/contribute/testing` for building and booting the test kernel+- :doc:`/contribute/testing/testing` for building and booting the test kerneldiff --git a/Documentation/operate/plan/interoperability.rst b/Documentation/operate/plan/interoperability.rstindex 45df6152..00ee7bce 100644--- a/Documentation/operate/plan/interoperability.rst+++ b/Documentation/operate/plan/interoperability.rst@@ -152,7 +152,7 @@ systemd's BPF-based settings:What to do: Do not rely on these settings on a target. Enforce addressand interface policy with nftables, or with a signed upatch of the``cgroup_skb`` or ``netfilter`` attach kind- (:doc:`/upatches/attach-kinds`). No upatch attach kind covers cgroup+ (:doc:`/upatches/write/attach-kinds`). No upatch attach kind covers cgroupdevice programs... list-table::@@ -386,7 +386,7 @@ Debuggers, tracing and /procroot, or a caller running as the same user, reaches it.:Symptom: See the table below.:What to do: Debug shirudo where it does not enforce, such as the test- VM (:doc:`/contribute/testing`). Expect ``SealPtrace`` in the+ VM (:doc:`/contribute/testing/testing`). Expect ``SealPtrace`` in thebaseline of a host that runs process monitors as root... list-table::diff --git a/Documentation/operate/plan/overhead.rst b/Documentation/operate/plan/overhead.rstindex 1e7a8a2c..ab3bb318 100644--- a/Documentation/operate/plan/overhead.rst+++ b/Documentation/operate/plan/overhead.rst@@ -471,7 +471,7 @@ Programs and maps of an upatch- Serializer programs and Lua decoders run at every export, every 5 s.The Lua limits above bound a decoder.-:doc:`/upatches/maps-arenas-serializers` explains how an upatch keeps+:doc:`/upatches/write/maps-arenas-serializers` explains how an upatch keepsrecords in an arena.kernel-obs examplediff --git a/Documentation/operate/plan/scalability.rst b/Documentation/operate/plan/scalability.rstindex 4105a75e..941bc09c 100644--- a/Documentation/operate/plan/scalability.rst+++ b/Documentation/operate/plan/scalability.rst@@ -245,8 +245,8 @@ One upatchbytes, so only upatches with names of at most 63 characters canhave one (U19 in the :doc:`/security/threat-model`).* - Map export- - :doc:`/upatches/maps-arenas-serializers` and- :doc:`/upatches/decoders` give the serializer and decoder limits.+ - :doc:`/upatches/write/maps-arenas-serializers` and+ :doc:`/upatches/write/decoders` give the serializer and decoder limits.* - Package- 128 upatches, 4096 archive entries and 256 MiB@@ -255,5 +255,5 @@ Related- :doc:`/operate/plan/overhead`- :doc:`/operate/run/deliver-packages`-- :doc:`/upatches/attach-kinds`+- :doc:`/upatches/write/attach-kinds`- :doc:`/security/threat-model`diff --git a/Documentation/operate/plan/system-requirements.rst b/Documentation/operate/plan/system-requirements.rstindex 5043394d..cf850960 100644--- a/Documentation/operate/plan/system-requirements.rst+++ b/Documentation/operate/plan/system-requirements.rst@@ -237,7 +237,7 @@ point is missing fails to load.* - ``CONFIG_NETFILTER``, ``CONFIG_NETFILTER_BPF_LINK``- ``netfilter`` upatches.-:doc:`/upatches/attach-kinds` describes each attach kind.+:doc:`/upatches/write/attach-kinds` describes each attach kind.TPM---diff --git a/Documentation/operate/run/deliver-packages.rst b/Documentation/operate/run/deliver-packages.rstindex bf484f72..e9babbbb 100644--- a/Documentation/operate/run/deliver-packages.rst+++ b/Documentation/operate/run/deliver-packages.rst@@ -407,7 +407,7 @@ Next steps----------- :doc:`/start/guides/publish-package` to publish a package-- :doc:`/upatches/publishing` for packages, indexes and the tree on the+- :doc:`/upatches/publish/publishing` for packages, indexes and the tree on theoperator side- :doc:`/operate/run/telemetry` to export what the installed upatches collect- :doc:`/reference/cli/bpm` for every ``bpm`` optiondiff --git a/Documentation/operate/run/telemetry.rst b/Documentation/operate/run/telemetry.rstindex 2e52e466..00ab7ca4 100644--- a/Documentation/operate/run/telemetry.rst+++ b/Documentation/operate/run/telemetry.rst@@ -346,7 +346,7 @@ One kind of map without a decoder fails: a per-CPU map whose value is anunsigned BTF integer. The target classifies it as a metric, finds nodecoder to build the metric and prints ``upatch map: OTLP export<upatch>/<map>: No data available``. Give such a map a decoder.-:doc:`/upatches/decoders` shows how.+:doc:`/upatches/write/decoders` shows how.What to alert on----------------@@ -414,7 +414,7 @@ Next steps- :doc:`/operate/run/read-status` to read what the keepalive carries- :doc:`/reference/formats/otlp` for the records on the wire-- :doc:`/upatches/decoders` to give a map a decoder+- :doc:`/upatches/write/decoders` to give a map a decoder- :doc:`/reference/cli/upatch-map` and :doc:`/reference/cli/status` forevery option- :doc:`/operate/run/attest` for evidence that the target cannot forgediff --git a/Documentation/reference/cheat-sheet.rst b/Documentation/reference/cheat-sheet.rstindex f5b101d8..34afd234 100644--- a/Documentation/reference/cheat-sheet.rst+++ b/Documentation/reference/cheat-sheet.rst@@ -406,7 +406,7 @@ Developing shirudo------------------Build the operator binary, the helper and the static target binary-(:doc:`/contribute/developer-guide`):+(:doc:`/contribute/code/developer-guide`):.. code-block:: console@@ -420,7 +420,7 @@ Run ``shirudo`` from the checkout with the checkout's helper:$ export SHIRUDO_BUILD=$PWD/tools/shirudo-build/shirudo-build-Run every test (:doc:`/contribute/testing`):+Run every test (:doc:`/contribute/testing/testing`):.. code-block:: console@@ -460,14 +460,14 @@ Run the fuzz targets for a minute each:$ make -C testing fuzz FUZZ_SECONDS=60Render and serve the documentation, and check it against the code-(:doc:`/contribute/writing-docs`):+(:doc:`/contribute/documentation/writing-docs`):.. code-block:: console$ make docs$ make -C Documentation check-Check the commits of a branch as CI does (:doc:`/contribute/contributing`):+Check the commits of a branch as CI does (:doc:`/contribute/code/contributing`):.. code-block:: consolediff --git a/Documentation/reference/cli/bpm.rst b/Documentation/reference/cli/bpm.rstindex 0488d368..afae31d9 100644--- a/Documentation/reference/cli/bpm.rst+++ b/Documentation/reference/cli/bpm.rst@@ -269,7 +269,7 @@ build-----``build`` builds and signs a package from a Beefile-(:doc:`/upatches/beefile`):+(:doc:`/upatches/publish/beefile`):- The Beefile is ``-f``, else ``<context>/Beefile``, with ``<context>``defaulting to the current directory.@@ -404,7 +404,7 @@ Related-------- :doc:`/operate/run/deliver-packages`-- :doc:`/upatches/publishing`-- :doc:`/upatches/beefile`+- :doc:`/upatches/publish/publishing`+- :doc:`/upatches/publish/beefile`- :doc:`/reference/formats/bpm-formats`- :doc:`/reference/systemd-units`diff --git a/Documentation/reference/cli/build.rst b/Documentation/reference/cli/build.rstindex 69524ffa..c823ae6a 100644--- a/Documentation/reference/cli/build.rst+++ b/Documentation/reference/cli/build.rst@@ -237,5 +237,5 @@ Related- :doc:`upatch-info`- :doc:`upatch-load`- :doc:`upatch-unload`-- :doc:`/upatches/kernel-fix-tutorial`+- :doc:`/upatches/learn/kernel-fix-tutorial`- :doc:`/reference/formats/upatch-format`diff --git a/Documentation/reference/cli/upatch-get.rst b/Documentation/reference/cli/upatch-get.rstindex 79c60799..3e1f8ff6 100644--- a/Documentation/reference/cli/upatch-get.rst+++ b/Documentation/reference/cli/upatch-get.rst@@ -109,4 +109,4 @@ Related- :doc:`upatch-list`- :doc:`upatch-map`- :doc:`upatch-info`-- :doc:`/upatches/debugging`+- :doc:`/upatches/test/debugging`diff --git a/Documentation/reference/cli/upatch-load.rst b/Documentation/reference/cli/upatch-load.rstindex 0f62cd15..73179b92 100644--- a/Documentation/reference/cli/upatch-load.rst+++ b/Documentation/reference/cli/upatch-load.rst@@ -242,4 +242,4 @@ Related- :doc:`attest-predict`- :doc:`/reference/failure-categories`- :doc:`/internals/signed-loader`-- :doc:`/upatches/debugging`+- :doc:`/upatches/test/debugging`diff --git a/Documentation/reference/cli/upatch-map.rst b/Documentation/reference/cli/upatch-map.rstindex fcbb6e50..099507ae 100644--- a/Documentation/reference/cli/upatch-map.rst+++ b/Documentation/reference/cli/upatch-map.rst@@ -195,6 +195,6 @@ Related- :doc:`/operate/run/telemetry`- :doc:`/reference/formats/otlp`-- :doc:`/upatches/maps-arenas-serializers`-- :doc:`/upatches/decoders`+- :doc:`/upatches/write/maps-arenas-serializers`+- :doc:`/upatches/write/decoders`- :doc:`upatch-get`diff --git a/Documentation/reference/failure-categories.rst b/Documentation/reference/failure-categories.rstindex e946f271..1c3d58d1 100644--- a/Documentation/reference/failure-categories.rst+++ b/Documentation/reference/failure-categories.rst@@ -166,7 +166,7 @@ Categoriesrelocation against this kernel's BTF. ``verifier_log`` holds thekernel's log.- Read ``verifier_log`` and rebuild against the target kernel. See- :doc:`/upatches/debugging`.+ :doc:`/upatches/test/debugging`.* - ``attach_scope_mismatch``- ``link_create``- ``EXDEV``diff --git a/Documentation/reference/formats/bpm-formats.rst b/Documentation/reference/formats/bpm-formats.rstindex c076115c..0ff2c6a6 100644--- a/Documentation/reference/formats/bpm-formats.rst+++ b/Documentation/reference/formats/bpm-formats.rst@@ -129,7 +129,7 @@ uid and gid 0 and mtime 0.``Beefile``, ``README.md``, ``cert.der`` and ``build-environment.json`` arereserved and cannot be ``[[files]]`` or upatch targets.-:doc:`/upatches/beefile` describes the Beefile.+:doc:`/upatches/publish/beefile` describes the Beefile.On install the target loads every regular file in ``upatches/`` whose namecontains ``.upatch`` and not ``.unload.upatch``, in name order. Uninstall@@ -559,7 +559,7 @@ LimitsRelated--------- :doc:`/upatches/publishing`+- :doc:`/upatches/publish/publishing`- :doc:`/operate/run/deliver-packages`- :doc:`/reference/cli/bpm`- :doc:`configuration` for repository and tree settingsdiff --git a/Documentation/reference/formats/otlp.rst b/Documentation/reference/formats/otlp.rstindex 91b7a4eb..5a6208c9 100644--- a/Documentation/reference/formats/otlp.rst+++ b/Documentation/reference/formats/otlp.rst@@ -31,7 +31,7 @@ one ``POST`` from a one-shot command:The timers ``shirudo-keepalive.timer`` and ``shirudo-map-export.timer``run these commands, see :doc:`/reference/systemd-units`. Setting up anexport is in :doc:`/operate/run/telemetry`. Decoders are in-:doc:`/upatches/decoders`.+:doc:`/upatches/write/decoders`.Transport---------@@ -491,6 +491,6 @@ Related- :doc:`/operate/run/telemetry`- :doc:`/reference/cli/status`- :doc:`/reference/cli/upatch-map`-- :doc:`/upatches/decoders`+- :doc:`/upatches/write/decoders`- :doc:`status-json`- :doc:`configuration`diff --git a/Documentation/reference/formats/upatch-format.rst b/Documentation/reference/formats/upatch-format.rstindex e7c52ecf..b4a01c56 100644--- a/Documentation/reference/formats/upatch-format.rst+++ b/Documentation/reference/formats/upatch-format.rst@@ -417,7 +417,7 @@ Each program entry is 160 bytes:- uprobe.multi entry probe- ``uprobe.multi/<absolute-path>:<function-glob>``-:doc:`/upatches/attach-kinds` describes how the target attaches each kind.+:doc:`/upatches/write/attach-kinds` describes how the target attaches each kind.When any entry has kind 7, one ``UPUT`` block follows the program entriesand ends the section. Without a kind 7 entry the section ends after the@@ -573,7 +573,7 @@ the BPF program declares in ``.rodata`` (``bpf/lib/shirudo_decoder.h``,``.rodata`` at 4-byte steps, accepts one decoder per upatch and map, andreads each source file, at most 16 MiB. A decoder whose ``language``,``api_version``, ``input_format`` or ``export_signal`` differs from the-values above fails the build. :doc:`/upatches/decoders` covers the decoder+values above fails the build. :doc:`/upatches/write/decoders` covers the decoderAPI.Header fields outside the signature@@ -765,5 +765,5 @@ Related- :doc:`/reference/cli/build` and :doc:`/reference/cli/upatch-info`- :doc:`/internals/signed-loader`-- :doc:`/upatches/attach-kinds`+- :doc:`/upatches/write/attach-kinds`- :doc:`bpm-formats` for the packages that carry ``.upatch`` filesdiff --git a/Documentation/security/reporting.rst b/Documentation/security/reporting.rstindex 7d51cde5..94235400 100644--- a/Documentation/security/reporting.rst+++ b/Documentation/security/reporting.rst@@ -61,5 +61,5 @@ Next steps----------- :doc:`threat-model` for what shirudo protects and the known gaps-- :doc:`/contribute/contributing` if you send the fix yourself, after+- :doc:`/contribute/code/contributing` if you send the fix yourself, afterthe advisory is agreeddiff --git a/Documentation/start/guides/first-upatch.rst b/Documentation/start/guides/first-upatch.rstindex eac420dc..84145dce 100644--- a/Documentation/start/guides/first-upatch.rst+++ b/Documentation/start/guides/first-upatch.rst@@ -206,11 +206,11 @@ them in one consistent snapshot.Next steps------------ :doc:`/upatches/kernel-fix-tutorial` takes a real kernel fix to a+- :doc:`/upatches/learn/kernel-fix-tutorial` takes a real kernel fix to ashipped upatch.-- :doc:`/upatches/attach-kinds` lists the attachment kinds besides+- :doc:`/upatches/write/attach-kinds` lists the attachment kinds besides``fentry``.-- :doc:`/upatches/maps-arenas-serializers` explains arenas and+- :doc:`/upatches/write/maps-arenas-serializers` explains arenas andserializers.- :doc:`publish-package` ships an upatch through an OCI registry.- :doc:`/reference/cli/upatch-map` describes every option ofdiff --git a/Documentation/start/guides/publish-package.rst b/Documentation/start/guides/publish-package.rstindex 96d6b707..50c1cff0 100644--- a/Documentation/start/guides/publish-package.rst+++ b/Documentation/start/guides/publish-package.rst@@ -201,8 +201,8 @@ Remove itNext steps------------ :doc:`/upatches/beefile` describes every key of a ``Beefile``.-- :doc:`/upatches/publishing` publishes to a registry and to the signed+- :doc:`/upatches/publish/beefile` describes every key of a ``Beefile``.+- :doc:`/upatches/publish/publishing` publishes to a registry and to the signedupatch tree.- :doc:`/operate/run/deliver-packages` registers repositories in the signedconfig and lets the timers keep targets up to date.diff --git a/Documentation/upatches/index.rst b/Documentation/upatches/index.rstindex c6ccef0e..fc0f2fd8 100644--- a/Documentation/upatches/index.rst+++ b/Documentation/upatches/index.rst@@ -7,22 +7,23 @@ upatchesThese pages are for upatch authors: engineers who turn a kernel fix oran observation into a signed upatch and ship it as a package. Start with-:doc:`/upatches/concepts`, then follow-:doc:`/upatches/kernel-fix-tutorial` from a real kernel fix to a-published package. :doc:`/upatches/attach-kinds` and-:doc:`/upatches/beefile` are the references to keep at hand, and-:doc:`/upatches/debugging` explains each way a load can fail.+:doc:`/upatches/learn/concepts`, then follow+:doc:`/upatches/learn/kernel-fix-tutorial` from a real kernel fix to a+published package. :doc:`/upatches/write/attach-kinds` and+:doc:`/upatches/publish/beefile` are the references to keep at hand, and+:doc:`/upatches/test/debugging` explains each way a load can fail.++- :doc:`learn/index`: concepts, the kernel-fix tutorial and the example+ packages+- :doc:`write/index`: attach kinds, maps, arenas and serializers, and Lua+ decoders+- :doc:`test/index`: test an upatch on a target and debug a failed load+- :doc:`publish/index`: the Beefile and publishing a package.. toctree::- :titlesonly:+ :hidden:- concepts- kernel-fix-tutorial- attach-kinds- maps-arenas-serializers- decoders- testing- beefile- publishing- debugging- examples+ learn/index+ write/index+ test/index+ publish/indexdiff --git a/Documentation/upatches/concepts.rst b/Documentation/upatches/learn/concepts.rstsimilarity index 94%rename from Documentation/upatches/concepts.rstrename to Documentation/upatches/learn/concepts.rstindex 20603953..078a8df0 100644--- a/Documentation/upatches/concepts.rst+++ b/Documentation/upatches/learn/concepts.rst@@ -51,8 +51,8 @@ hard-coded offset signs as well as a CO-RE access and fails on the wrongkernel in the same way. :doc:`/concepts/background/co-re-btf` explains themechanism.-The section name is the attach point. :doc:`attach-kinds` lists the-sections the builder accepts and how the target attaches each one.+The section name is the attach point. :doc:`/upatches/write/attach-kinds` lists+the sections the builder accepts and how the target attaches each one.Why the build wraps the program in a loader-------------------------------------------@@ -192,9 +192,10 @@ file, the eventlog record and the target of its unload directive.``--name`` sets another.* - name in a package- The base name of the ``source`` in the Beefile, the same rule- without an override. :doc:`beefile` has the details.+ without an override. :doc:`/upatches/publish/beefile` has the details.* - tree id- - Equal to the upatch name. :doc:`publishing` explains why.+ - Equal to the upatch name. :doc:`/upatches/publish/publishing` explains+ why.* - upatch with decoders- At most 63 characters, because the decoder manifest holds theupatch name in a 64-byte field.@@ -223,10 +224,11 @@ how an upatch initializes state such as an arena before its first export.A negative return from the test-run program fails the load.An upatch that accumulates records keeps them in one BPF arena and ships a-serializer that walks them. :doc:`maps-arenas-serializers` explains why.+serializer that walks them. :doc:`/upatches/write/maps-arenas-serializers`+explains why.A map becomes a log record or a metric through a decoder, a Lua functionthat the source declares in ``.rodata`` and the build signs into the-upatch. :doc:`decoders` shows how to write one.+upatch. :doc:`/upatches/write/decoders` shows how to write one.What an upatch cannot do------------------------@@ -251,8 +253,8 @@ with ``attach_scope_mismatch``. For fentry, fexit, ``fmod_ret``, LSM andIt cannot use a program type that has no pinnable link. The builderrefuses socket filters, ``sk_skb``, ``xdp`` and every other section-outside the list in :doc:`attach-kinds`, because only a pinned link keeps-a program attached after the command exits and lets the unload path+outside the list in :doc:`/upatches/write/attach-kinds`, because only a pinned+link keeps a program attached after the command exits and lets the unload pathdetach it.It cannot stay loaded unmeasured. A load whose archive copy or register@@ -270,8 +272,8 @@ what remains.Related--------- :doc:`kernel-fix-tutorial` takes one upatch from a kernel fix to a- published package.+- :doc:`/upatches/learn/kernel-fix-tutorial` takes one upatch from a kernel fix+ to a published package.- :doc:`/reference/cli/build` for every ``shirudo build`` option.- :doc:`/concepts/upatches-and-packages` for how upatches, packages andthe tree relate.diff --git a/Documentation/upatches/examples.rst b/Documentation/upatches/learn/examples.rstsimilarity index 87%rename from Documentation/upatches/examples.rstrename to Documentation/upatches/learn/examples.rstindex 01eb15cf..5a979410 100644--- a/Documentation/upatches/examples.rst+++ b/Documentation/upatches/learn/examples.rst@@ -48,7 +48,8 @@ kernel-obs- nothing, every hook observes``kernel-obs`` is the reference for the conventions in-:doc:`maps-arenas-serializers` and :doc:`decoders`: the double-buffered+:doc:`/upatches/write/maps-arenas-serializers` and+:doc:`/upatches/write/decoders`: the double-bufferedtables, the one-entry maps that name the tables, the arena association,the page header and the timestamp conversion in the decoders.@@ -58,7 +59,7 @@ It follows here as it ships. Where it tells a target to add a key withrepositories from its signed config image and refuses local key changes.:doc:`/operate/run/deliver-packages` describes that setup.-.. include:: ../../upatches/kernel-obs/README.md+.. include:: ../../../upatches/kernel-obs/README.md:parser: myst_parser.sphinx_kernel-cve@@ -95,13 +96,13 @@ anything. They are ``kprobe`` programs and definepredicate as ``source_derived_unvalidated``: derived from the fix, notchecked against an exploit.-:doc:`kernel-fix-tutorial` takes the third detector from its fix to a-package, as an ``fentry`` program. ``kernel-cve.bee`` itself does not+:doc:`/upatches/learn/kernel-fix-tutorial` takes the third detector from its fix+to a package, as an ``fentry`` program. ``kernel-cve.bee`` itself does notbuild, and its tree entries do not match its upatch names.-:doc:`beefile` lists what is wrong with it.+:doc:`/upatches/publish/beefile` lists what is wrong with it.Related--------- :doc:`kernel-fix-tutorial` to write a detector of your own-- :doc:`beefile` for the keys both Beefiles use+- :doc:`/upatches/learn/kernel-fix-tutorial` to write a detector of your own+- :doc:`/upatches/publish/beefile` for the keys both Beefiles usediff --git a/Documentation/upatches/learn/index.rst b/Documentation/upatches/learn/index.rstnew file mode 100644index 00000000..41ea7b72--- /dev/null+++ b/Documentation/upatches/learn/index.rst@@ -0,0 +1,17 @@+..+ SPDX-License-Identifier: BSD-2-Clause+ Copyright (c) 2026 Authors of shirudo++Learn+=====++What an upatch is and how it reaches a target, one upatch taken from a+real kernel fix to a published package, and the example packages in the+tree.++.. toctree::+ :titlesonly:++ concepts+ kernel-fix-tutorial+ examplesdiff --git a/Documentation/upatches/kernel-fix-tutorial.rst b/Documentation/upatches/learn/kernel-fix-tutorial.rstsimilarity index 96%rename from Documentation/upatches/kernel-fix-tutorial.rstrename to Documentation/upatches/learn/kernel-fix-tutorial.rstindex 348194e0..e896f5f7 100644--- a/Documentation/upatches/kernel-fix-tutorial.rst+++ b/Documentation/upatches/learn/kernel-fix-tutorial.rst@@ -20,7 +20,8 @@ Before you begin- A shirudo checkout built with ``make`` and ``make shirudo-build``, andclang installed as ``/usr/bin/clang``, the path the build helper runs.-- A test VM running from that checkout, as :doc:`testing` describes. The+- A test VM running from that checkout, as :doc:`/upatches/test/testing`+ describes. Thesteps below use the default ``bpf-next`` VM and the signing key itsbundle enrolled.- A Linux kernel git tree, to read the fix.@@ -84,7 +85,7 @@ shipped detector, ``cve-2026-63984-rpl-detector.bpf.c``, attaches areasons: the program receives the arguments with their BTF types insteadof raw registers, the verifier checks the program's prototype against thekernel's, and the test VM's kernel is built without kprobes.-:doc:`attach-kinds` compares the kinds.+:doc:`/upatches/write/attach-kinds` compares the kinds.Write the program-----------------@@ -269,8 +270,8 @@ output. The report has ``"result":"ok"``, phase ``done`` and category``ok``, and its ``tpm.chain_after`` is the measurement register after theload. ``attached + pinned prog 0 (raw_tracepoint)`` means that shirudoattached the fentry program through ``BPF_RAW_TRACEPOINT_OPEN`` at the-function the verifier bound, and pinned the link. :doc:`debugging`-explains the report when a load fails.+function the verifier bound, and pinned the link.+:doc:`/upatches/test/debugging` explains the report when a load fails.Check where the kernel attached it and read the counters:@@ -376,7 +377,7 @@ tree ``id`` must equal it. The selector limits the tree entry to kernelsbuilt with IPv6. A target evaluates it against ``/proc/config.gz`` or``/boot/config-<release>``. A target that has neither does not match, anda target that does not match an entry passes over it for good.-:doc:`beefile` lists every key.+:doc:`/upatches/publish/beefile` lists every key.Build the package:@@ -428,8 +429,9 @@ Sign what a fleet runs with your own key.Next steps------------ :doc:`publishing` for the index, the tree and withdrawing an entry+- :doc:`/upatches/publish/publishing` for the index, the tree and withdrawing an+ entry- :doc:`/operate/run/deliver-packages` for what a target does with them-- :doc:`maps-arenas-serializers` and :doc:`decoders` to export what the- upatch records-- :doc:`attach-kinds` for the other places an upatch can attach+- :doc:`/upatches/write/maps-arenas-serializers` and+ :doc:`/upatches/write/decoders` to export what the upatch records+- :doc:`/upatches/write/attach-kinds` for the other places an upatch can attachdiff --git a/Documentation/upatches/beefile.rst b/Documentation/upatches/publish/beefile.rstsimilarity index 98%rename from Documentation/upatches/beefile.rstrename to Documentation/upatches/publish/beefile.rstindex d9317aae..5e37aa24 100644--- a/Documentation/upatches/beefile.rst+++ b/Documentation/upatches/publish/beefile.rst@@ -343,7 +343,7 @@ Example``upatches/kernel-obs/Beefile`` declares one upatch with generated``.rodata`` and ships its generators:-.. literalinclude:: ../../upatches/kernel-obs/Beefile+.. literalinclude:: ../../../upatches/kernel-obs/Beefile:language: toml``upatches/kernel-cve/kernel-cve.bee`` breaks these rules and is not a@@ -356,7 +356,8 @@ directories while its upatch names are the detectors' base names, soRelated--------- :doc:`publishing` for building, pushing and appending a package+- :doc:`/upatches/publish/publishing` for building, pushing and appending a+ package- :doc:`/reference/cli/bpm` for ``bpm build`` and ``bpm config update``- :doc:`/reference/formats/bpm-formats` for the archive, the index and thetreediff --git a/Documentation/upatches/publish/index.rst b/Documentation/upatches/publish/index.rstnew file mode 100644index 00000000..88d3a22a--- /dev/null+++ b/Documentation/upatches/publish/index.rst@@ -0,0 +1,15 @@+..+ SPDX-License-Identifier: BSD-2-Clause+ Copyright (c) 2026 Authors of shirudo++Package and publish+===================++Describe a package in its Beefile, build it, and publish it to a+repository index or the upatch tree.++.. toctree::+ :titlesonly:++ beefile+ publishingdiff --git a/Documentation/upatches/publishing.rst b/Documentation/upatches/publish/publishing.rstsimilarity index 97%rename from Documentation/upatches/publishing.rstrename to Documentation/upatches/publish/publishing.rstindex dad9d41a..d3bbe383 100644--- a/Documentation/upatches/publishing.rst+++ b/Documentation/upatches/publish/publishing.rst@@ -23,8 +23,9 @@ Before you begindescribes.- The signing key whose certificate your targets trust, in a keydirectory. The same key signs the upatches, the index and the tree.-- A package directory with a Beefile, as :doc:`beefile` describes, whose- upatches you have tested, as :doc:`testing` describes.+- A package directory with a Beefile, as :doc:`/upatches/publish/beefile`+ describes, whose+ upatches you have tested, as :doc:`/upatches/test/testing` describes.- Push access to an OCI registry. shirudo reads credentials from``BPM_OCI_USERNAME`` and ``BPM_OCI_PASSWORD``, ``BPM_OCI_BEARER_TOKEN``,``REGISTRY_AUTH_FILE`` or the Docker configuration, and an extra CAdiff --git a/Documentation/upatches/debugging.rst b/Documentation/upatches/test/debugging.rstsimilarity index 98%rename from Documentation/upatches/debugging.rstrename to Documentation/upatches/test/debugging.rstindex 9db34a32..710219f4 100644--- a/Documentation/upatches/debugging.rst+++ b/Documentation/upatches/test/debugging.rst@@ -214,7 +214,7 @@ Read the verifier logwith ``bpf_core_field_exists()`` and skip the access.* - ``<function>() is not modifiable``- ``fmod_ret`` on a function the kernel does not admit. Attach- elsewhere. :doc:`attach-kinds` lists the rules.+ elsewhere. :doc:`/upatches/write/attach-kinds` lists the rules.* - ``<function> is not sleepable``- A ``.s`` section on a function or hook that cannot sleep. Usethe section without ``.s``.@@ -254,4 +254,4 @@ Next steps- :doc:`/reference/cli/upatch-load` for the report's fields- :doc:`/concepts/background/co-re-btf` for how relocations resolve-- :doc:`testing` for the test VM+- :doc:`/upatches/test/testing` for the test VMdiff --git a/Documentation/upatches/test/index.rst b/Documentation/upatches/test/index.rstnew file mode 100644index 00000000..7a08c0c0--- /dev/null+++ b/Documentation/upatches/test/index.rst@@ -0,0 +1,15 @@+..+ SPDX-License-Identifier: BSD-2-Clause+ Copyright (c) 2026 Authors of shirudo++Test and debug+==============++Load an upatch on a test target before you ship it, and find out why a+load failed.++.. toctree::+ :titlesonly:++ testing+ debuggingdiff --git a/Documentation/upatches/testing.rst b/Documentation/upatches/test/testing.rstsimilarity index 93%rename from Documentation/upatches/testing.rstrename to Documentation/upatches/test/testing.rstindex 164a5027..4a75cda7 100644--- a/Documentation/upatches/testing.rst+++ b/Documentation/upatches/test/testing.rst@@ -20,9 +20,10 @@ Before you begin- A shirudo checkout built with ``make`` and ``make shirudo-build``- A Linux host with KVM, root, and the host packages the test VM needs,- listed in :doc:`/contribute/testing`+ listed in :doc:`/contribute/testing/testing`- An upatch and its unload directive, built as in- :doc:`kernel-fix-tutorial`, or one of the signed fixtures below+ :doc:`/upatches/learn/kernel-fix-tutorial`, or one of the signed fixtures+ belowBoot the test VM----------------@@ -95,8 +96,8 @@ Load and observe it``<path>`` is the upatch's path in the checkout. The command exits with 0on success, 2 when an attach target is missing or the command line iswrong, and 1 on any other failure. The report's ``category`` says why,- and :doc:`debugging` goes through each one. To refuse the load unless the- measurement register still holds a value you read before, add+ and :doc:`/upatches/test/debugging` goes through each one. To refuse the load+ unless the measurement register still holds a value you read before, add``--expect-chain=<chain>``, with ``<chain>`` the ``tpm.chain`` field of``shirudo-runtime status --json``.@@ -204,7 +205,7 @@ category looks like.Next steps------------ :doc:`debugging` when a load fails-- :doc:`publishing` once the upatch works-- :doc:`/contribute/testing` for the automated tests that boot the same+- :doc:`/upatches/test/debugging` when a load fails+- :doc:`/upatches/publish/publishing` once the upatch works+- :doc:`/contribute/testing/testing` for the automated tests that boot the sameVMdiff --git a/Documentation/upatches/attach-kinds.rst b/Documentation/upatches/write/attach-kinds.rstsimilarity index 98%rename from Documentation/upatches/attach-kinds.rstrename to Documentation/upatches/write/attach-kinds.rstindex e2ecb1f5..e3ba2df1 100644--- a/Documentation/upatches/attach-kinds.rst+++ b/Documentation/upatches/write/attach-kinds.rst@@ -242,7 +242,7 @@ Two roles are recognized by the program's name, and both must be in``serializers/<map>`` under the upatch's pin directory, and``shirudo upatch map`` runs it with ``BPF_PROG_TEST_RUN``. The upatchmust also define the ``shirudo_ser`` output map. One serializer per- map. :doc:`maps-arenas-serializers` describes the interface.+ map. :doc:`/upatches/write/maps-arenas-serializers` describes the interface.``shirudo_test__<id>``Pinned as ``test`` and run once with ``BPF_PROG_TEST_RUN`` and azeroed 16-byte context, after all attachments. A negative return fails@@ -350,6 +350,6 @@ away from targets that lack its site.Related--------- :doc:`concepts` for the roles, pins and names-- :doc:`debugging` for every failure category of a load+- :doc:`/upatches/learn/concepts` for the roles, pins and names+- :doc:`/upatches/test/debugging` for every failure category of a load- :doc:`/internals/kernel-interfaces` for the system calls in detaildiff --git a/Documentation/upatches/decoders.rst b/Documentation/upatches/write/decoders.rstsimilarity index 97%rename from Documentation/upatches/decoders.rstrename to Documentation/upatches/write/decoders.rstindex a78545ea..626af4f2 100644--- a/Documentation/upatches/decoders.rst+++ b/Documentation/upatches/write/decoders.rst@@ -19,9 +19,9 @@ Before you begin- An upatch source with the map to export, and the layout of that map:the records its serializer writes, or its key and value types.- :doc:`maps-arenas-serializers` covers serializers.+ :doc:`/upatches/write/maps-arenas-serializers` covers serializers.- The test VM or another target to run the decoder on, as- :doc:`testing` describes.+ :doc:`/upatches/test/testing` describes.- Familiarity with Lua 5.1, the language LuaJIT runs.:doc:`/concepts/background/luajit` covers what shirudo uses it for.@@ -162,7 +162,7 @@ Write the functionThe ``watch_stat`` decoder adds up both counters over all CPUs andreturns one monotonic sum with a data point for each:- .. literalinclude:: ../../upatches/kernel-obs/decoders/watch_stat.lua+ .. literalinclude:: ../../../upatches/kernel-obs/decoders/watch_stat.lua:language: lua4. Return the record. A log decoder returns a table. With ``--otel`` it@@ -233,7 +233,8 @@ Run it on a targettarget# shirudo-runtime upatch map <upatch> <map> --json --peek- ``shirudo-runtime`` is the command in the test VM, as :doc:`testing`+ ``shirudo-runtime`` is the command in the test VM, as+ :doc:`/upatches/test/testing`explains. ``<upatch>`` and ``<map>`` are the names in the manifest. Thecommand prints what the decoder returned as one JSON document. A failureprints one of ``upatch map: decoder load failed: <message>``, ``upatchdiff --git a/Documentation/upatches/write/index.rst b/Documentation/upatches/write/index.rstnew file mode 100644index 00000000..06b11eef--- /dev/null+++ b/Documentation/upatches/write/index.rst@@ -0,0 +1,17 @@+..+ SPDX-License-Identifier: BSD-2-Clause+ Copyright (c) 2026 Authors of shirudo++Write+=====++Where a program can attach, how an upatch keeps and exports its state in+maps, arenas and serializers, and how a Lua decoder turns that state+into telemetry.++.. toctree::+ :titlesonly:++ attach-kinds+ maps-arenas-serializers+ decodersdiff --git a/Documentation/upatches/maps-arenas-serializers.rst b/Documentation/upatches/write/maps-arenas-serializers.rstsimilarity index 97%rename from Documentation/upatches/maps-arenas-serializers.rstrename to Documentation/upatches/write/maps-arenas-serializers.rstindex 136d30ed..6798a357 100644--- a/Documentation/upatches/maps-arenas-serializers.rst+++ b/Documentation/upatches/write/maps-arenas-serializers.rst@@ -185,7 +185,7 @@ stack trace maps, program arrays and arenas are not read directly. Thewith a dot in the name or the ``obs_i_`` prefix, are not visible at all.The pages or entries then go to the map's decoder, which turns them into a-log record or a metric. :doc:`decoders` describes that step, and+log record or a metric. :doc:`/upatches/write/decoders` describes that step, and:doc:`/operate/run/telemetry` the export to a collector.Only tasks with shirudo's runtime authority can do any of this. The LSM@@ -208,7 +208,7 @@ LimitsRelated--------- :doc:`attach-kinds` for the serializer and test-run roles-- :doc:`examples` for ``kernel-obs``, which uses this template for all- its tables+- :doc:`/upatches/write/attach-kinds` for the serializer and test-run roles+- :doc:`/upatches/learn/examples` for ``kernel-obs``, which uses this template+ for all its tables- :doc:`/reference/cli/upatch-map` for the command's optionsdiff --git a/testing/ci-checks/t0002-check-spdx.sh b/testing/ci-checks/t0002-check-spdx.shindex 2494fd44..9e7f1ff7 100755--- a/testing/ci-checks/t0002-check-spdx.sh+++ b/testing/ci-checks/t0002-check-spdx.sh@@ -52,7 +52,7 @@ put "$R/vendor/libbpf/bpf/bpf_helper_defs.h" '/* This is auto-generated file. */put "$R/vendor/README.md" 'no tag here'put "$R/vendor/linux/vmlinux.h" 'struct task_struct;'put "$R/pkg/vmlinux.h" 'struct task_struct;'-put "$R/Documentation/contribute/coding-style.rst" 'Linux kernel coding style'+put "$R/Documentation/contribute/code/coding-style.rst" 'Linux kernel coding style'put "$R/bpf/lsm.c" '// SPDX-License-Identifier: GPL-2.0 OR BSD-2-Clause' \'#include "vmlinux.h"' '#include <bpf/bpf_helpers.h>' '#include "common.h"'put "$R/bpf/lib/common.h" '/* SPDX-License-Identifier: GPL-2.0 OR BSD-2-Clause */'