eBPF-based security platform
docs: link the files the pages name on GitHub
Daniel Borkmann4cd5032e5060
diff --git a/Documentation/_ext/shirudo_docs.py b/Documentation/_ext/shirudo_docs.pyindex 75f549b2..fbc23dcd 100644--- a/Documentation/_ext/shirudo_docs.py+++ b/Documentation/_ext/shirudo_docs.py@@ -3,7 +3,8 @@## Sphinx extension for the shirudo documentation: the page type and# reader line under each title, the source and last change in the page-# footer, and console blocks whose prompts name the role a command runs in.+# footer, console blocks whose prompts name the role a command runs in,+# and :src: links to the files of the repository.import os@@ -119,7 +120,30 @@ def write_llms(app, exception):stream.write("\n".join(lines))+# :src:`path` shows a path of the repository as code and links it on+# GitHub. A path the checkout does not have is reported, so that a file+# moved or removed cannot leave a dead link behind.+def src_role(name, rawtext, text, lineno, inliner, options=None,+ content=None):+ env = inliner.document.settings.env+ context = env.config.html_context+ path = text.strip()+ local = os.path.join(os.path.dirname(os.path.abspath(env.srcdir)),+ path.rstrip("/"))+ messages = []+ if not os.path.exists(local):+ messages.append(inliner.reporter.warning(+ "src: %s is not in the repository" % path, line=lineno))+ kind = "tree" if os.path.isdir(local) else "blob"+ url = "%s/%s/%s/%s" % (context["repository"], kind, context["branch"],+ path)+ node = nodes.reference(rawtext, "", refuri=url)+ node += nodes.literal(path, path)+ return [node], messages++def setup(app):+ app.add_role("src", src_role)app.add_lexer("console", ConsoleLexer)app.add_lexer("shell-session", ConsoleLexer)CHANGES.update(last_changes())diff --git a/Documentation/concepts/background/initrd-dracut.rst b/Documentation/concepts/background/initrd-dracut.rstindex f64ac659..23ca48a0 100644--- a/Documentation/concepts/background/initrd-dracut.rst+++ b/Documentation/concepts/background/initrd-dracut.rst@@ -106,7 +106,7 @@ How shirudo uses the initrd---------------------------shirudo ships a dracut module, ``90shirudo``, from-``tools/gen-initrd/module-setup.sh``. Its ``check()`` looks for the+:src:`tools/gen-initrd/module-setup.sh`. Its ``check()`` looks for the``shirudo`` binary and the primary certificate. It depends on the``systemd`` and ``systemd-initrd`` modules, and on``systemd-pcrextend`` (``systemd-pcrphase`` in older dracut releases)diff --git a/Documentation/concepts/background/luajit.rst b/Documentation/concepts/background/luajit.rstindex eb145f42..b560abe1 100644--- a/Documentation/concepts/background/luajit.rst+++ b/Documentation/concepts/background/luajit.rst@@ -66,7 +66,7 @@ How a decoder reaches the targetThe BPF source declares each decoder in ``.rodata`` with a``struct decoder_manifest`` from-``bpf/lib/decoder.h``. The manifest starts with the magic+:src:`bpf/lib/decoder.h`. The manifest starts with the magic``DECD`` and names the language (``1``, Lua), the host API version, theinput format (``1``), the signal to export (``1`` for a log, ``2`` for ametric), the upatch and map it decodes, the Lua source file relative todiff --git a/Documentation/concepts/background/tpm.rst b/Documentation/concepts/background/tpm.rstindex 912cfa28..7e696c9f 100644--- a/Documentation/concepts/background/tpm.rst+++ b/Documentation/concepts/background/tpm.rst@@ -241,7 +241,7 @@ with the same policy cannot be initialized since the policy requiresthe old PCR 9 value which shirudo extended with the anchor.shirudo's register is the index ``0x01818E00``, which a build can-change with ``NV_INDEX`` in ``util/paths.h``. It holds one SHA-256+change with ``NV_INDEX`` in :src:`util/paths.h`. It holds one SHA-256digest and has the attributes ``0x0E060048``: ``TPM2_NT_EXTEND``,``TPMA_NV_POLICYWRITE``, ``TPMA_NV_OWNERREAD``, ``TPMA_NV_AUTHREAD``,``TPMA_NV_NO_DA``, ``TPMA_NV_ORDERLY`` and ``TPMA_NV_CLEAR_STCLEAR``.@@ -359,7 +359,7 @@ The signature alone does not keep other processes out. The bytes thewriter key derives from are not a secret, so any process that recreatesthe key could ask the TPM to sign. An LSM hook in the kernel keepsthem out. The companion kernel patch-``kernel/0002-tpm-Let-LSMs-inspect-userspace-commands.patch`` adds an+:src:`kernel/0002-tpm-Let-LSMs-inspect-userspace-commands.patch` adds anLSM hook, ``tpm_command``, that sees every command written to``/dev/tpm0`` or ``/dev/tpmrm0`` before the driver sends or queues it.shirudo's ``lsm/tpm_command``diff --git a/Documentation/concepts/glossary.rst b/Documentation/concepts/glossary.rstindex 8abb3c2d..d4696e88 100644--- a/Documentation/concepts/glossary.rst+++ b/Documentation/concepts/glossary.rst@@ -28,7 +28,7 @@ it.BPF programs allocate records directly. An upatch that accumulatesrecords keeps them in one arena, which its serializer reads as oneconsistent snapshot and can reset between exports.- ``upatches/kernel-obs/obs_table.h`` is the template for a+ :src:`upatches/kernel-obs/obs_table.h` is the template for adouble-buffered arena table. See:doc:`/upatches/write/maps-arenas-serializers`.@@ -126,8 +126,8 @@ it.enforcement programsThe BPF LSM programs embedded in the ``shirudo`` binary, built from- ``bpf/bpf2.c`` (``bpf()`` admission, keyrings, the private bpffs,- mounts, devices and the TPM) and ``bpf/seal.c`` (the seal and the+ :src:`bpf/bpf2.c` (``bpf()`` admission, keyrings, the private bpffs,+ mounts, devices and the TPM) and :src:`bpf/seal.c` (the seal and thetask marks). ``init`` loads them before their admission gatesattach, so they are the one BPF code that does not pass the signedloader path; in production the authenticated initrd vouches for@@ -323,7 +323,7 @@ it.authority when it runs. See :doc:`/internals/config-images`.seal- The BPF LSM programs from ``bpf/seal.c`` that protect shirudo's+ The BPF LSM programs from :src:`bpf/seal.c` that protect shirudo'swritable state and processes. They refuse writes, unlinks, renames,attribute changes and new entries on labeled inodes under``/var/lib/shirudo`` to tasks without runtime authority, and keepdiff --git a/Documentation/concepts/upatches-and-packages.rst b/Documentation/concepts/upatches-and-packages.rstindex 59846700..4456c437 100644--- a/Documentation/concepts/upatches-and-packages.rst+++ b/Documentation/concepts/upatches-and-packages.rst@@ -123,7 +123,7 @@ upatch, the selector it gets when published to an upatch tree.``shirudo bpm build`` builds and signs every upatch the Beefile lists,together with its unload directive, and writes ``<name>-<version>.bee``.The package is a gzip-compressed tar archive that holds the Beefile, the-artifacts and directives under ``upatches/``, the package's ``README.md``+artifacts and directives under :src:`upatches/`, the package's ``README.md``when it has one, the signing certificate ``cert.der``, a``build-environment.json`` and the extra files.diff --git a/Documentation/contribute/arch-support.rst b/Documentation/contribute/arch-support.rstindex 34c33b6d..3ccf54df 100644--- a/Documentation/contribute/arch-support.rst+++ b/Documentation/contribute/arch-support.rst@@ -37,7 +37,7 @@ Comparison- Boots on x86-64 hosts- Boots on arm64 hosts; ``t1007`` checks its settings withoutbooting- - None; ``testing/vm/arch.sh`` refuses the architecture+ - None; :src:`testing/vm/arch.sh` refuses the architecture* - Packages- Built in CI- Not built in CI@@ -135,8 +135,8 @@ shirudo- Run the CI tiers on arm64, with the test VM booting on an arm64runner.-- Add riscv64 to the test VM in ``testing/vm/arch.sh`` and- ``testing/vm/build-kernel.sh``, and boot a first riscv64 target with a+- Add riscv64 to the test VM in :src:`testing/vm/arch.sh` and+ :src:`testing/vm/build-kernel.sh`, and boot a first riscv64 target with aTPM.- Build the target binary and the packages for arm64 and riscv64 in CI.- Check that every library the target links builds and runs ondiff --git a/Documentation/contribute/code/contributing.rst b/Documentation/contribute/code/contributing.rstindex 6b8a4ec5..4b4bf278 100644--- a/Documentation/contribute/code/contributing.rst+++ b/Documentation/contribute/code/contributing.rst@@ -16,7 +16,7 @@ kernel's ``Documentation/process/submitting-patches.rst`` is thereference for anything not covered.Participation in the project is governed by the Code of Conduct in-``CODE_OF_CONDUCT.md`` at the repository root. Conduct concerns go to+:src:`CODE_OF_CONDUCT.md` at the repository root. Conduct concerns go toCommit messages@@ -138,7 +138,7 @@ chain of ``Signed-off-by:`` lines records the real route the changetook. The first sign-off is the author's. The last is the person whosubmits the commit.-``.github/scripts/check-dco.sh`` checks every commit in a range except+:src:`.github/scripts/check-dco.sh` checks every commit in a range exceptmerge commits:- The subject is one line, followed by a blank line.@@ -228,7 +228,7 @@ Before sending- Run ``make -C Documentation html`` when the change touches``Documentation/``. The build turns every Sphinx warning into anerror. See :doc:`/contribute/documentation/writing-docs`.-- Run ``.github/scripts/check-spdx.sh`` when the change adds a file.+- Run :src:`.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`` foreverything compiled into a BPF object, the headers it includes anddiff --git a/Documentation/contribute/code/develop-locally.rst b/Documentation/contribute/code/develop-locally.rstindex 2e8d44b2..c383579e 100644--- a/Documentation/contribute/code/develop-locally.rst+++ b/Documentation/contribute/code/develop-locally.rst@@ -248,8 +248,8 @@ way a real upatch's data reaches a collector.operator$ ln -s "$PWD/bpf" "$DEV/exec-count/bpf"``shirudo-build`` compiles in the package directory. It takes the- libbpf headers and ``vmlinux.h`` from ``vendor/`` and- ``decoder.h`` from ``bpf/lib/``. An installed operator+ libbpf headers and ``vmlinux.h`` from :src:`vendor/` and+ ``decoder.h`` from :src:`bpf/lib/`. An installed operatorpackage brings its own copies and needs no links.2. Write ``build/dev/exec-count/exec-count.bpf.c``:@@ -509,7 +509,7 @@ target runs takes a new bundle and a new VM.operator$ make && make shirudo-build- After a change to the target side, such as a ``builtin-*.c`` command- the target runs, ``util/``, the BPF programs under ``bpf/`` or the boot+ the target runs, :src:`util/`, the BPF programs under :src:`bpf/` or the bootintegration, replace the VM:.. code-block:: consolediff --git a/Documentation/contribute/code/developer-guide.rst b/Documentation/contribute/code/developer-guide.rstindex d0fa9a79..119a7637 100644--- a/Documentation/contribute/code/developer-guide.rst+++ b/Documentation/contribute/code/developer-guide.rst@@ -23,7 +23,7 @@ Before you begin``clang`` and ``llvm`` with the BPF target. CI installs clang 20 onits Ubuntu runners because clang 18 lacks the BPF address-space caststhat arena upatches need.-- The development files that ``Makefile.config`` probes for with+- The development files that :src:`Makefile.config` probes for with``pkg-config``:.. list-table::@@ -61,7 +61,7 @@ Install OpenSSL 3.5The build probe's hint names Ubuntu 26.04 and Fedora 43 as the firstreleases that ship OpenSSL 3.5. Ubuntu 24.04 ships 3.0. On an olderdistribution, build OpenSSL into a prefix of its own the way-``.github/scripts/vm-toolchain.sh`` does for CI:+:src:`.github/scripts/vm-toolchain.sh` does for CI:1. Download and unpack the release:@@ -96,7 +96,7 @@ distribution, build OpenSSL into a prefix of its own the way$ openssl list -public-key-algorithms | grep -i ml-dsa``sudo`` drops ``LD_LIBRARY_PATH`` and replaces ``PATH``. When you run-a make target as root, pass both on, as ``.github/scripts/tests.sh``+a make target as root, pass both on, as :src:`.github/scripts/tests.sh`does:.. code-block:: console@@ -111,7 +111,7 @@ Select the kernel BTFThe BPF objects that shirudo embeds compile against``vendor/linux/vmlinux.h``. ``shirudo build`` run in the checkout rootuses the same header unless ``--vmlinux`` names another. The build-generates that header from BTF with ``tools/gen-vmlinux-h`` and never+generates that header from BTF with :src:`tools/gen-vmlinux-h` and nevercommits it. The embeddedadmission program reads the signature verdict the kernel records in``prog->aux->sig``, so the header must come from a kernel with the@@ -175,7 +175,7 @@ Build the operator binary$ ./shirudo versionThe build compiles the vendored libbpf, generates ``vmlinux.h``,-compiles the userspace objects and the BPF objects under ``bpf/``,+compiles the userspace objects and the BPF objects under :src:`bpf/`,embeds the BPF objects into ``util/loader.o`` and links. These makevariables change it:@@ -235,7 +235,7 @@ path, which takes precedence over ``PATH``.``bpm build`` compiles with the package directory as its workingdirectory. To build a package with a checkout's ``vmlinux.h`` and BPFheaders, give the package directory ``vendor`` and ``bpf`` symbolic-links to the checkout's, as ``t7005`` and ``testing/end2end/host.sh``+links to the checkout's, as ``t7005`` and :src:`testing/end2end/host.sh`do.Build the target binary@@ -275,7 +275,7 @@ removes ``build/target-deps``.Refresh the vendored libbpf----------------------------``vendor/libbpf`` holds libbpf, its BPF-side headers and the BPF UAPI+:src:`vendor/libbpf` holds libbpf, its BPF-side headers and the BPF UAPIheaders. No kernel tree is needed to build. Refresh the copy only whena change needs a newer libbpf or UAPI:@@ -284,7 +284,7 @@ a change needs a newer libbpf or UAPI:$ make bpf-deps KERNEL_SRC=<kernel-tree>``<kernel-tree>`` is a kernel checkout. Without ``KERNEL_SRC``,-``tools/bpf-deps/bpf-deps.sh`` makes a shallow clone of bpf-next.+:src:`tools/bpf-deps/bpf-deps.sh` makes a shallow clone of bpf-next.Other make targets------------------@@ -333,68 +333,68 @@ Project layout* - Path- Contents- * - ``shirudo.c``+ * - :src:`shirudo.c`- The command dispatch table.- * - ``builtin-*.c``, ``builtin.h``+ * - ``builtin-*.c``, :src:`builtin.h`- One file per top-level command: ``attest``, ``bpm``, ``build``,``config``, ``genkey``, ``image``, ``init``, ``keys``,``status``, ``upatch`` and ``version``.- * - ``util/``- - The userspace library both binaries link. ``util/sign.c`` is+ * - :src:`util/`+ - The userspace library both binaries link. :src:`util/sign.c` islinked into ``shirudo-build`` only.- * - ``bpf/``+ * - :src:`bpf/`- The embedded BPF programs: ``bpf2.c`` (admission, mount, imageand device guards), ``seal.c`` (the seal) and ``unload.c`` (thesigned unload directive).- * - ``bpf/lib/``+ * - :src:`bpf/lib/`- The headers more than one BPF program includes: the LSM helpersand verity device records of ``bpf2.c`` and ``seal.c``, and,shared with upatches and userspace, decoders, identity,serializers, tamper counters and common helpers.- * - ``include/shirudo/``+ * - :src:`include/shirudo/`- Integer types, string and number helpers, the ``.upatch``container layout, TPM types and the enforcement definitionsshared between userspace and BPF.- * - ``tools/shirudo-build/``+ * - :src:`tools/shirudo-build/`- The operator-only helper: compile, sign, unload directives,image signing, ``keys vouch``, ``bpm build``, ``push``,``tree append`` and ``config update``.- * - ``tools/gen-image/``+ * - :src:`tools/gen-image/`- ``shirudo-gen-image``, ``shirudo-gen-runtime`` and``shirudo-gen-verity``, which make the runtime and config images,their shared ``common.sh`` and the runtime unit templates.- * - ``tools/gen-initrd/``+ * - :src:`tools/gen-initrd/`- The dracut module, the initrd generator and the installer.- * - ``tools/gen-vmlinux-h/``+ * - :src:`tools/gen-vmlinux-h/`- The ``vmlinux.h`` generator.- * - ``tools/bpf-deps/``- - The script that refreshes ``vendor/libbpf``.- * - ``vendor/libbpf/``+ * - :src:`tools/bpf-deps/`+ - The script that refreshes :src:`vendor/libbpf`.+ * - :src:`vendor/libbpf/`- Vendored libbpf and BPF UAPI headers.* - ``vendor/linux/``- The generated ``vmlinux.h``. Not tracked.- * - ``kernel/``+ * - :src:`kernel/`- Kernel patches the test kernel build applies. See:doc:`/internals/kernel-patches`.- * - ``upatches/``+ * - :src:`upatches/`- The shipped packages, ``kernel-obs`` and ``kernel-cve``, eachwith its Beefile.- * - ``systemd/``+ * - :src:`systemd/`- Unit and timer templates for the target.- * - ``completion/``+ * - :src:`completion/`- The bash completion. Command names come from``shirudo --list-cmds``. Option lists are maintained by hand.- * - ``packaging/``+ * - :src:`packaging/`- The tar, deb and rpm packaging.- * - ``testing/``+ * - :src:`testing/`- Unit, functional, end-to-end and fuzz tests, the test VM andtheir helpers. See :doc:`/contribute/testing/testing`.* - ``Documentation/``- This documentation.- * - ``.github/``+ * - :src:`.github/`- The CI workflows and the scripts they run.- * - ``Makefile``, ``Makefile.shirudo``, ``Makefile.config``,- ``Makefile.target-deps``, ``Makefile.version``+ * - ``Makefile``, :src:`Makefile.shirudo`, :src:`Makefile.config`,+ :src:`Makefile.target-deps`, :src:`Makefile.version`- The entry points, the build graph, the prerequisite probes, thetarget dependency build and version discovery.* - ``build/``, ``artifacts/``@@ -406,7 +406,7 @@ Project layoutRun the CI checks locally--------------------------CI runs these scripts from ``.github/scripts/``. Each takes the+CI runs these scripts from :src:`.github/scripts/`. Each takes thearguments of ``git rev-list``, such as ``origin/main..HEAD``, and checksthe commit at ``HEAD`` alone without them.@@ -443,7 +443,7 @@ the commit at ``HEAD`` alone without them.- That a runtime image of the default size of``shirudo-gen-runtime`` holds the target binary, and how muchspace it leaves. When it fails, raise ``size=`` in- ``tools/gen-image/shirudo-gen-runtime``.+ :src:`tools/gen-image/shirudo-gen-runtime`.* - ``tests.sh setup|run [unit|functional|end2end]``- Prepares a CI runner as the VM host and runs ``make tests``, orone part of it: ``unit`` runs the unit and ``ci-checks`` tests,diff --git a/Documentation/contribute/testing/test-coverage.rst b/Documentation/contribute/testing/test-coverage.rstindex d5affd8c..2675dc83 100644--- a/Documentation/contribute/testing/test-coverage.rst+++ b/Documentation/contribute/testing/test-coverage.rst@@ -8,7 +8,7 @@Test coverage=============-This page lists what the tests under ``testing/`` cover, by family, by+This page lists what the tests under :src:`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 familytables. :doc:`/contribute/testing/testing` explains the families, the numbering@@ -432,8 +432,8 @@ signed config image.Unit suites and fuzz targets~~~~~~~~~~~~~~~~~~~~~~~~~~~~-The unit suites in ``testing/unit/`` cover seven of the modules in-``util/``: ``chain``, ``hex``, ``json``, ``kernel_abi``,+The unit suites in :src:`testing/unit/` cover seven of the modules in+:src:`util/`: ``chain``, ``hex``, ``json``, ``kernel_abi``,``kernel_build_id``, ``kernel_release`` and ``string``. The othermodules are reached through the test helpers, the fuzz targets and thebinaries the functional tests run.@@ -669,7 +669,7 @@ tests assert that a refusal moves its counter:Not covered------------These are verified absences: no test under ``testing/`` exercises them.+These are verified absences: no test under :src:`testing/` exercises them.Attacks~~~~~~~@@ -745,7 +745,7 @@ Commands and proceduresfailure categories ``already_unloaded``, ``attach_target_missing``,``detach_failed``, ``eventlog_full``, ``kernel_abi_unsupported``,``lsm_denied``, ``signature_unsupported`` or ``verifier_rejected``.-- Completion against the parsers. ``completion/shirudo.bash`` keeps its+- Completion against the parsers. :src:`completion/shirudo.bash` keeps itsoption lists by hand, and no test compares them with the options thecommands accept.@@ -800,9 +800,9 @@ PlatformsParsers and units~~~~~~~~~~~~~~~~~-- The dm-verity superblock check in ``util/config_image.c`` has no+- The dm-verity superblock check in :src:`util/config_image.c` has nofuzz target. ``t5001`` covers truncation and unsupported fields.-- 56 of the 63 modules in ``util/`` have no unit suite of their own.+- 56 of the 63 modules in :src:`util/` have no unit suite of their own.Related-------diff --git a/Documentation/contribute/testing/testing.rst b/Documentation/contribute/testing/testing.rstindex a8bac5dc..d1947677 100644--- a/Documentation/contribute/testing/testing.rst+++ b/Documentation/contribute/testing/testing.rst@@ -30,7 +30,7 @@ Before you begin``.github/scripts/tests.sh setup`` installs ``cloud-image-utils``,``dracut-core``, ``file``, ``isc-dhcp-client``, ``libguestfs-tools``,``qemu-system-x86``, ``qemu-utils``, ``swtpm``, ``swtpm-tools`` and- ``tpm2-tools`` among others. ``testing/vm/run.sh`` names the packages+ ``tpm2-tools`` among others. :src:`testing/vm/run.sh` names the packagesit misses with an install command for ``apt-get`` or ``dnf``.- For the end-to-end tests: Docker on the host.@@ -46,11 +46,11 @@ Test tiers- Runs- Command* - Unit- - ``testing/unit/``+ - :src:`testing/unit/`- On the build host- ``make -C testing unit``* - CI checks- - ``testing/ci-checks/``+ - :src:`testing/ci-checks/`- On the build host- ``make -C testing ci-checks``* - Functional@@ -59,12 +59,12 @@ Test tiersfamily- ``make -C testing functional``* - End-to-end- - ``testing/end2end/``+ - :src:`testing/end2end/`- Around one VM, with a registry and a collector in containers onthe host- ``make -C testing end2end``* - Fuzz- - ``testing/fuzz/``+ - :src:`testing/fuzz/`- On the build host, under libFuzzer, ASan and UBSan- ``make -C testing fuzz``@@ -132,7 +132,7 @@ A shell test is named ``t<F><K><NN>-<what>.sh``:whole delivery pathA test you add takes the next free number of its family and kind. A-number is never reused for another test. A file under ``testing/`` that+number is never reused for another test. A file under :src:`testing/` thatis not a test does not take a name of this form. A target test can havea Python companion with the same stem, such as``t5101-verity-boot-signers.py``, which only its shell test runs.@@ -159,8 +159,8 @@ one tier, one unit suite or one family:$ make -C testing unit/<suite># make -C testing functional/<family>-``<suite>`` is a file name under ``testing/unit/`` without ``.c``, such-as ``json``. ``<family>`` is a directory under ``testing/functional/``,+``<suite>`` is a file name under :src:`testing/unit/` without ``.c``, such+as ``json``. ``<family>`` is a directory under :src:`testing/functional/`,such as ``upatch``. A family runs its operator tests in number order,then boots its VM and runs its target tests there. ``make -j`` boots theVMs of several families side by side.@@ -178,7 +178,7 @@ Run the cases of a unit suite whose names contain ``<substring>``:$ build/unit/<suite> <substring>-Run one operator test directly. It changes to ``testing/`` itself and+Run one operator test directly. It changes to :src:`testing/` itself anduses the binaries in the checkout root, so build them first:.. code-block:: console@@ -194,7 +194,7 @@ Read the resultsEvery test prints TAP: ``ok <n> - <title>``, ``not ok <n> - <title>``and a closing ``1..<n>``. A failing case's standard error follows as-lines that start with ``#``. ``testing/run-tests.sh`` exits with the+lines that start with ``#``. :src:`testing/run-tests.sh` exits with thenumber of test scripts that failed.A test that cannot run prints ``1..0 # SKIP <reason>``. On the build@@ -262,7 +262,7 @@ Build the test kernel~~~~~~~~~~~~~~~~~~~~~``make -C testing kernel`` builds bpf-next with the slim configuration-in ``testing/vm/build-kernel.sh`` and the patches under ``kernel/``. It+in :src:`testing/vm/build-kernel.sh` and the patches under :src:`kernel/`. Itwrites the kernel image, ``vmlinux.btf``, ``kernel.config``, packagesand a record of the commit it built to``artifacts/bpf-next-kernel-debs/``. Every target that boots a VM@@ -282,10 +282,10 @@ builds the kernel first when it is missing.The stamp is ``artifacts/bpf-next-kernel-debs/bzImage.sha256sum``(``Image.sha256sum`` on arm64). Make rebuilds the kernel when-``testing/vm/build-kernel.sh`` or a patch under ``kernel/`` is newer+:src:`testing/vm/build-kernel.sh` or a patch under :src:`kernel/` is newerthan the stamp, so a checkout or rebase that touches either rebuildsit on the next VM run. When you know the kernel is current, touch the-stamp, as ``.github/scripts/tests.sh`` does. The build removes the+stamp, as :src:`.github/scripts/tests.sh` does. The build removes theartifact directory first, so do not run it while a VM run or a buildreads ``vmlinux.btf``.@@ -305,7 +305,7 @@ reads ``vmlinux.btf``.* - ``KERNEL_CONFIG=<file>``- Starts from a full configuration instead of the slim fragment.* - ``KERNEL_PATCHES=<dir>``- - Applies these patches instead of ``kernel/``.+ - Applies these patches instead of :src:`kernel/`.* - ``KERNEL_BUILD_JOBS=<n>``- Parallel jobs, ``nproc`` by default.* - ``WORK_DIR=<dir>``@@ -322,7 +322,7 @@ Build the bundleThe bundle is the operator's side of a VM run: shirudo built for thetarget, the test helpers, the upatch fixtures signed with keysgenerated for the bundle, the dm-verity runtime image and the signed-config images. ``testing/vm/build-bundle.sh`` builds the bpf-next+config images. :src:`testing/vm/build-bundle.sh` builds the bpf-nextbundle into ``build/test-vm/host-bundle-bpf-next-verity/`` and keepsthe signing key in``build/test-vm/host-bundle-bpf-next-verity.operator/keys/``.@@ -488,7 +488,7 @@ Run the end-to-end tests------------------------``make -C testing end2end`` runs ``t9001`` on the host, then-``testing/end2end/host.sh`` plays the operator around one VM. It starts+:src:`testing/end2end/host.sh` plays the operator around one VM. It startsan OCI registry and an OpenTelemetry Collector in Docker containers,pinned by digest and behind a throwaway CA. It builds ``kernel-obs``into a package with ``bpm build``, pushes it with ``bpm push`` and@@ -522,11 +522,11 @@ Put a test in the lowest tier that can show the change works:- The family that owns it, as an operator test if it needs no root,kernel or TPM, otherwise as a target test* - A whole delivery path- - ``testing/end2end/``+ - :src:`testing/end2end/`* - A parser of input from outside the host- - A fuzz target in ``testing/fuzz/``, besides the functional test- * - A script in ``.github/scripts/``- - ``testing/ci-checks/``+ - A fuzz target in :src:`testing/fuzz/`, besides the functional test+ * - A script in :src:`.github/scripts/`+ - :src:`testing/ci-checks/`Write a unit test~~~~~~~~~~~~~~~~~@@ -564,7 +564,7 @@ Write a shell test1. Create ``testing/functional/<family>/t<F><K><NN>-<what>.sh`` with thenext free number.-2. Start it from ``testing/`` and source the harness. An operator test+2. Start it from :src:`testing/` and source the harness. An operator testsources ``test-lib.sh``:.. code-block:: sh@@ -625,17 +625,17 @@ Add a fixture or a helper- A target test loads BPF only from signed fixtures. Put the source in``testing/fixtures/<name>.bpf.c`` and add a line``build_fixture <name>.bpf.c <fixture> "$FIXTURE_WORK/trusted"`` to- ``testing/vm/build-bundle.sh``. The bundle signs it on the build host+ :src:`testing/vm/build-bundle.sh`. The bundle signs it on the build hostand the guest finds it as``$SHIRUDO_TEST_FIXTURES_DIR/<fixture>.upatch``.- A compiled helper goes in ``testing/helper/<name>.c`` with a build- rule in ``Makefile.shirudo`` and an entry in ``TEST_HELPERS``. A+ rule in :src:`Makefile.shirudo` and an entry in ``TEST_HELPERS``. Ahelper that a target test runs also goes in the list of helpers that- ``testing/vm/build-bundle.sh`` copies into the bundle. A Python+ :src:`testing/vm/build-bundle.sh` copies into the bundle. A Pythonhelper needs none of this.- A fuzz target goes in ``testing/fuzz/fuzz-<name>.c`` with a seedcorpus in ``testing/fuzz/corpus/<name>/`` and a rule in- ``Makefile.shirudo`` that names the sources it links.+ :src:`Makefile.shirudo` that names the sources it links.Next steps----------diff --git a/Documentation/internals/architecture.rst b/Documentation/internals/architecture.rstindex 68871731..6861200e 100644--- a/Documentation/internals/architecture.rst+++ b/Documentation/internals/architecture.rst@@ -41,8 +41,8 @@ Operator commands that compile, sign or package, ``shirudo build``,``shirudo bpm build``, ``shirudo bpm push``, ``shirudo bpm tree append``,``shirudo image build``, ``shirudo image verify`` and ``shirudo keysvouch``, execute the separate ``shirudo-build`` helper. Only that helper-links the CMS signer (``util/sign.c``) and the package builder and-publisher (``tools/shirudo-build/``). It runs ``clang`` to compile BPF,+links the CMS signer (:src:`util/sign.c`) and the package builder and+publisher (:src:`tools/shirudo-build/`). It runs ``clang`` to compile BPF,libbpf's gen_loader to produce the signed loader, and ``veritysetup`` toformat and check images. The core binary finds it through``SHIRUDO_BUILD``, the compiled-in libexec directory or ``PATH``.@@ -70,8 +70,8 @@ Figure 1 shows the components and the paths between them.Figure 1. Components on the operator host and on a target. Nothingconnects into the target; it pulls packages and pushes telemetry.-The binary embeds three BPF objects, compiled from ``bpf/`` and included-with ``.incbin`` in ``util/loader.c``:+The binary embeds three BPF objects, compiled from :src:`bpf/` and included+with ``.incbin`` in :src:`util/loader.c`:``bpf2``BPF admission (``lsm/bpf``, ``lsm/bpf_map``, ``lsm/bpf_prog_load``),diff --git a/Documentation/internals/boot-flow.rst b/Documentation/internals/boot-flow.rstindex c1dee261..68aa33ff 100644--- a/Documentation/internals/boot-flow.rst+++ b/Documentation/internals/boot-flow.rst@@ -44,7 +44,7 @@ the switch to the root file system. It needs``shirudo init`` with ``KeyringMode=inherit``.``init`` then runs these steps. ``cmd_init()`` and ``run_init()`` in-``builtin-init.c`` are the reference.+:src:`builtin-init.c` are the reference.#. Read the bootstrap settings from the initrd's``/etc/shirudo/shirudo.conf``. ``runtime.image`` anddiff --git a/Documentation/internals/config-images.rst b/Documentation/internals/config-images.rstindex 53af4181..3ecaf27c 100644--- a/Documentation/internals/config-images.rst+++ b/Documentation/internals/config-images.rst@@ -119,7 +119,7 @@ and ``shirudo image verify`` on the operator use ``veritysetup``.Mapping and checking an image------------------------------``util/dm_verity.c`` maps an image through kernel interfaces only:+:src:`util/dm_verity.c` maps an image through kernel interfaces only:#. Attach the data and hash files to loop devices.#. Create a device-mapper device. For a config image, stage the root thediff --git a/Documentation/internals/design-decisions.rst b/Documentation/internals/design-decisions.rstindex b258877a..143b1686 100644--- a/Documentation/internals/design-decisions.rst+++ b/Documentation/internals/design-decisions.rst@@ -183,7 +183,7 @@ owns, and the serializer output.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 full-table drops records without saying so. ``upatches/kernel-obs/obs_table.h``+table drops records without saying so. :src:`upatches/kernel-obs/obs_table.h`is the template. :doc:`/upatches/write/maps-arenas-serializers` explains it.No target shell-outsdiff --git a/Documentation/internals/enforcement.rst b/Documentation/internals/enforcement.rstindex e02dacaa..1e58f00f 100644--- a/Documentation/internals/enforcement.rst+++ b/Documentation/internals/enforcement.rst@@ -34,11 +34,11 @@ and returns an error that the kernel hands back to the caller.Two objects------------The binary embeds two BPF objects. ``bpf2`` (``bpf/bpf2.c``) holds BPF+The binary embeds two BPF objects. ``bpf2`` (:src:`bpf/bpf2.c`) holds BPFadmission and the guards of shirudo's own kernel state. ``seal``-(``bpf/seal.c``) holds the task marks, the process protection and the+(:src:`bpf/seal.c`) holds the task marks, the process protection and thechecks on writable state. Both share the LSM helpers and the verity-device records of ``bpf/lib/``.+device records of :src:`bpf/lib/`.``init`` loads both without a signature, from the binary theauthenticated initrd carries.@@ -181,7 +181,7 @@ Writable stateAttach order-------------``init_lsm()`` in ``builtin-init.c`` brings the enforcement up in this+``init_lsm()`` in :src:`builtin-init.c` brings the enforcement up in thisorder:#. Load ``bpf2``.diff --git a/Documentation/internals/kernel-interfaces.rst b/Documentation/internals/kernel-interfaces.rstindex 373ef292..bd9321b1 100644--- a/Documentation/internals/kernel-interfaces.rst+++ b/Documentation/internals/kernel-interfaces.rst@@ -54,7 +54,7 @@ Kernel baseline- 7.4 cyclebpf-next contains the signed-loader ABI at merge ``0867b7bfa9de``.-``testing/vm/build-kernel.sh`` accepts bpf-next or a release of v7.4 or+:src:`testing/vm/build-kernel.sh` accepts bpf-next or a release of v7.4 orlater. shirudo defines ``KEY_SPEC_DM_VERITY_KEYRING`` (-10) itself whenthe UAPI headers lack it. The ``tpm_command`` LSM hook is notin bpf-next; :doc:`kernel-patches` lists the patches the test kernel@@ -64,7 +64,7 @@ string.Signing ABI check------------------``kernel_abi_check()`` (``util/kernel_abi.c``) reads the running kernel's+``kernel_abi_check()`` (:src:`util/kernel_abi.c`) reads the running kernel'sBTF and requires:.. list-table::@@ -458,7 +458,7 @@ that verify a config; see :doc:`config-images`. ``CONFIG_SECCOMP=n``is handled: the seal then sees no seccomp state. The attach kinds ofupatches can need further options; see :doc:`/upatches/write/attach-kinds`.-``testing/vm/build-kernel.sh`` enforces its own list with+:src:`testing/vm/build-kernel.sh` enforces its own list with``require_config``, which also covers what the test fixtures and the testVM need.diff --git a/Documentation/internals/kernel-patches.rst b/Documentation/internals/kernel-patches.rstindex 4592856d..1aeef241 100644--- a/Documentation/internals/kernel-patches.rst+++ b/Documentation/internals/kernel-patches.rst@@ -8,7 +8,7 @@Carried kernel patches======================-The kernel patches in ``kernel/`` of the shirudo tree. The test kernel+The kernel patches in :src:`kernel/` of the shirudo tree. The test kernelbuild applies them; a production kernel needs the same changes.Summary@@ -40,8 +40,8 @@ How the test kernel applies them--------------------------------``make -C testing kernel`` passes ``KERNEL_PATCHES``, which defaults to-``kernel/`` when that directory holds patches.-``testing/vm/build-kernel.sh`` applies each patch in name order with+:src:`kernel/` when that directory holds patches.+:src:`testing/vm/build-kernel.sh` applies each patch in name order with``git apply --index`` and commits it, and skips a patch whose reversealready applies. A patch that applies neither way fails the build.diff --git a/Documentation/internals/measurement-register.rst b/Documentation/internals/measurement-register.rstindex d1a5ab93..12f4ad4d 100644--- a/Documentation/internals/measurement-register.rst+++ b/Documentation/internals/measurement-register.rst@@ -13,8 +13,8 @@ that root on the target cannot rewrite or append to, and the TPM signsthat register on request. This page explains the register, its writepolicy and binding, the events and the eventlog, the evidence, what theoperator's verifier computes, the separate config PCR, and the limits.-``util/chain.c``, ``util/tpm.c``, ``util/tpm_wire.c``,-``util/eventlog.c`` and ``util/attest.c`` are the reference.+:src:`util/chain.c`, :src:`util/tpm.c`, :src:`util/tpm_wire.c`,+:src:`util/eventlog.c` and :src:`util/attest.c` are the reference.Problem-------@@ -46,7 +46,7 @@ Register--------The register is NV index ``0x01818E00`` (``NV_INDEX`` in-``util/paths.h``, which a build may change), holding one SHA-256+:src:`util/paths.h`, which a build may change), holding one SHA-256digest. Its attributes are ``0x0E060048``:- ``TPM2_NT_EXTEND``: a write of ``d`` sets the index todiff --git a/Documentation/internals/signed-loader.rst b/Documentation/internals/signed-loader.rstindex af724500..5ef12415 100644--- a/Documentation/internals/signed-loader.rst+++ b/Documentation/internals/signed-loader.rst@@ -227,7 +227,7 @@ LimitsThe unload directive authorizes the detach, but it does not perform it.The detach runs in userspace because ``bpf_sys_bpf()`` offers no detach-or unpin command; ``bpf/unload.c`` is a placeholder for the in-kernel+or unpin command; :src:`bpf/unload.c` is a placeholder for the in-kernelversion. An unload directive is bound to the upatch name and payloaddigest, not to the key that signed the load.diff --git a/Documentation/operate/deploy/boot-integration.rst b/Documentation/operate/deploy/boot-integration.rstindex 9f2ef4cd..9ad24953 100644--- a/Documentation/operate/deploy/boot-integration.rst+++ b/Documentation/operate/deploy/boot-integration.rst@@ -33,7 +33,7 @@ Before you beginhost. The operator package installs the image generators in``/usr/libexec/shirudo/gen-image/`` and the helper in``/usr/libexec/shirudo/shirudo-build``. In a checkout they are- ``tools/gen-image/`` and ``tools/shirudo-build/shirudo-build``.+ :src:`tools/gen-image/` and ``tools/shirudo-build/shirudo-build``.- The static target binary of the build you deploy: ``shirudo-target``from ``make target`` in a checkout, or ``/usr/bin/shirudo`` from thetarget package. Use the same build on the target and in the runtimediff --git a/Documentation/operate/maintain/upgrade.rst b/Documentation/operate/maintain/upgrade.rstindex a0dc4cb1..28b80566 100644--- a/Documentation/operate/maintain/upgrade.rst+++ b/Documentation/operate/maintain/upgrade.rst@@ -66,8 +66,8 @@ it after the release:The build computes the ID as a SHA-256 over the source revision, a``-dirty`` mark when the tree has uncommitted changes, and a digest of-``config.mk`` and ``Makefile.shirudo``. The revision comes from git, or-from the ``VERSION`` file outside a git checkout. ``config.mk`` records+``config.mk`` and :src:`Makefile.shirudo`. The revision comes from git, or+from the :src:`VERSION` file outside a git checkout. ``config.mk`` recordsthe library flags of the build host, so two builds of one commit ondifferent hosts get different IDs, and an operator package built onanother host than the target package carries another ID. The ID does notdiff --git a/Documentation/operate/plan/overhead.rst b/Documentation/operate/plan/overhead.rstindex ab3bb318..0f5b2cd6 100644--- a/Documentation/operate/plan/overhead.rst+++ b/Documentation/operate/plan/overhead.rst@@ -477,7 +477,7 @@ records in an arena.kernel-obs example~~~~~~~~~~~~~~~~~~-The observability package in ``upatches/kernel-obs`` is one example,+The observability package in :src:`upatches/kernel-obs` is one example,measured in the same test VM:.. list-table::diff --git a/Documentation/operate/plan/system-requirements.rst b/Documentation/operate/plan/system-requirements.rstindex cbcf10ca..5fe450de 100644--- a/Documentation/operate/plan/system-requirements.rst+++ b/Documentation/operate/plan/system-requirements.rst@@ -66,14 +66,14 @@ Kernel sourceenrolls and seals the config certificate in the ``.dm-verity``keyring through ``KEY_SPEC_DM_VERITY_KEYRING``. Apply it to abpf-next tree that predates it.- * - ``kernel/0001-x86-ftrace-Mark-jmp-mode-by-clearing-bit-63-of-the-trampoline-address.patch``+ * - :src:`kernel/0001-x86-ftrace-Mark-jmp-mode-by-clearing-bit-63-of-the-trampoline-address.patch`- x86-64 only. Without it, detaching one BPF program from a hookthat others share can crash tasks that run the hook during theupdate, on kernels where an ftrace callback starts at an oddaddress (seen with gcc 13 and ``CONFIG_CC_OPTIMIZE_FOR_SIZE=y``).Unloading an upatch detaches its programs from hooks that otherprograms share.- * - ``kernel/0002-tpm-Let-LSMs-inspect-userspace-commands.patch``+ * - :src:`kernel/0002-tpm-Let-LSMs-inspect-userspace-commands.patch`- Adds the ``tpm_command`` LSM hook. ``shirudo init`` attaches``lsm/tpm_command`` to refuse an untrusted ``TPM2_NV_Extend`` ofits register and fails without the hook.@@ -94,13 +94,13 @@ Identify the kernelwithout it fails with ``kernel_abi_unsupported``.- The test harness builds bpf-next by default. It also builds releasetags and refuses any tag older than v7.4. It applies the patches in- ``kernel/`` to either. A release kernel still needs ``kernel/0002``.+ :src:`kernel/` to either. A release kernel still needs ``kernel/0002``.Kernel configuration~~~~~~~~~~~~~~~~~~~~shirudo needs every option below. The test kernel's configuration is the-slim configuration in ``testing/vm/build-kernel.sh``, which also enables+slim configuration in :src:`testing/vm/build-kernel.sh`, which also enablesoptions that only the tests use... list-table::diff --git a/Documentation/operate/run/deliver-packages.rst b/Documentation/operate/run/deliver-packages.rstindex 03387ddf..e99ba9c9 100644--- a/Documentation/operate/run/deliver-packages.rst+++ b/Documentation/operate/run/deliver-packages.rst@@ -187,7 +187,7 @@ while it runs.existing file. ``<config-keys-dir>`` holds the key whose certificatethe runtime image names in ``config.verification_key``. The path isthe operator package's. From a checkout, run- ``tools/gen-image/shirudo-gen-image`` and add ``--builder`` with the+ :src:`tools/gen-image/shirudo-gen-image` and add ``--builder`` with thepath of ``shirudo-build``.#. Verify the bundle offline:diff --git a/Documentation/operate/run/read-status.rst b/Documentation/operate/run/read-status.rstindex 36a9f517..91f239cf 100644--- a/Documentation/operate/run/read-status.rst+++ b/Documentation/operate/run/read-status.rst@@ -308,7 +308,7 @@ Assets``eventlog``Whether ``/var/lib/shirudo/eventlog`` exists, and its size.-``upatches/``+:src:`upatches/`The number of archived upatches that ``init`` restores at the nextboot.diff --git a/Documentation/reference/cli/version.rst b/Documentation/reference/cli/version.rstindex 3effe74b..6368dbcd 100644--- a/Documentation/reference/cli/version.rst+++ b/Documentation/reference/cli/version.rst@@ -29,10 +29,10 @@ Without an option, ``version`` prints two lines::shirudo (<describe><extraversion>, "<release-name>")version-id: <version-id>-``<describe>`` is ``git describe`` of the build tree, or the ``VERSION``+``<describe>`` is ``git describe`` of the build tree, or the :src:`VERSION`file outside a git checkout. ``<version-id>`` is a SHA-256 over the gitcommit, a dirty-tree flag and a digest of the build configuration-(``config.mk`` and ``Makefile.shirudo``). Two builds of one commit with+(``config.mk`` and :src:`Makefile.shirudo`). Two builds of one commit withdifferent build configurations therefore have different ids, forexample an operator package and a target package built on differenthosts.diff --git a/Documentation/reference/environment.rst b/Documentation/reference/environment.rstindex 57d08111..2a768dfd 100644--- a/Documentation/reference/environment.rst+++ b/Documentation/reference/environment.rst@@ -233,17 +233,17 @@ Generator and installer scripts- Key directory when ``--keys-dir`` is not given. Default``/var/lib/shirudo/keys``.* - ``SHIRUDO_REPO``- - ``tools/gen-initrd/install.sh``+ - :src:`tools/gen-initrd/install.sh`- GitHub repository releases are fetched from. Default``shirudo-dev/shirudo``.* - ``SHIRUDO_CERT``- - ``tools/gen-initrd/install.sh``+ - :src:`tools/gen-initrd/install.sh`- Same as ``--cert``.* - ``SHIRUDO_VERSION``- - ``tools/gen-initrd/install.sh``+ - :src:`tools/gen-initrd/install.sh`- Same as ``--version``.* - ``SHIRUDO_PACKAGE``- - ``tools/gen-initrd/install.sh``+ - :src:`tools/gen-initrd/install.sh`- Same as ``--package``.* - ``DESTDIR``- ``install.sh`` of the target tarballdiff --git a/Documentation/reference/formats/bpm-formats.rst b/Documentation/reference/formats/bpm-formats.rstindex b0738561..e34fef9f 100644--- a/Documentation/reference/formats/bpm-formats.rst+++ b/Documentation/reference/formats/bpm-formats.rst@@ -131,7 +131,7 @@ uid and gid 0 and mtime 0.reserved and cannot be ``[[files]]`` or upatch targets.:doc:`/upatches/publish/beefile` describes the Beefile.-On install the target loads every regular file in ``upatches/`` whose name+On install the target loads every regular file in :src:`upatches/` whose namecontains ``.upatch`` and not ``.unload.upatch``, in name order. Uninstalland upgrade apply the package's ``*.unload.upatch`` files in reverse nameorder.diff --git a/Documentation/reference/formats/upatch-format.rst b/Documentation/reference/formats/upatch-format.rstindex 7c7af4b6..5f462350 100644--- a/Documentation/reference/formats/upatch-format.rst+++ b/Documentation/reference/formats/upatch-format.rst@@ -12,8 +12,8 @@ A ``.upatch`` file is the signed container that :doc:`/reference/cli/build`writes and that :doc:`/reference/cli/upatch-load` and:doc:`/reference/cli/upatch-unload` consume. One layout serves both a loadartifact and an unload directive. The structures are defined in-``include/shirudo/upatch.h``. The writer is ``tools/shirudo-build/package.c``-and the reader is ``util/upatch.c``.+:src:`include/shirudo/upatch.h`. The writer is :src:`tools/shirudo-build/package.c`+and the reader is :src:`util/upatch.c`.Conventions-----------@@ -566,7 +566,7 @@ Each decoder entry:- Length of the source, non-zero.The writer takes each entry from a ``struct decoder_manifest`` that-the BPF program declares in ``.rodata`` (``bpf/lib/decoder.h``,+the BPF program declares in ``.rodata`` (:src:`bpf/lib/decoder.h`,192 bytes, magic ``0x44434544``, the bytes ``DECD``, ``u16`` fields``version``, ``language``, ``api_version``, ``input_format``,``export_signal`` and ``reserved``, then the same four strings). It scans@@ -623,7 +623,7 @@ signed bytes and trusts others as they are.Reader validation------------------``util/upatch.c`` applies these checks in order. Any failure rejects the+:src:`util/upatch.c` applies these checks in order. Any failure rejects thefile.#. The file is a regular file, not empty and at most 16 MiB.diff --git a/Documentation/reference/versions.rst b/Documentation/reference/versions.rstindex 4ce85c3b..be86e942 100644--- a/Documentation/reference/versions.rst+++ b/Documentation/reference/versions.rst@@ -38,7 +38,7 @@ Version string- Source* - ``<describe>``- ``git describe --tags --always --dirty`` of the build tree, or- the content of the ``VERSION`` file, ``0.0.0-dev``, outside a git+ the content of the :src:`VERSION` file, ``0.0.0-dev``, outside a gitcheckout. Without tags, describe prints the abbreviated commit,with ``-dirty`` for uncommitted changes.* - ``<extraversion>``@@ -46,7 +46,7 @@ Version string* - ``<release-name>``- ``NAME`` in the top-level ``Makefile``.-The package versions in ``packaging/Makefile`` derive from the same+The package versions in :src:`packaging/Makefile` derive from the samedescribe string. ``<describe>`` alone, without ``<extraversion>``,appears as ``service.version`` and the scope version in OTLP documents(:doc:`/reference/formats/otlp`) and as ``bpm_version`` and@@ -56,7 +56,7 @@ Version ID----------``SHIRUDO_VERSION_ID`` is the SHA-256 that the build writes into the-generated ``util/version_id.c`` (``Makefile.shirudo``). Its input:+generated ``util/version_id.c`` (:src:`Makefile.shirudo`). Its input:.. list-table:::header-rows: 1@@ -65,28 +65,28 @@ generated ``util/version_id.c`` (``Makefile.shirudo``). Its input:* - Input- Value* - Revision- - ``git rev-parse HEAD``, or the content of ``VERSION`` outside a+ - ``git rev-parse HEAD``, or the content of :src:`VERSION` outside agit checkout.* - Dirty mark- ``-dirty`` when ``git diff-index HEAD`` reports a change to atracked file. Untracked files do not count.* - Build configuration- The first 16 hexadecimal digits of a SHA-256 over the checksums of- ``config.mk`` and ``Makefile.shirudo``.+ ``config.mk`` and :src:`Makefile.shirudo`.``config.mk`` is the operator profile's configuration, which the-feature probes in ``Makefile.config`` write. It records the compiler and+feature probes in :src:`Makefile.config` write. It records the compiler andlinker flags of the libraries on the build host, with their paths. Thetarget profile writes its configuration to ``config-target.mk``, whichthe ID does not cover: a target binary's ID takes the ``config.mk`` of-the tree it was built in, or ``Makefile.shirudo`` alone in a tree+the tree it was built in, or :src:`Makefile.shirudo` alone in a treewithout one, as after ``make clean`` and ``make target``.Two builds of one commit therefore get different IDs when their treeshold different ``config.mk`` files, for example an operator packagebuilt on its distribution and a target package built on another host.``make`` and ``make target`` in one tree give both binaries the same ID.-Outside a git checkout, every build of the same ``VERSION`` with the+Outside a git checkout, every build of the same :src:`VERSION` with thesame ``config.mk`` gets the same ID.The ID does not cover the compiler and its version, the contents of thediff --git a/Documentation/security/reporting.rst b/Documentation/security/reporting.rstindex 94235400..cf282139 100644--- a/Documentation/security/reporting.rst+++ b/Documentation/security/reporting.rst@@ -48,7 +48,7 @@ PolicyThe repository's `security policy<https://github.com/shirudo-dev/shirudo/blob/main/SECURITY.md>`__,-``SECURITY.md``, is the policy of record. It says:+:src:`SECURITY.md`, is the policy of record. It says:- Do not report a vulnerability in a public issue or discussion. UseGitHub's Report a vulnerability feature instead.diff --git a/Documentation/security/tamper-counters.rst b/Documentation/security/tamper-counters.rstindex b487e042..71d9774e 100644--- a/Documentation/security/tamper-counters.rst+++ b/Documentation/security/tamper-counters.rst@@ -19,7 +19,7 @@ Counters--------The name and the meaning are what ``shirudo status`` prints. The hooks-are the section names of the BPF programs in ``bpf/`` that move the+are the section names of the BPF programs in :src:`bpf/` that move thecounter... list-table::diff --git a/Documentation/security/threat-model.rst b/Documentation/security/threat-model.rstindex b2ab0389..69ec450a 100644--- a/Documentation/security/threat-model.rst+++ b/Documentation/security/threat-model.rst@@ -52,11 +52,11 @@ The fields of the box are:- Adversary: who mounts the threat- Enforced at: the BPF LSM programs that refuse it, by their section- name in ``bpf/``+ name in :src:`bpf/`- Refusal: what the caller sees- Counters: the tamper counters the refusal moves, described in:doc:`tamper-counters`-- Tests: the target tests under ``testing/functional/`` that exercise+- Tests: the target tests under :src:`testing/functional/` that exercisethe refusal- Residual: the residual risks and threats to resolve that bound it@@ -149,7 +149,7 @@ without the protection.- The kernel has the signed-loader ABI of the bpf-next tree shirudotargets and the ``tpm_command`` LSM hook. Upstream has no suchhook, and shirudo carries it as- ``kernel/0002-tpm-Let-LSMs-inspect-userspace-commands.patch``.+ :src:`kernel/0002-tpm-Let-LSMs-inspect-userspace-commands.patch`.- T1 needs the ABI, T5 the hook.- Yes. The pre-flight check ``signed_loader_kernel_abi`` tests theABI. Without the hook the ``bpf2`` object does not load and@@ -631,7 +631,7 @@ neither permissions nor ownership stop root. A changed archive would berestored at the next boot, a truncated eventlog would make the registerunexplainable, and a planted file would be taken for shirudo's own.-The seal (``bpf/seal.c``) marks shirudo's inodes with the extended+The seal (:src:`bpf/seal.c`) marks shirudo's inodes with the extendedattribute ``security.bpf.shirudo`` and checks every operation on amarked inode against the caller's authority. ``init``labels the existing tree on the run that brings enforcement up, before@@ -1528,7 +1528,7 @@ U7 The shipped timer units run the host binaryreading, not reproduced.:Meanwhile: Install a drop-in for each of these services thatstarts its commands from the runtime image, as the test VM does- in ``testing/vm/guest.sh``.+ in :src:`testing/vm/guest.sh`.U8 The TPM transport is not authenticated:Affects: The register (T5) and the device check (T14).@@ -1705,7 +1705,7 @@ D4 Signed PCR policiesD5 In-kernel detachDetach and unpin from the signed unload directive in kernel context,- which ``bpf/unload.c`` holds a placeholder for, once ``bpf_sys_bpf()``+ which :src:`bpf/unload.c` holds a placeholder for, once ``bpf_sys_bpf()``supports it (R1).D6 A sleepable hook at dentry instantiationdiff --git a/Documentation/start/guides/first-upatch.rst b/Documentation/start/guides/first-upatch.rstindex 84145dce..df58dcc0 100644--- a/Documentation/start/guides/first-upatch.rst+++ b/Documentation/start/guides/first-upatch.rst@@ -89,7 +89,7 @@ Build and sign itwrote build/tutorial/sleep-count.upatch (insns=1184 sig=4853 data=3024 sections=2 maps=1 progs=1 decoders=0 name=sleep-count)Run from the checkout root, the helper finds the libbpf headers in- ``vendor/libbpf`` and the kernel types in ``vendor/linux/vmlinux.h``.+ :src:`vendor/libbpf` and the kernel types in ``vendor/linux/vmlinux.h``.The upatch takes its name, ``sleep-count``, from the file name, and itcarries one map and one program. The sizes and digests on this pagedepend on your toolchain and paths.diff --git a/Documentation/start/guides/publish-package.rst b/Documentation/start/guides/publish-package.rstindex 50c1cff0..70865489 100644--- a/Documentation/start/guides/publish-package.rst+++ b/Documentation/start/guides/publish-package.rst@@ -63,7 +63,7 @@ Build the packageoperator$ ln -s "$PWD/vendor" ~/hello/vendorThe helper compiles in the package directory and looks for the libbpf- headers and ``vmlinux.h`` under ``vendor/`` there. An installed operator+ headers and ``vmlinux.h`` under :src:`vendor/` there. An installed operatorpackage uses its own copies under ``/usr/share/shirudo`` and needs nolink.diff --git a/Documentation/start/quickstart.rst b/Documentation/start/quickstart.rstindex f39d5026..def7a7cd 100644--- a/Documentation/start/quickstart.rst+++ b/Documentation/start/quickstart.rst@@ -89,7 +89,7 @@ Boot a test target[test-vm] ssh: make -C testing vm-sshThe first run takes a while. It builds a bpf-next kernel with the- patches under ``kernel/``, an Ubuntu disk image and a bundle: the static+ patches under :src:`kernel/`, an Ubuntu disk image and a bundle: the statictarget binary, a dm-verity runtime image, signed config images and athrowaway signing key. Later runs reuse them.@@ -249,7 +249,7 @@ VM enrolled its certificate. You sign with that key on the host.operator$ KEYS=$PWD/build/test-vm/host-bundle-bpf-next-verity.operator/keys2. Look at the upatch you are going to sign,- ``testing/fixtures/basic.bpf.c``:+ :src:`testing/fixtures/basic.bpf.c`:.. code-block:: cdiff --git a/Documentation/upatches/learn/examples.rst b/Documentation/upatches/learn/examples.rstindex 5a979410..2e4a594f 100644--- a/Documentation/upatches/learn/examples.rst+++ b/Documentation/upatches/learn/examples.rst@@ -8,7 +8,7 @@Example packages================-The tree ships two packages under ``upatches/``: ``kernel-obs``, a+The tree ships two packages under :src:`upatches/`: ``kernel-obs``, acomplete observability package with arena tables, serializers, decodersand generated ``.rodata``, and ``kernel-cve``, a set of small CVEdetectors exported from a mitigation campaign.@@ -23,7 +23,7 @@ kernel-obs* - Item- Content* - Package- - ``kernel-obs``, from ``upatches/kernel-obs/Beefile``+ - ``kernel-obs``, from :src:`upatches/kernel-obs/Beefile`* - upatch- ``kernel-obs``, built from ``kernel-obs.bpf.c``, which includes``obs_exec.bpf.c``, ``obs_net.bpf.c``, ``obs_dns.bpf.c``,@@ -65,7 +65,7 @@ repositories from its signed config image and refuses local key changes.kernel-cve-----------``upatches/kernel-cve/`` holds three detectors, each in+:src:`upatches/kernel-cve/` holds three detectors, each in``sources/<slug>/observability/``, a ``vmlinux.h``, ``manifest.json``with one record per detector, and the Beefile ``kernel-cve.bee``. Themanifest names the kernel the detectors were loaded on,diff --git a/Documentation/upatches/learn/kernel-fix-tutorial.rst b/Documentation/upatches/learn/kernel-fix-tutorial.rstindex e896f5f7..829e0699 100644--- a/Documentation/upatches/learn/kernel-fix-tutorial.rst+++ b/Documentation/upatches/learn/kernel-fix-tutorial.rst@@ -11,7 +11,7 @@ From a kernel fix to an upatchThis tutorial takes one kernel fix to a signed upatch, loads it on a testtarget, unloads it again, and packages it for a registry. The example isCVE-2026-63984, an overflow in the IPv6 RPL routing header code, whose-detector ships in ``upatches/kernel-cve/sources/``. You read the fix,+detector ships in :src:`upatches/kernel-cve/sources/`. You read the fix,decide where the upatch attaches, write the program, then build, inspect,test, unload, package and publish it.diff --git a/Documentation/upatches/publish/beefile.rst b/Documentation/upatches/publish/beefile.rstindex 5e37aa24..e1737978 100644--- a/Documentation/upatches/publish/beefile.rst+++ b/Documentation/upatches/publish/beefile.rst@@ -137,8 +137,8 @@ from the artifact's payload digest, so a package always ships both.- The member path of the unload directive. Default:``upatches/<base>.unload.upatch``.-Keep both targets directly under ``upatches/``. On a target, ``bpm-install`` loads every file in the package's ``upatches/`` directory whose+Keep both targets directly under :src:`upatches/`. On a target, ``bpm+install`` loads every file in the package's :src:`upatches/` directory whosename contains ``.upatch`` but not ``.unload.upatch``, in name order, and``bpm uninstall`` applies every ``upatches/*.unload.upatch`` in reversename order. ``bpm upgrade`` applies the old version's unload directives@@ -340,13 +340,13 @@ fails the build with ``bpm build: File name too long``.Example--------``upatches/kernel-obs/Beefile`` declares one upatch with generated+:src:`upatches/kernel-obs/Beefile` declares one upatch with generated``.rodata`` and ships its generators:.. literalinclude:: ../../../upatches/kernel-obs/Beefile:language: toml-``upatches/kernel-cve/kernel-cve.bee`` breaks these rules and is not a+:src:`upatches/kernel-cve/kernel-cve.bee` breaks these rules and is not amodel. Two of its load targets make member paths longer than 99 byteswith any version, so ``bpm build`` fails. Its tree ids name the CVEdirectories while its upatch names are the detectors' base names, sodiff --git a/Documentation/upatches/test/testing.rst b/Documentation/upatches/test/testing.rstindex 4a75cda7..ee64be3a 100644--- a/Documentation/upatches/test/testing.rst+++ b/Documentation/upatches/test/testing.rst@@ -168,7 +168,7 @@ Use the signed fixturesThe bundle carries upatches signed with the same key, in the VM at``/mnt/shirudo-bundle/fixtures/``, those below with an ``.unload.upatch``-beside them. Their sources are in ``testing/fixtures/``. They are handy for+beside them. Their sources are in :src:`testing/fixtures/`. They are handy fortrying the commands above or for comparing your upatch with a known goodone.diff --git a/Documentation/upatches/write/decoders.rst b/Documentation/upatches/write/decoders.rstindex 745326f7..454f3e20 100644--- a/Documentation/upatches/write/decoders.rst+++ b/Documentation/upatches/write/decoders.rst@@ -265,5 +265,5 @@ Next steps- :doc:`/operate/run/telemetry` to export every map on a schedule- :doc:`/reference/formats/otlp` for the documents on the wire-- The decoders under ``upatches/kernel-obs/decoders/`` for complete log+- The decoders under :src:`upatches/kernel-obs/decoders/` for complete logdecoders over arena tables, timestamps includeddiff --git a/Documentation/upatches/write/maps-arenas-serializers.rst b/Documentation/upatches/write/maps-arenas-serializers.rstindex 19da849e..bb6b85b8 100644--- a/Documentation/upatches/write/maps-arenas-serializers.rst+++ b/Documentation/upatches/write/maps-arenas-serializers.rst@@ -59,7 +59,7 @@ lists the conditions.obs_table.h template---------------------``upatches/kernel-obs/obs_table.h`` is the template for such a table. A+:src:`upatches/kernel-obs/obs_table.h` is the template for such a table. Asource defines the table's name, key and value types, capacity, bucketcount, record size and record encoder, and includes the file once pertable. Each inclusion produces a hash table in the arena and a serializer@@ -108,7 +108,7 @@ Serializer interfaceA serializer is a ``SEC("syscall")`` program named``shirudo_serialize__<map>``. It writes into ``shirudo_ser``, an array mapwith a ``__u32`` key and ``struct serial_chunk`` values that the-upatch defines with 1 to 256 entries. ``bpf/lib/serializer.h``+upatch defines with 1 to 256 entries. :src:`bpf/lib/serializer.h`holds the definitions. The builder refuses a serializer that is not in``SEC("syscall")``, targets a map that does not exist or is``shirudo_ser`` itself, or duplicates another one, and refuses an upatch