Skip to content

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.py
index 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.rst
index 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.rst
index eb145f42..b560abe1 100644
--- a/Documentation/concepts/background/luajit.rst
+++ b/Documentation/concepts/background/luajit.rst
@@ -66,7 +66,7 @@ How a decoder reaches the target
The 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, the
input format (``1``), the signal to export (``1`` for a log, ``2`` for a
metric), the upatch and map it decodes, the Lua source file relative to
diff --git a/Documentation/concepts/background/tpm.rst b/Documentation/concepts/background/tpm.rst
index 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 requires
the 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-256
digest 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 the
writer key derives from are not a secret, so any process that recreates
the key could ask the TPM to sign. An LSM hook in the kernel keeps
them 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 an
LSM 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.rst
index 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 accumulates
records keeps them in one arena, which its serializer reads as one
consistent 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 a
double-buffered arena table. See
:doc:`/upatches/write/maps-arenas-serializers`.
@@ -126,8 +126,8 @@ it.
enforcement programs
The 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 the
task marks). ``init`` loads them before their admission gates
attach, so they are the one BPF code that does not pass the signed
loader 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's
writable 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 keep
diff --git a/Documentation/concepts/upatches-and-packages.rst b/Documentation/concepts/upatches-and-packages.rst
index 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.rst
index 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 without
booting
- - 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 arm64
runner.
-- 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 a
TPM.
- Build the target binary and the packages for arm64 and riscv64 in CI.
- Check that every library the target links builds and runs on
diff --git a/Documentation/contribute/code/contributing.rst b/Documentation/contribute/code/contributing.rst
index 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 the
reference 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 to
Commit messages
@@ -138,7 +138,7 @@ chain of ``Signed-off-by:`` lines records the real route the change
took. The first sign-off is the author's. The last is the person who
submits 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 except
merge 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 an
error. 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`` for
everything compiled into a BPF object, the headers it includes and
diff --git a/Documentation/contribute/code/develop-locally.rst b/Documentation/contribute/code/develop-locally.rst
index 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 operator
package 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 boot
integration, replace the VM:
.. code-block:: console
diff --git a/Documentation/contribute/code/developer-guide.rst b/Documentation/contribute/code/developer-guide.rst
index 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 on
its Ubuntu runners because clang 18 lacks the BPF address-space casts
that 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.5
The build probe's hint names Ubuntu 26.04 and Fedora 43 as the first
releases that ship OpenSSL 3.5. Ubuntu 24.04 ships 3.0. On an older
distribution, 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 BTF
The BPF objects that shirudo embeds compile against
``vendor/linux/vmlinux.h``. ``shirudo build`` run in the checkout root
uses 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 never
commits it. The embedded
admission 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 version
The 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 make
variables change it:
@@ -235,7 +235,7 @@ path, which takes precedence over ``PATH``.
``bpm build`` compiles with the package directory as its working
directory. To build a package with a checkout's ``vmlinux.h`` and BPF
headers, 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 UAPI
headers. No kernel tree is needed to build. Refresh the copy only when
a 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` is
linked into ``shirudo-build`` only.
- * - ``bpf/``
+ * - :src:`bpf/`
- The embedded BPF programs: ``bpf2.c`` (admission, mount, image
and device guards), ``seal.c`` (the seal) and ``unload.c`` (the
signed unload directive).
- * - ``bpf/lib/``
+ * - :src:`bpf/lib/`
- The headers more than one BPF program includes: the LSM helpers
and 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 definitions
shared 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``, each
with 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 and
their 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, the
target dependency build and version discovery.
* - ``build/``, ``artifacts/``
@@ -406,7 +406,7 @@ Project layout
Run the CI checks locally
-------------------------
-CI runs these scripts from ``.github/scripts/``. Each takes the
+CI runs these scripts from :src:`.github/scripts/`. Each takes the
arguments of ``git rev-list``, such as ``origin/main..HEAD``, and checks
the 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 much
space 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``, or
one 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.rst
index 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, by
area and by threat, and what no test covers. A test is named by its
number here, and by its file name without ``.sh`` in the family
tables. :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 other
modules are reached through the test helpers, the fuzz targets and the
binaries 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 procedures
failure 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 its
option lists by hand, and no test compares them with the options the
commands accept.
@@ -800,9 +800,9 @@ Platforms
Parsers 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 no
fuzz 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.rst
index 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 packages
it 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 tiers
family
- ``make -C testing functional``
* - End-to-end
- - ``testing/end2end/``
+ - :src:`testing/end2end/`
- Around one VM, with a registry and a collector in containers on
the 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 path
A 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/` that
is not a test does not take a name of this form. A target test can have
a 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 the
VMs 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 and
uses the binaries in the checkout root, so build them first:
.. code-block:: console
@@ -194,7 +194,7 @@ Read the results
Every 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 the
number 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/`. It
writes the kernel image, ``vmlinux.btf``, ``kernel.config``, packages
and 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 newer
than the stamp, so a checkout or rebase that touches either rebuilds
it 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 the
artifact directory first, so do not run it while a VM run or a build
reads ``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 bundle
The bundle is the operator's side of a VM run: shirudo built for the
target, the test helpers, the upatch fixtures signed with keys
generated 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-next
bundle into ``build/test-vm/host-bundle-bpf-next-verity/`` and keeps
the 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 starts
an 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 test
1. Create ``testing/functional/<family>/t<F><K><NN>-<what>.sh`` with the
next 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 test
sources ``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 host
and 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``. A
helper 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 Python
helper needs none of this.
- A fuzz target goes in ``testing/fuzz/fuzz-<name>.c`` with a seed
corpus 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.rst
index 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 keys
vouch``, 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`` to
format 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. Nothing
connects 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.rst
index 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`` and
diff --git a/Documentation/internals/config-images.rst b/Documentation/internals/config-images.rst
index 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 the
diff --git a/Documentation/internals/design-decisions.rst b/Documentation/internals/design-decisions.rst
index 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 reset
between exports, and an overflow count the exported record carries. An
element-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-outs
diff --git a/Documentation/internals/enforcement.rst b/Documentation/internals/enforcement.rst
index 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 BPF
admission 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 the
checks 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 the
authenticated initrd carries.
@@ -181,7 +181,7 @@ Writable state
Attach 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 this
order:
#. Load ``bpf2``.
diff --git a/Documentation/internals/kernel-interfaces.rst b/Documentation/internals/kernel-interfaces.rst
index 373ef292..bd9321b1 100644
--- a/Documentation/internals/kernel-interfaces.rst
+++ b/Documentation/internals/kernel-interfaces.rst
@@ -54,7 +54,7 @@ Kernel baseline
- 7.4 cycle
bpf-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 or
later. shirudo defines ``KEY_SPEC_DM_VERITY_KEYRING`` (-10) itself when
the UAPI headers lack it. The ``tpm_command`` LSM hook is not
in 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's
BTF 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 of
upatches 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 test
VM need.
diff --git a/Documentation/internals/kernel-patches.rst b/Documentation/internals/kernel-patches.rst
index 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 kernel
build 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 reverse
already applies. A patch that applies neither way fails the build.
diff --git a/Documentation/internals/measurement-register.rst b/Documentation/internals/measurement-register.rst
index 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 signs
that register on request. This page explains the register, its write
policy and binding, the events and the eventlog, the evidence, what the
operator'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-256
digest. Its attributes are ``0x0E060048``:
- ``TPM2_NT_EXTEND``: a write of ``d`` sets the index to
diff --git a/Documentation/internals/signed-loader.rst b/Documentation/internals/signed-loader.rst
index af724500..5ef12415 100644
--- a/Documentation/internals/signed-loader.rst
+++ b/Documentation/internals/signed-loader.rst
@@ -227,7 +227,7 @@ Limits
The 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-kernel
version. An unload directive is bound to the upatch name and payload
digest, not to the key that signed the load.
diff --git a/Documentation/operate/deploy/boot-integration.rst b/Documentation/operate/deploy/boot-integration.rst
index 9f2ef4cd..9ad24953 100644
--- a/Documentation/operate/deploy/boot-integration.rst
+++ b/Documentation/operate/deploy/boot-integration.rst
@@ -33,7 +33,7 @@ Before you begin
host. 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 the
target package. Use the same build on the target and in the runtime
diff --git a/Documentation/operate/maintain/upgrade.rst b/Documentation/operate/maintain/upgrade.rst
index 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`` records
the library flags of the build host, so two builds of one commit on
different hosts get different IDs, and an operator package built on
another host than the target package carries another ID. The ID does not
diff --git a/Documentation/operate/plan/overhead.rst b/Documentation/operate/plan/overhead.rst
index 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.rst
index cbcf10ca..5fe450de 100644
--- a/Documentation/operate/plan/system-requirements.rst
+++ b/Documentation/operate/plan/system-requirements.rst
@@ -66,14 +66,14 @@ Kernel source
enrolls and seals the config certificate in the ``.dm-verity``
keyring through ``KEY_SPEC_DM_VERITY_KEYRING``. Apply it to a
bpf-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 hook
that others share can crash tasks that run the hook during the
update, on kernels where an ftrace callback starts at an odd
address (seen with gcc 13 and ``CONFIG_CC_OPTIMIZE_FOR_SIZE=y``).
Unloading an upatch detaches its programs from hooks that other
programs 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`` of
its register and fails without the hook.
@@ -94,13 +94,13 @@ Identify the kernel
without it fails with ``kernel_abi_unsupported``.
- The test harness builds bpf-next by default. It also builds release
tags 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 enables
options that only the tests use.
.. list-table::
diff --git a/Documentation/operate/run/deliver-packages.rst b/Documentation/operate/run/deliver-packages.rst
index 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 certificate
the runtime image names in ``config.verification_key``. The path is
the 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 the
path of ``shirudo-build``.
#. Verify the bundle offline:
diff --git a/Documentation/operate/run/read-status.rst b/Documentation/operate/run/read-status.rst
index 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 next
boot.
diff --git a/Documentation/reference/cli/version.rst b/Documentation/reference/cli/version.rst
index 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 git
commit, 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 with
different build configurations therefore have different ids, for
example an operator package and a target package built on different
hosts.
diff --git a/Documentation/reference/environment.rst b/Documentation/reference/environment.rst
index 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 tarball
diff --git a/Documentation/reference/formats/bpm-formats.rst b/Documentation/reference/formats/bpm-formats.rst
index 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 name
contains ``.upatch`` and not ``.unload.upatch``, in name order. Uninstall
and upgrade apply the package's ``*.unload.upatch`` files in reverse name
order.
diff --git a/Documentation/reference/formats/upatch-format.rst b/Documentation/reference/formats/upatch-format.rst
index 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 load
artifact 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 the
file.
#. The file is a regular file, not empty and at most 16 MiB.
diff --git a/Documentation/reference/versions.rst b/Documentation/reference/versions.rst
index 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 git
checkout. 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 same
describe 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 a
git checkout.
* - Dirty mark
- ``-dirty`` when ``git diff-index HEAD`` reports a change to a
tracked 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 and
linker flags of the libraries on the build host, with their paths. The
target profile writes its configuration to ``config-target.mk``, which
the 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 tree
without one, as after ``make clean`` and ``make target``.
Two builds of one commit therefore get different IDs when their trees
hold different ``config.mk`` files, for example an operator package
built 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 the
same ``config.mk`` gets the same ID.
The ID does not cover the compiler and its version, the contents of the
diff --git a/Documentation/security/reporting.rst b/Documentation/security/reporting.rst
index 94235400..cf282139 100644
--- a/Documentation/security/reporting.rst
+++ b/Documentation/security/reporting.rst
@@ -48,7 +48,7 @@ Policy
The 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. Use
GitHub's Report a vulnerability feature instead.
diff --git a/Documentation/security/tamper-counters.rst b/Documentation/security/tamper-counters.rst
index 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 the
counter.
.. list-table::
diff --git a/Documentation/security/threat-model.rst b/Documentation/security/threat-model.rst
index 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 exercise
the 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 shirudo
targets and the ``tpm_command`` LSM hook. Upstream has no such
hook, 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 the
ABI. Without the hook the ``bpf2`` object does not load and
@@ -631,7 +631,7 @@ neither permissions nor ownership stop root. A changed archive would be
restored at the next boot, a truncated eventlog would make the register
unexplainable, 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 extended
attribute ``security.bpf.shirudo`` and checks every operation on a
marked 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 binary
reading, not reproduced.
:Meanwhile: Install a drop-in for each of these services that
starts 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 policies
D5 In-kernel detach
Detach 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 instantiation
diff --git a/Documentation/start/guides/first-upatch.rst b/Documentation/start/guides/first-upatch.rst
index 84145dce..df58dcc0 100644
--- a/Documentation/start/guides/first-upatch.rst
+++ b/Documentation/start/guides/first-upatch.rst
@@ -89,7 +89,7 @@ Build and sign it
wrote 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 it
carries one map and one program. The sizes and digests on this page
depend on your toolchain and paths.
diff --git a/Documentation/start/guides/publish-package.rst b/Documentation/start/guides/publish-package.rst
index 50c1cff0..70865489 100644
--- a/Documentation/start/guides/publish-package.rst
+++ b/Documentation/start/guides/publish-package.rst
@@ -63,7 +63,7 @@ Build the package
operator$ ln -s "$PWD/vendor" ~/hello/vendor
The 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 operator
package uses its own copies under ``/usr/share/shirudo`` and needs no
link.
diff --git a/Documentation/start/quickstart.rst b/Documentation/start/quickstart.rst
index 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-ssh
The 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 static
target binary, a dm-verity runtime image, signed config images and a
throwaway 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/keys
2. Look at the upatch you are going to sign,
- ``testing/fixtures/basic.bpf.c``:
+ :src:`testing/fixtures/basic.bpf.c`:
.. code-block:: c
diff --git a/Documentation/upatches/learn/examples.rst b/Documentation/upatches/learn/examples.rst
index 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``, a
complete observability package with arena tables, serializers, decoders
and generated ``.rodata``, and ``kernel-cve``, a set of small CVE
detectors 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``. The
manifest 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.rst
index 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 upatch
This tutorial takes one kernel fix to a signed upatch, loads it on a test
target, unloads it again, and packages it for a registry. The example is
CVE-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.rst
index 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 whose
name contains ``.upatch`` but not ``.unload.upatch``, in name order, and
``bpm uninstall`` applies every ``upatches/*.unload.upatch`` in reverse
name 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 a
model. Two of its load targets make member paths longer than 99 bytes
with any version, so ``bpm build`` fails. Its tree ids name the CVE
directories while its upatch names are the detectors' base names, so
diff --git a/Documentation/upatches/test/testing.rst b/Documentation/upatches/test/testing.rst
index 4a75cda7..ee64be3a 100644
--- a/Documentation/upatches/test/testing.rst
+++ b/Documentation/upatches/test/testing.rst
@@ -168,7 +168,7 @@ Use the signed fixtures
The 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 for
trying the commands above or for comparing your upatch with a known good
one.
diff --git a/Documentation/upatches/write/decoders.rst b/Documentation/upatches/write/decoders.rst
index 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 log
decoders over arena tables, timestamps included
diff --git a/Documentation/upatches/write/maps-arenas-serializers.rst b/Documentation/upatches/write/maps-arenas-serializers.rst
index 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. A
source defines the table's name, key and value types, capacity, bucket
count, record size and record encoder, and includes the file once per
table. Each inclusion produces a hash table in the arena and a serializer
@@ -108,7 +108,7 @@ Serializer interface
A serializer is a ``SEC("syscall")`` program named
``shirudo_serialize__<map>``. It writes into ``shirudo_ser``, an array map
with 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