eBPF-based security platform
cli: align the messages, the help and the docs after the output rework
Daniel Borkmann5d19df9c0d8b
diff --git a/Documentation/concepts/background/bpf-lsm.rst b/Documentation/concepts/background/bpf-lsm.rstindex 1de079bc..f5b3ae5a 100644--- a/Documentation/concepts/background/bpf-lsm.rst+++ b/Documentation/concepts/background/bpf-lsm.rst@@ -153,8 +153,9 @@ authority. A task gains it by a successful exec of a binary from theverified runtime image. A ``BPF_MAP_TYPE_TASK_STORAGE`` map records themark, ``lsm/task_alloc`` passes it to children, and the void hook``lsm.s/bprm_committed_creds`` commits or clears it after each exec. A-``BPF_MAP_TYPE_INODE_STORAGE`` map caches the seal label of directories.-Many seal programs are sleepable because they read extended attributes.+``BPF_MAP_TYPE_INODE_STORAGE`` map caches the seal label of the inodes+the seal read it from. Many seal programs are sleepable because they+read extended attributes.See :doc:`/internals/enforcement` for the inventory of hooks and:doc:`/internals/seal` for the seal.@@ -167,5 +168,6 @@ hook, and access to the machine below the kernel, are outside it. Whenan earlier LSM in the list refuses an operation, shirudo's program forthat hook does not run, so the refusal moves none of shirudo's tampercounters. Inode storage is lost when an inode leaves the cache, which is-a limitation of the seal's directory marks. :doc:`/security/threat-model`-lists the residual risks.+why the seal's marks are a cache its hooks refresh from the label and+never the decision. :doc:`/security/threat-model` lists the residual+risks.diff --git a/Documentation/concepts/background/oci.rst b/Documentation/concepts/background/oci.rstindex b95f771b..a130cbef 100644--- a/Documentation/concepts/background/oci.rst+++ b/Documentation/concepts/background/oci.rst@@ -225,7 +225,7 @@ still bind what a target loads, so this gives root the position of ahostile registry.On the operator host, ``shirudo bpm config update --base-package-oci://...`` without ``-f`` downloads the base package by tag, checks it+oci://...`` without ``--file`` downloads the base package by tag, checks itonly against its manifest's layer digest, and runs the updatercommands of the Beefile inside it. Whoever can move that tag can runcommands on the operator host. Pass ``-f`` with a Beefile you control,diff --git a/Documentation/concepts/background/xattrs.rst b/Documentation/concepts/background/xattrs.rstindex 9213d882..ea684d11 100644--- a/Documentation/concepts/background/xattrs.rst+++ b/Documentation/concepts/background/xattrs.rst@@ -74,7 +74,9 @@ kfuncs:Read an xattr whose name starts with ``user.`` or ``security.bpf.``.They first check that the current task may read the inode(``inode_permission()`` with ``MAY_READ``) and return its error if- not. Both may sleep, so only sleepable programs call them.+ not; a kernel patch shirudo carries skips that check for+ ``security.bpf.`` names (:doc:`/internals/kernel-patches`). Both+ may sleep, so only sleepable programs call them.``bpf_set_dentry_xattr()`` and ``bpf_remove_dentry_xattr()``Write or remove a ``security.bpf.`` xattr, after a check that the@@ -187,7 +189,12 @@ dentry or a file. ``inode_init_security``, ``inode_copy_up``,``inode_link`` and ``inode_mkdir`` cannot sleep. ``inode_create``,``inode_mknod``, ``inode_symlink`` and ``inode_rename`` can, but theyreceive the directory they change only as a ``struct inode``. None of-them can read the xattr of the directory an operation changes.+them can read the xattr of the directory an operation changes. Two+kernel patches shirudo carries change that: one adds ``inode_mkdir``,+``inode_link``, ``inode_copy_up`` and the ACL and inode flag hooks to+the sleepable set, the other lets a program read ``dentry->d_parent``,+the directory's dentry, as a trusted pointer+(:doc:`/internals/kernel-patches`).The usual pattern follows from that. A sleepable hook that has a dentryor a file, ``file_open`` for instance, reads the xattr and stores what@@ -255,11 +262,13 @@ bpffs to every task without runtime authority (``PinXattr``). SeeLimits-------The read kfuncs check the calling task's read permission even for-``security.bpf.`` names. When another LSM, or file permissions, deny that-task read access, the seal sees no label and allows the operation; the-file system's own permission checks then decide. The threat model lists-this under threats to resolve: :doc:`/security/threat-model`.+Upstream, the read kfuncs check the calling task's read permission even+for ``security.bpf.`` names; the kernel patch shirudo carries drops that+check for them. On a kernel without the patch, when another LSM, an ACL+or an idmapped mount denies that task read access, the seal decides by+the record of the inode, or of the directory the operation changes, and+a labeled inode without a record looks unlabeled. :doc:`/internals/seal`+lists this among its limits.The seal's records in inode storage are lost when an inode leaves theinode cache, and nothing depends on them: the hooks read the label, anddiff --git a/Documentation/concepts/glossary.rst b/Documentation/concepts/glossary.rstindex e0098edf..905f9569 100644--- a/Documentation/concepts/glossary.rst+++ b/Documentation/concepts/glossary.rst@@ -56,7 +56,7 @@ it.package directory, that names the package and lists its upatchsources, read-only data generators, extra files and tree selectors.``shirudo bpm build`` reads ``Beefile`` in the package directory, or- the file that ``-f`` names. See :doc:`/upatches/publish/beefile`.+ the file that ``--file`` names. See :doc:`/upatches/publish/beefile`.BPF keyringThe kernel's ``.bpf`` keyring, which the kernel uses for a signed@@ -391,10 +391,11 @@ it.tamper counterA counter for one point at which the enforcement programs refuse a- caller, such as ``BpfCommand``, ``PinUnlink`` or ``ObjGet``. The- counters live in a map pinned at ``/run/shirudo/bpffs/tamper`` that- only the enforcement programs increment, and ``shirudo status``- reports them. Not every refusal has a counter. See+ caller, such as ``BpfCommand``, ``PinUnlink`` or ``ObjGet``, or,+ for ``SealSignal``, let one through. The counters live in a map+ pinned at ``/run/shirudo/bpffs/tamper`` that only the enforcement+ programs increment, and ``shirudo status`` reports them. Not every+ refusal has a counter. See:doc:`/security/tamper-counters`.targetdiff --git a/Documentation/concepts/measurement-register.rst b/Documentation/concepts/measurement-register.rstindex b7b83c07..4f88e93d 100644--- a/Documentation/concepts/measurement-register.rst+++ b/Documentation/concepts/measurement-register.rst@@ -126,12 +126,14 @@ is not the one ``init`` bound, or when it differs from an``--expect-chain`` value the caller passed.A load is measured after it is attached and archived, and undone when-the extend fails. A load process stopped between the attach and the extend-leaves the upatch attached without an event until the next boot, whose-``init`` event covers the archive. An unload is measured before the pins-go, so an interrupted unload leaves a register that records more than-happened. :doc:`/reference/formats/eventlog` lists the fields of each-event.+the extend fails. A load process stopped between the attach and the+extend leaves the upatch attached without an event: ``shirudo status``+reports it under the ``UpatchesMeasured`` condition, the next load or+unload undoes it before it acts, and ``init`` at the next boot restores+no archive whose load the eventlog does not record. An unload is+measured before the pins go, so an interrupted unload leaves a register+that records more than happened. :doc:`/reference/formats/eventlog`+lists the fields of each event.Eventlog--------diff --git a/Documentation/contribute/arch-support.rst b/Documentation/contribute/arch-support.rstindex 3ccf54df..1f204f89 100644--- a/Documentation/contribute/arch-support.rst+++ b/Documentation/contribute/arch-support.rst@@ -49,9 +49,9 @@ Comparison``-mbranch-protection=standard``- None* - Carried kernel patches- - ``kernel/0001`` and ``kernel/0002``- - ``kernel/0002``- - ``kernel/0002``+ - ``kernel/0001`` to ``kernel/0005``+ - ``kernel/0002`` to ``kernel/0005``+ - ``kernel/0002`` to ``kernel/0005``* - BPF trampolines (``lsm``, ``fentry``, ``fexit``, ``fmod_ret``)- 36 programs per function- 37 programs per function@@ -150,8 +150,8 @@ shirudoLinux kernel~~~~~~~~~~~~-- Get ``kernel/0001`` and ``kernel/0002`` upstream. Neither is in- bpf-next; :doc:`/internals/kernel-patches` describes both.+- Get ``kernel/0001`` to ``kernel/0005`` upstream. None of them is in+ bpf-next; :doc:`/internals/kernel-patches` describes each.- riscv64: BPF trampolines on a kernel built with ``CONFIG_CFI``.- riscv64: arenas on CPUs without Zacas.- riscv64: large stacks, exceptions and private stacks in the BPF JIT.diff --git a/Documentation/contribute/code/coding-style.rst b/Documentation/contribute/code/coding-style.rstindex 39c97055..f4a4e7dc 100644--- a/Documentation/contribute/code/coding-style.rst+++ b/Documentation/contribute/code/coding-style.rst@@ -4,9 +4,41 @@ Linux kernel coding style=========================shirudo follows the Linux kernel coding style, in its userspace C as in-its BPF programs. The rest of this page is a verbatim copy of the-kernel's own ``Documentation/process/coding-style.rst``, kept here as the-guideline to follow.+its BPF programs, with these rules of its own, which+:src:`.github/scripts/check-style.sh` and the semantic patches in+:src:`testing/coccinelle/` enforce where they can:++- Zero-initialize with ``= {}``, not ``= {0}``.+- Spell fixed-width integers the kernel's way, ``__u8`` to ``__u64`` and+ ``__s8`` to ``__s64`` from ``<shirudo/types.h>``, in userspace too:+ not ``uint32_t`` and its kin, and not ``unsigned int``, ``unsigned+ long`` and their kin outside the files the script names. ``__u64``+ prints with ``%llu``.+- Parse numbers with ``parse_u64()``, ``parse_s64()`` and+ ``parse_x64()`` from ``<shirudo/string.h>``, which take a length and+ refuse a sign, a blank or a base prefix. ``strtoul()``, ``atoi()`` and+ their kin are refused.+- Copy strings with ``strscpy()`` and format into a fixed buffer with+ ``strsprintf()``, and check their results. ``strcpy()``, ``strncpy()``,+ ``sprintf()``, ``snprintf()`` and their kin are refused.+- Check size arithmetic with the helpers of ``<shirudo/overflow.h>``,+ not by hand.+- No ``(void)`` cast. A result a caller must not drop belongs to a+ ``__must_check`` function, and every call checks it.+- Name a return code ``ret``, and an errno a function keeps beside the+ value it returns ``err``.+- Declare locals in reverse Christmas tree order: the longest+ declaration line first, the shortest last, except that a declaration+ whose initializer uses an earlier local stays after it.+- A block comment opens with ``/*`` on a line of its own, and ``//`` is+ for the SPDX line of a ``.c`` file alone.+- Userspace is ``BSD-2-Clause``. Everything compiled into a BPF object+ is ``GPL-2.0 OR BSD-2-Clause``, and a BPF program declares+ ``char _license[] SEC("license") = "Dual BSD/GPL";``.++The rest of this page is a verbatim copy of the kernel's own+``Documentation/process/coding-style.rst``, kept here as the guideline+to follow.This is a short document describing the preferred coding style for thelinux kernel. Coding style is very personal, and I won't **force** mydiff --git a/Documentation/contribute/code/develop-locally.rst b/Documentation/contribute/code/develop-locally.rstindex fa013a30..15e5dd85 100644--- a/Documentation/contribute/code/develop-locally.rst+++ b/Documentation/contribute/code/develop-locally.rst@@ -209,12 +209,19 @@ from the config the target runs, and activate it.target# shirudo image update /workspace/shirudo/build/dev/config-1target# shirudo image status- {"root_hash":"bcca2bcd9661e77b094bd4197b335482a3a168ef693e2fc6706a37b62d0bcce9","pcr":14,"sequence":2,"reset_count":1,"restart_count":0,"pending":false,"consistent":true}+ Config root hash: bcca2bcd9661e77b094bd4197b335482a3a168ef693e2fc6706a37b62d0bcce9+ PCR: 14+ Sequence: 2+ TPM reset count: 1+ Restart count: 0+ Pending: no+ Consistent: yestarget# shirudo bpm config register list- dev+ Registered sources:+ dev- ``root_hash`` is the hash the host printed, ``pending`` is ``false``- and ``consistent`` is ``true``.+ ``Config root hash`` is the hash the host printed, ``Pending`` is+ ``no`` and ``Consistent`` is ``yes``.7. Let the target's package commands and services reach the registryover plain HTTP:@@ -343,13 +350,12 @@ Install ittarget# shirudo bpm install dev/exec-countupatch load: --no-precheck, pre-flight state check skipped- loaded signed loader: prog_fd=11 keyring=335804852 sig=4853B insns=208 data=5104B- loader ok, retval=0 (maps=2 progs=1)- attached + pinned prog 0 (raw_tracepoint) -> /run/shirudo/bpffs/upatches/exec-count/link- pinned map 0 (execs, type=1) -> /run/shirudo/bpffs/upatches/exec-count/maps/execs- upatch load: name=exec-count keyring=335804852 progs=1- upatch load: chain extended, value=23d80b8e3a30de1d5a556616d9d3eb388bbdb4bbc97f4e9fa81311909a3437ca- upatch load measured: name=exec-count chain=23d80b8e3a30de1d5a556616d9d3eb388bbdb4bbc97f4e9fa81311909a3437ca+ upatch load: signed loader accepted, keyring 335804852, 208 instructions+ upatch load: loader ran, 2 maps and 1 programs+ upatch load: program 0 (raw_tracepoint) pinned at /run/shirudo/bpffs/upatches/exec-count/link+ upatch load: map 0 (execs) pinned at /run/shirudo/bpffs/upatches/exec-count/maps/execs+ upatch load: exec-count loaded, 1 programs, keyring 335804852+ upatch load: exec-count measured, register 23d80b8e3a30de1d5a556616d9d3eb388bbdb4bbc97f4e9fa81311909a3437caThe target checks the package against the signed index, requires itscertificate to match the target's, and loads the upatch. The kernel@@ -360,7 +366,9 @@ Install it.. code-block:: consoletarget# shirudo bpm list- exec-count 1.0.0 dev+ Installed packages:+ NAME VERSION SOURCE+ exec-count 1.0.0 devtarget# shirudo upatch listArchived upatches (/var/lib/shirudo/upatches):NAME LOADED TYPE KIND PAYLOAD@@ -439,21 +447,21 @@ Update ittarget# shirudo bpm repo update devtarget# shirudo bpm upgradeupatch unload: --no-precheck, pre-flight state check skipped- loaded signed loader: prog_fd=11 keyring=335804852 sig=4853B insns=165 data=2808B- upatch unload: payload matches for 'exec-count'- upatch unload: chain extended, value=422dadf3d3e5b1abbc6a9257ccaabecc5259998ad2ace271b52c62a85e728602- upatch unload measured: name=exec-count chain=422dadf3d3e5b1abbc6a9257ccaabecc5259998ad2ace271b52c62a85e728602- upatch unload: detached + unpinned exec-count+ upatch unload: signed loader accepted, keyring 335804852, 165 instructions+ upatch unload: exec-count carries the directive's payload+ upatch unload: exec-count measured, register 422dadf3d3e5b1abbc6a9257ccaabecc5259998ad2ace271b52c62a85e728602+ upatch unload: exec-count detached and unpinnedupatch load: --no-precheck, pre-flight state check skipped- loaded signed loader: prog_fd=11 keyring=335804852 sig=4853B insns=208 data=5168B- loader ok, retval=0 (maps=2 progs=1)- attached + pinned prog 0 (raw_tracepoint) -> /run/shirudo/bpffs/upatches/exec-count/link- pinned map 0 (execs, type=1) -> /run/shirudo/bpffs/upatches/exec-count/maps/execs- upatch load: name=exec-count keyring=335804852 progs=1- upatch load: chain extended, value=5d01da4114c32805d9863fb76cf7d760c1d86a1839ef4d5f79b41685b833d46b- upatch load measured: name=exec-count chain=5d01da4114c32805d9863fb76cf7d760c1d86a1839ef4d5f79b41685b833d46b+ upatch load: signed loader accepted, keyring 335804852, 208 instructions+ upatch load: loader ran, 2 maps and 1 programs+ upatch load: program 0 (raw_tracepoint) pinned at /run/shirudo/bpffs/upatches/exec-count/link+ upatch load: map 0 (execs) pinned at /run/shirudo/bpffs/upatches/exec-count/maps/execs+ upatch load: exec-count loaded, 1 programs, keyring 335804852+ upatch load: exec-count measured, register 5d01da4114c32805d9863fb76cf7d760c1d86a1839ef4d5f79b41685b833d46btarget# shirudo bpm list- exec-count 1.1.0 dev+ Installed packages:+ NAME VERSION SOURCE+ exec-count 1.1.0 dev``upgrade`` unloads the old version with its signed unload directiveand loads the new one, and restores the old one if the new one fails@@ -475,15 +483,14 @@ Remove ittarget# shirudo bpm uninstall exec-countupatch unload: --no-precheck, pre-flight state check skipped- loaded signed loader: prog_fd=11 keyring=335804852 sig=4853B insns=165 data=2808B- upatch unload: payload matches for 'exec-count'- upatch unload: chain extended, value=2bf2d8fda256c469544e6d33638bb23fc0801e650bba4068411a779c698ab131- upatch unload measured: name=exec-count chain=2bf2d8fda256c469544e6d33638bb23fc0801e650bba4068411a779c698ab131- upatch unload: detached + unpinned exec-count+ upatch unload: signed loader accepted, keyring 335804852, 165 instructions+ upatch unload: exec-count carries the directive's payload+ upatch unload: exec-count measured, register 2bf2d8fda256c469544e6d33638bb23fc0801e650bba4068411a779c698ab131+ upatch unload: exec-count detached and unpinnedThe target runs the package's signed unload directive, measures the- unload and deletes the package. ``shirudo bpm list`` prints nothing- and ``shirudo upatch list`` prints ``none``.+ unload and deletes the package. ``shirudo bpm list`` and ``shirudo+ upatch list`` print ``none``.2. Check the collector's terminal. The map records stop, and thekeepalives go on.diff --git a/Documentation/contribute/testing/test-coverage.rst b/Documentation/contribute/testing/test-coverage.rstindex 532759f5..ed278f7e 100644--- a/Documentation/contribute/testing/test-coverage.rst+++ b/Documentation/contribute/testing/test-coverage.rst@@ -585,7 +585,8 @@ Coverage by area``t6121``* - Seal- ``t6001``, ``t6002``, ``t6007``, ``t6111``, ``t6114``,- ``t6115``, ``t6118``, ``t6123``, ``t6124``, ``t6133``+ ``t6115``, ``t6118``, ``t6123``, ``t6124``, ``t6133``,+ ``t6144``* - Task authority- ``t6006``, ``t6110``, ``t6113``, ``t6131``, ``t6132``,``t6134``, ``t6135``, ``t6136``, ``t6137``@@ -716,7 +717,7 @@ tests assert that a refusal moves its counter:* - ``PerfAttach``- ``t6119``* - ``SealEntry``- - ``t6115``, ``t6118``+ - ``t6115``, ``t6118``, ``t6144``* - ``SealCopyUp``- ``t6124``* - ``SealPtrace``@@ -865,7 +866,7 @@ Parsers and units- 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 :src:`util/` have no unit suite of their own.+- 54 of the 62 modules in :src:`util/` have no unit suite of their own.Related-------diff --git a/Documentation/internals/architecture.rst b/Documentation/internals/architecture.rstindex b14179fa..a0883b2d 100644--- a/Documentation/internals/architecture.rst+++ b/Documentation/internals/architecture.rst@@ -39,8 +39,9 @@ init`` set up this boot.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+``shirudo bpm config update``, ``shirudo image build``, ``shirudo image+verify`` and ``shirudo keys vouch``, execute the separate+``shirudo-build`` helper. Only that helperlinks the CMS signer (:src:`util/sign.c`) and the package builder andpublisher (:src:`tools/shirudo-build/`). It runs ``clang`` to compile BPF,libbpf's gen_loader to produce the signed loader, and ``veritysetup`` todiff --git a/Documentation/internals/boot-flow.rst b/Documentation/internals/boot-flow.rstindex 7c6f9b91..027e30a3 100644--- a/Documentation/internals/boot-flow.rst+++ b/Documentation/internals/boot-flow.rst@@ -196,10 +196,14 @@ register is cleared and one of the counts changes while the kernel'sboot ID stays. Register extensions then fail with ``tpm_error``, and everytarget command except ``shirudo status`` and ``shirudo image status``refuses because the config record belongs to another TPM boot. Nothing-re-runs ``init`` automatically. A manual ``shirudo init`` records a new-config boot event and binds the register again, from the root file system-and with the PCR values of that moment; a verifier that requires an-initrd binding rejects that evidence.+re-runs ``init`` automatically. After a TPM reset, whose count the+``init`` record no longer matches, a manual ``shirudo init`` records a+new config boot event and binds the register again, from the root file+system and with the PCR values of that moment; a verifier that requires+an initrd binding rejects that evidence. After a TPM restart the reset+count still matches the record, and ``init`` refuses to bind the cleared+register again (``tampered``) before the next reboot, which leaves the+config selection it recorded pending.Kexec-----diff --git a/Documentation/internals/enforcement.rst b/Documentation/internals/enforcement.rstindex d5b9a40f..ebd75ddc 100644--- a/Documentation/internals/enforcement.rst+++ b/Documentation/internals/enforcement.rst@@ -165,8 +165,9 @@ Images and device mapperruntime authority only the read-only device-mapper control commands.Exec and processes- ``seal`` grants and inherits the task mark and keeps ptrace and- task-bound perf events away from marked tasks. ``bpf2`` runs every+ ``seal`` grants and inherits the task mark, keeps ptrace and+ task-bound perf events away from marked tasks and counts a signal to+ one from a task without authority. ``bpf2`` runs everyruntime executable in secure-exec mode, so the dynamic loader ignores``LD_PRELOAD`` and the other unsafe variables, and refuses``PR_SET_MM_EXE_FILE`` and ``PR_SET_MM_MAP`` to tasks without@@ -194,8 +195,9 @@ order:#. Load ``bpf2``.#. Fill the identity map and freeze it.#. Seed the bootstrap mark for its own process through a pidfd, freeze- ``shirudo_tasks``, ``shirudo_devices`` and ``shirudo_tamper``, and pin- them with ``shirudo_roots``. Pin the identity map.+ ``shirudo_tasks``, ``shirudo_devices``, ``shirudo_tamper``,+ ``shirudo_task_policy`` and ``shirudo_sock_policy``, and pin them+ with ``shirudo_roots``. Pin the identity map.#. Attach ``task_prctl``, ``bprm_check_security``, ``inode_rmdir``,``inode_rename``, ``inode_mkdir``, ``inode_symlink``, ``inode_link``,``kernel_load_data`` and ``kernel_read_file``.@@ -449,7 +451,7 @@ when the record it needs is missing.systemd stops the runs its timers start, and counted, so that aload stopped between its pins and its extend shows before thenext command undoes what it left.- - none+ - None- ``SealSignal``- Which signal is an attack: a stop by root and one by systemdcount alike (R2).@@ -543,16 +545,19 @@ when the record it needs is missing.- The overlay copy-up of a labeled inode, by anyone.- ``EPERM``- ``SealCopyUp``- - See the label verdict below.+ - As the label verdict below, but a label, any other read error+ and a failure to allocate the scratch buffer refuse every caller.* - ``lsm.s/inode_post_setxattr``, ``lsm.s/inode_post_removexattr``(``seal``)- - Refresh a directory's mark from its label after the change.+ - Refresh an inode's mark from its label after the change.- None- None- - A failed read removes the mark.+ - No label removes the mark; a failed read leaves it.The label verdict of the ``seal`` hooks reads ``security.bpf.shirudo``-with the caller's permission. No label (``ENODATA``) and no security+with the xattr kfuncs, which with the carried patch 0003 return it+without the calling task's permission and upstream check that+permission first. No label (``ENODATA``) and no securityextended attributes on the file system (``EOPNOTSUPP``) count asunlabeled, and the operation goes ahead. A label the caller may notread (``EACCES``, ``EPERM``) counts as unlabeled unless the inode, or@@ -583,7 +588,7 @@ The hooks decide only what reaches them. These paths do not:``/dev/tpmrm0``. A TPM reached around the kernel's TPM characterdevices is outside it. The hook is not in bpf-next;:doc:`kernel-patches` describes the patch the test kernel carries.-- ``shirudo_roots`` and the directory marks are not frozen, by design.+- ``shirudo_roots`` and the inode marks are not frozen, by design.Device records are limited to 128.- Several refusals are uncounted, as the table shows.diff --git a/Documentation/internals/kernel-interfaces.rst b/Documentation/internals/kernel-interfaces.rstindex bd9321b1..711615d9 100644--- a/Documentation/internals/kernel-interfaces.rst+++ b/Documentation/internals/kernel-interfaces.rst@@ -56,10 +56,11 @@ Kernel baselinebpf-next contains the signed-loader ABI at merge ``0867b7bfa9de``.: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 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-carries. A kernel is admitted by the ABI check below, not by its release-string.+the UAPI headers lack it. The ``tpm_command`` LSM hook, the label reads+without the calling task's permission, the sleepable form of six inode+hooks and the trusted ``d_parent`` are not in bpf-next;+:doc:`kernel-patches` lists the patches the test kernel carries. A+kernel is admitted by the ABI check below, not by its release string.Signing ABI check-----------------@@ -259,16 +260,25 @@ LSM hooks* - ``perf_event_alloc``- ``seal``- ``CONFIG_PERF_EVENTS``- * - ``bprm_check_security``, ``bprm_committed_creds``, ``file_open``,- ``inode_unlink``, ``inode_rename``, ``inode_setattr``,- ``inode_setxattr``, ``inode_removexattr``,- ``inode_post_setxattr``, ``inode_post_removexattr`` (all- sleepable); ``task_alloc``, ``ptrace_access_check``,- ``inode_copy_up``, ``inode_init_security``, ``inode_create``,- ``inode_mkdir``, ``inode_symlink``, ``inode_mknod``,- ``inode_link``, ``mmap_file``, ``file_mprotect``+ * - ``bprm_creds_for_exec``, ``bprm_check_security``,+ ``bprm_committed_creds``, ``file_open``, ``inode_unlink``,+ ``inode_rmdir``, ``inode_setattr``, ``inode_setxattr``,+ ``inode_removexattr``, ``inode_post_setxattr``,+ ``inode_post_removexattr`` (all sleepable); ``task_alloc``,+ ``task_kill``, ``ptrace_access_check``, ``socket_post_create``,+ ``inode_init_security``, ``mmap_file``, ``file_mprotect``- ``seal``- None+ * - ``inode_create``, ``inode_symlink``, ``inode_mknod``,+ ``inode_rename`` (all sleepable)+ - ``seal``+ - Carried patch 0005, for the read of ``dentry->d_parent``+ * - ``inode_mkdir``, ``inode_link``, ``inode_set_acl``,+ ``inode_remove_acl``, ``inode_file_setattr``, ``inode_copy_up``+ (all sleepable)+ - ``seal``+ - Carried patch 0004, and 0005 for ``inode_mkdir`` and+ ``inode_link``A missing hook makes the object fail to load. :doc:`enforcement` giveseach hook's verdicts.@@ -283,8 +293,10 @@ Kfuncs and helpers* - Kfunc- Use* - ``bpf_get_file_xattr()``, ``bpf_get_dentry_xattr()``- - Read ``security.bpf.shirudo``. Sleepable; check ``MAY_READ`` for- the calling task.+ - Read ``security.bpf.shirudo`` and ``security.bpf.shirudo.policy``.+ Sleepable; upstream they check ``MAY_READ`` for the calling task+ first, which the carried patch 0003 skips for ``security.bpf.``+ names.* - ``bpf_inode_init_xattr()``- Add the label in ``inode_init_security``.* - ``bpf_real_data_inode()``@@ -296,13 +308,14 @@ Kfuncs and helpersHelpers: ``bpf_map_lookup_elem()``, ``bpf_map_update_elem()``,``bpf_map_delete_elem()``, ``bpf_task_storage_get()``,``bpf_inode_storage_get()``, ``bpf_inode_storage_delete()``,-``bpf_get_current_task_btf()``, ``bpf_probe_read_kernel()``,-``bpf_probe_read_kernel_str()``, ``bpf_bprm_opts_set()`` with-``BPF_F_BPRM_SECUREEXEC``, ``bpf_dynptr_from_mem()``,-``bpf_strncmp()``.+``bpf_sk_storage_get()``, ``bpf_get_current_task_btf()``,+``bpf_probe_read_kernel()``, ``bpf_probe_read_kernel_str()``,+``bpf_bprm_opts_set()`` with ``BPF_F_BPRM_SECUREEXEC``,+``bpf_dynptr_from_mem()``, ``bpf_strncmp()``.Map types: ``BPF_MAP_TYPE_ARRAY``, ``BPF_MAP_TYPE_HASH``,-``BPF_MAP_TYPE_TASK_STORAGE``, ``BPF_MAP_TYPE_INODE_STORAGE``.+``BPF_MAP_TYPE_TASK_STORAGE``, ``BPF_MAP_TYPE_INODE_STORAGE``,+``BPF_MAP_TYPE_SK_STORAGE``.Keyrings--------diff --git a/Documentation/internals/kernel-patches.rst b/Documentation/internals/kernel-patches.rstindex 049a4699..c0105467 100644--- a/Documentation/internals/kernel-patches.rst+++ b/Documentation/internals/kernel-patches.rst@@ -101,7 +101,7 @@ Why shirudo needs it``update_ftrace_direct_mod()`` registers a stub ops for the sites itmodifies. Detaching one of several BPF LSM programs from a busy hookis such an update. shirudo puts several programs on the same hooks,- ``bpf2`` and ``seal`` share nine, and an upatch unload detaches+ ``bpf2`` and ``seal`` share ten, and an upatch unload detachesprograms from hooks that other tasks are running. The test kernel'sslim configuration sets ``CONFIG_CC_OPTIMIZE_FOR_SIZE=y``.@@ -149,6 +149,107 @@ Without itboot is not stopped, and the target runs without enforcement, as:doc:`boot-flow` describes.+Label reads without the caller's permission+-------------------------------------------++Subject+ bpf: Read security.bpf xattrs for LSM programs without the caller's+ permission++Files+ ``fs/bpf_fs_kfuncs.c``.++What it changes+ ``bpf_get_dentry_xattr()`` and ``bpf_get_file_xattr()`` check that+ the calling task may read the inode before they return an extended+ attribute, for ``user.`` and ``security.bpf.`` names alike. The+ patch skips that check for ``security.bpf.`` names, which a BPF LSM+ program keeps for itself, as SELinux, Smack and EVM read their+ labels with ``__vfs_getxattr()`` in kernel context. ``user.`` names+ keep the check.++Why shirudo needs it+ The seal reads ``security.bpf.shirudo`` in the hooks that decide the+ calling task's operation, and that task is the one the seal may+ refuse. With the check, the task's read permission decides whether+ the seal sees the label, and root arranges a read that fails: an+ idmapped bind mount shows its files as another id's, an ACL grants+ another id a write without a read, a file system uid set with+ ``setfsuid()`` keeps ``CAP_SYS_ADMIN`` without the DAC capabilities,+ and another LSM's ``inode_permission`` policy refuses the read.+ :doc:`seal` explains the verdict.++Without it+ The seal loads and runs. A label read that fails with ``EACCES`` or+ ``EPERM`` is decided by the mark of the inode, or of the directory+ the operation changes, and a labeled inode without a mark looks+ unlabeled to the seal. :doc:`seal` lists this under its limits.++Sleepable programs on the remaining inode hooks+-----------------------------------------------++Subject+ bpf: Let sleepable LSM programs attach to the remaining inode hooks++Files+ ``kernel/bpf/bpf_lsm.c``.++What it changes+ The kernel keeps a list of the LSM hooks that take a sleepable BPF+ program. The patch adds ``inode_mkdir``, ``inode_link``,+ ``inode_set_acl``, ``inode_remove_acl``, ``inode_file_setattr`` and+ ``inode_copy_up`` to it. Each is called from process context with+ the inode lock held, as the hooks already in the list are, and may+ sleep.++Why shirudo needs it+ The seal reads labels with ``bpf_get_dentry_xattr()``, which sleeps,+ so only a sleepable program can decide an operation by a label.+ ``lsm.s/inode_mkdir`` and ``lsm.s/inode_link`` read the label of the+ directory the entry goes into, ``lsm.s/inode_set_acl``,+ ``lsm.s/inode_remove_acl`` and ``lsm.s/inode_file_setattr`` the+ label of the inode they change, and ``lsm.s/inode_copy_up`` the+ label of the inode an overlay copies up, instead of a mark that an+ eviction of the inode empties.++Without it+ The kernel refuses the ``lsm.s/`` form of those programs, so the+ ``seal`` object fails to load and ``init`` fails at "loading+ enforcement", with the result the TPM command hook describes.++Trusted dentry parent+---------------------++Subject+ bpf: Treat dentry->d_parent as a trusted pointer++Files+ ``kernel/bpf/verifier.c``.++What it changes+ The verifier lists the fields of a kernel structure that a program+ may read as trusted pointers. For ``struct dentry`` it lists+ ``d_inode``; the patch adds ``d_parent`` beside it, as trusted or+ null, so a program checks it for NULL before use. The parent of a+ dentry an inode hook receives is stable while the hook runs, under+ the parent's inode lock the caller holds, and is never NULL, since+ the root's points to itself.++Why shirudo needs it+ ``inode_create``, ``inode_mkdir``, ``inode_symlink``,+ ``inode_mknod``, ``inode_link`` and ``inode_rename`` receive the+ directory an entry goes into as a ``struct inode`` and the entry as+ a dentry. ``bpf_get_dentry_xattr()`` takes a dentry, and the only+ one the seal has for the directory is ``dentry->d_parent``. The+ seal reads the directory's label from it and refreshes the+ directory's mark on the way, which ``inode_init_security`` labels+ the new inode from.++Without it+ The verifier refuses ``d_parent`` as the kfunc's argument, so the+ ``seal`` object fails to load and ``init`` fails at "loading+ enforcement", with the result the TPM command hook describes.+Related-------diff --git a/Documentation/internals/measurement-register.rst b/Documentation/internals/measurement-register.rstindex e64ce6b1..5e9febc8 100644--- a/Documentation/internals/measurement-register.rst+++ b/Documentation/internals/measurement-register.rst@@ -254,10 +254,11 @@ loads, archives and then extends; a failed archive copy or a refusedextension undoes the load, so no upatch runs unmeasured. An unloadextends first and detaches after, so a stopped process leaves a registerthat records more than happened, never less. A load stopped between its-pins and its extension leaves pins the register does not cover:-``status`` reports them and the next load or unload undoes them under-the same lock before it acts, so the register stays behind what runs-for one command at most. An append that fails after+pins and its extension leaves pins, and after its archive copy an+archive, that the register does not cover: ``status`` reports them and+the next load or unload undoes them under the same lock before it acts,+so the register stays behind what runs for one command at most. An+append that fails aftera successful extension is reported as a desync for the operator toreconcile.diff --git a/Documentation/internals/seal.rst b/Documentation/internals/seal.rstindex 9113acc2..b669ecab 100644--- a/Documentation/internals/seal.rst+++ b/Documentation/internals/seal.rst@@ -163,25 +163,31 @@ What the seal checksFor a labeled inode, these operations need runtime authority:- a write open (``SealWrite``);-- unlink (``SealUnlink``);+- unlink, or the removal of a directory (``SealUnlink``);- rename of it, or rename over it (``SealRename``);- truncate, chmod, chown and timestamp changes through- ``inode_setattr`` (``SealSetattr``);-- setting or removing any extended attribute (``SealXattr``).--Setting the attribute ``security.bpf.shirudo`` itself needs runtime-authority on every inode, labeled or not (``SealLabel``), so root cannot-label an inode of its own as shirudo's.--A directory with a cached mark takes new entries only from a task with-runtime authority: ``inode_create``, ``inode_mkdir``, ``inode_symlink``,-``inode_mknod``, ``inode_link`` and a rename into it (``SealEntry``). A-label stops writes to an inode, but a rename or a hard link brings an-inode in with its contents, and a symbolic link sends whoever follows it-elsewhere. ``inode_copy_up`` refuses the overlay copy-up of a marked inode-(``SealCopyUp``): a write through an overlay mounted over sealed state-would otherwise land in the upper directory and leave the sealed inode as-it was.+ ``inode_setattr``, and a change of the inode flags with ``chattr``+ through ``inode_file_setattr`` (``SealSetattr``);+- setting or removing any extended attribute or POSIX ACL+ (``SealXattr``).++Setting or removing the attribute ``security.bpf.shirudo`` itself, or+``security.bpf.shirudo.policy``, needs runtime authority on every inode,+labeled or not (``SealLabel``), so root cannot label an inode of its own+as shirudo's.++A labeled directory takes new entries only from a task with runtime+authority: ``inode_create``, ``inode_mkdir``, ``inode_symlink``,+``inode_mknod``, ``inode_link`` and a rename into it (``SealEntry``).+Each of these hooks reads the directory's label from the new entry's+parent dentry. A label stops writes to an inode, but a rename or a hard+link brings an inode in with its contents, and a symbolic link sends+whoever follows it elsewhere. A hard link of a labeled inode is refused+anywhere to the same tasks (``SealEntry``), so a sealed inode keeps its+label where shirudo put it. ``inode_copy_up`` refuses the overlay+copy-up of a labeled inode to every caller (``SealCopyUp``): a write+through an overlay mounted over sealed state would otherwise land in the+upper directory and leave the sealed inode as it was.Reading the label~~~~~~~~~~~~~~~~~@@ -217,11 +223,15 @@ creation: no inode is better than one of shirudo's without its label.That hook cannot sleep, so it cannot read the parent's extendedattribute. It uses a cached mark instead: ``seal_dir_marks``, inodestorage that records an inode's label. A directory gets its mark when-any task opens it and its label is read, a file when an authorized task-opens it or any task opens it for writing, and either when an extended-attribute on it changes and when it is created under a marked parent.-An open whose label read finds nothing removes the mark; a read that-fails, for a caller who may not read the inode, leaves it.+any task opens it and its label is read, and when any task makes an+entry in it, from the label the entry hook of that operation reads from+the parent dentry; a file when an authorized task opens it or any task+opens it for writing; and either when an extended attribute on it+changes and when it is created under a marked parent. A directory open,+an entry made in a directory, a read open by an authorized task or an+attribute change whose label read finds nothing removes the mark; a+write open only records one; a read that fails, for a caller who may+not read the inode, leaves it.shirudo's writers keep the mark in place. They open the parent directoryand create files relative to that descriptor, which holds the inode indiff --git a/Documentation/operate/deploy/boot-integration.rst b/Documentation/operate/deploy/boot-integration.rstindex 4f9bd2a0..68fc5746 100644--- a/Documentation/operate/deploy/boot-integration.rst+++ b/Documentation/operate/deploy/boot-integration.rst@@ -459,26 +459,11 @@ Boot and verifyFolded: keyrings, TPM measurement, assets (--show-full)- Conditions:- TYPE STATUS DETAIL- LsmAttached OK lsm/bpf link present and pinned- KeyringSealed OK bpf serial 130847582, dm-verity serial 962472513, pins match- ChainIntact OK live register equals the eventlog replay- TpmMeasured OK NV index 0x01818E00 readable- ConfigActive OK config dc90bacc356f.. is active- ...- TPM measurement:- TPM: reachable (device:/dev/tpmrm0)- NV index: 0x01818E00 (anchored in PCR 9)- ...- Bound in: initrd- Chain vs eventlog: matches- ...-- Check for ``Mode: production``, ``Status: ok``, five ``OK``- conditions and ``Bound in: initrd``. ``ConfigActive`` names the first- 12 hex digits of the active config root. :doc:`/operate/run/read-status`- explains every section.+ Check for ``Mode: production``, ``Status: ok`` and six ``OK``+ conditions. ``ConfigActive`` names the first 12 hex digits of the+ active config root. ``shirudo status --show-full`` prints the folded+ TPM measurement section, whose ``Bound in:`` line must read+ ``initrd``. :doc:`/operate/run/read-status` explains every section.3. Check the config activation:@@ -493,9 +478,10 @@ Boot and verifyPending: noConsistent: yes- ``root_hash`` is the root of ``initial``, ``pcr`` is ``config.pcr``,- ``pending`` is ``false`` and ``consistent`` is ``true``. The command- exits 1 when the activation is pending or inconsistent.+ ``Config root hash`` is the root of ``initial``, ``PCR`` is+ ``config.pcr``, ``Pending`` is ``no`` and ``Consistent`` is ``yes``.+ The command exits 1 when the activation is pending or inconsistent,+ and ``--json`` prints the same fields as one JSON document.4. Read both init runs in the journal:diff --git a/Documentation/operate/deploy/deployment-checklist.rst b/Documentation/operate/deploy/deployment-checklist.rstindex 3eb51519..d3b066c0 100644--- a/Documentation/operate/deploy/deployment-checklist.rst+++ b/Documentation/operate/deploy/deployment-checklist.rst@@ -126,8 +126,9 @@ Boot and enroll- Item- Page* - 18- - First boot completed: ``status`` reports ``ok``, ``Bound in:- initrd``, and ``image status`` reports no pending activation.+ - First boot completed: ``status`` reports ``ok``, ``status+ --show-full`` shows ``Bound in: initrd``, and ``image status``+ reports ``Pending: no``.- :doc:`/operate/deploy/initialize`* - 19- Attestation key name recorded and the target's endorsement keydiff --git a/Documentation/operate/deploy/initialize.rst b/Documentation/operate/deploy/initialize.rstindex 7f1e838b..2413d461 100644--- a/Documentation/operate/deploy/initialize.rst+++ b/Documentation/operate/deploy/initialize.rst@@ -94,31 +94,33 @@ Check that init workedFolded: keyrings, TPM measurement, assets (--show-full)- Conditions:- TYPE STATUS DETAIL- LsmAttached OK lsm/bpf link present and pinned- KeyringSealed OK bpf serial 130847582, dm-verity serial 962472513, pins match- ChainIntact OK live register equals the eventlog replay- TpmMeasured OK NV index 0x01818E00 readable- ConfigActive OK config dc90bacc356f.. is active+ ``Status: ok`` and six ``OK`` conditions mean that enforcement is+ attached, the ``.bpf`` keyring is the one init sealed, the register+ matches the eventlog, every pinned upatch is measured and the config+ is active.++2. Read where the register was bound:++ .. code-block:: console++ target# shirudo status --show-full...TPM measurement:TPM: reachable (device:/dev/tpmrm0)NV index: 0x01818E00 (anchored in PCR 9)- Chain: dc21c3dabcd2fd0a751c7146ad71c595f2386a4406feb64c3d6e2bd65c5bc706- Register name: 000b9b7b0f925415fdf0d5676369f8cc9146b9e3142537148b31e79dbffcc96e72f8- Anchored: yes (name on record)+ Chain: 7f63313a31ac8ddd3a6a16fce2038322c9c782d5787155d2dc18dfa582dff548+ Register name: 000b21eb0d45ac9ee1bb0a87dbb069120e3b8cb251b3d40cc2a86a307ab73f728789+ Anchored: yes, name on recordPCR before init: 0000000000000000000000000000000000000000000000000000000000000000Phase at init: 0000000000000000000000000000000000000000000000000000000000000000 (PCR 11)Bound in: initrdChain vs eventlog: matches- Eventlog: /var/lib/shirudo/eventlog (3 entries, 2675 bytes)+ Eventlog: /var/lib/shirudo/eventlog (2 entries, 2324 bytes)...- ``Status: ok`` and five ``OK`` conditions mean that enforcement is- attached, the ``.bpf`` keyring is the one init sealed, the register- matches the eventlog and the config is active. ``Bound in: initrd``- says that the initrd run bound the register.+ The report folds the TPM measurement section while ``ChainIntact``+ and ``TpmMeasured`` are ``OK``, and ``--show-full`` prints it.+ ``Bound in: initrd`` says that the initrd run bound the register.``PCR before init`` and ``Phase at init`` are PCR 9 and PCR 11 as initfound them. The output comes from the test VM, which boots the kernel@@ -126,7 +128,7 @@ Check that init workedmeasured UKI shows its own values, and a verifier pins them as:doc:`/operate/run/attest` describes.-2. Check the fields a script reads:+3. Check the fields a script reads:.. code-block:: console@@ -155,7 +157,7 @@ Check that init worked:doc:`/reference/formats/status-json` describes every field.-3. Check that the root run adopted the initrd's record:+4. Check that the root run adopted the initrd's record:.. code-block:: console@@ -164,7 +166,7 @@ Check that init workedThe file must not exist. When it remains, ``shirudo.service`` did notrun or failed, and its journal says why.-4. Read both runs in the journal:+5. Read both runs in the journal:.. code-block:: console@@ -288,8 +290,8 @@ did not advance`` after one of these lines:``tpm.owner_auth`` in both bootstrap files as:doc:`/operate/deploy/boot-integration` describes. The environmentvariable that the message names is refused on a target.- * - ``tpm: register extend failed -- chain NOT advanced while LSM- active (tpm_error); operator must reconcile``+ * - ``tpm: register extend failed, the chain did not advance while+ the LSM is active (tpm_error); the operator must reconcile``- The register could not be defined or extended. Read the journalfor the TPM error before it.* - ``tpm: the register this boot recorded is gone or replaced;diff --git a/Documentation/operate/maintain/backup-recovery.rst b/Documentation/operate/maintain/backup-recovery.rstindex 25af90b3..6dfea18a 100644--- a/Documentation/operate/maintain/backup-recovery.rst+++ b/Documentation/operate/maintain/backup-recovery.rst@@ -107,14 +107,14 @@ Plan for eventlog growthThe eventlog grows by one record for each boot, upatch load and unload,key revocation and tree operation. shirudo never rotates or truncatesit, has no command to, and the seal stops root from doing it. In the-test VM, the init record of a target with two certificates takes 1975-bytes and a load adds 336:+test VM, the init record of a target with two certificates takes about+2 KB and a load adds a few hundred bytes:.. code-block:: console- target# shirudo status+ target# shirudo status --show-full...- Eventlog: /var/lib/shirudo/eventlog (2 entries, 2311 bytes)+ Eventlog: /var/lib/shirudo/eventlog (2 entries, 2324 bytes)...Every command that reads the eventlog reads all of it, plus the pending@@ -146,7 +146,7 @@ Symptoms:- ``shirudo status`` reports ``reboot-pending`` with the reason ``aconfig activation is pending until the next reboot``.-- ``shirudo image status`` prints ``"pending":true`` and exits 1.+- ``shirudo image status`` prints ``Pending: yes`` and exits 1.- Every other command prints ``shirudo: image state: Operation now inprogress`` and exits 1.@@ -164,8 +164,8 @@ selection, or ``init`` failed after it recorded this boot's activationthe node keeps running in this state with enforcement up.#. Check after the reboot that ``shirudo status`` reports ``ok`` and- ``shirudo image status`` prints ``"pending":false`` and- ``"consistent":true``.+ ``shirudo image status`` prints ``Pending: no`` and+ ``Consistent: yes``.At the next boot, ``init`` verifies the pending selection, records afresh boot activation and completes. There is no command that clears adiff --git a/Documentation/operate/maintain/keys.rst b/Documentation/operate/maintain/keys.rstindex 453da545..7d10d0be 100644--- a/Documentation/operate/maintain/keys.rst+++ b/Documentation/operate/maintain/keys.rst@@ -103,8 +103,8 @@ table lists every key.The BPF signing keys and the config signing key are ML-DSA-87 keys from``shirudo genkey``. The config signing key may be one of the BPF signingkeys or a separate key. Keep the private signing keys on the operator-host. A target needs none, and ``shirudo status`` on a target reports-``keys/signing_key.pem absent``.+host. A target needs none, and ``shirudo status --show-full`` on a+target reports ``keys/signing_key.pem absent``.What can change when--------------------@@ -166,63 +166,64 @@ Check what a target trusts.. code-block:: consoletarget# shirudo keys- Cert (/run/shirudo/runtime/keys/cert.der):+ Certificate (/run/shirudo/runtime/keys/cert.der):Subject: /CN=shirudoIssuer: /CN=shirudo (self-signed)Public key: ML-DSA-87- Fingerprint: SHA256:75171e034357238625311a1c810f7466835ac1dfbc73e9fbd383523439b24125- SPKI fingerprint: SHA256:7773eae1c45bc435d9591068da9c318afacfe486007f5386a70ade477f670d69- Issued: 2026-10-29T21:50:28Z+ Fingerprint: SHA256:c00c2d9a30c11dd98bb53200ac79c744b063a50489e5780968ea97bcb5745eb1+ SPKI fingerprint: SHA256:6bd6b1a28b631295a013102d358d371d52ab1c894587aedceaf02e472c88f858+ Issued: 2026-11-03T14:52:11ZSigning key (/run/shirudo/runtime/keys/signing_key.pem):- Present: no (target host -- private key lives on the operator)+ Present: no, a target holds no private keyTrusted set (2 members, 0 revoked, 0 unvouched):- 7773eae1c45bc435d9591068da9c318afacfe486007f5386a70ade477f670d69 (primary)- sha256 75171e034357238625311a1c810f7466835ac1dfbc73e9fbd383523439b24125- 4e4d8da3b0d1a69205a3767baca002c052e90af92bc9815d245f9b25dc1b7d9a- sha256 ba3d36544ecfe66b43ea2db498f8f8e50b09fd6f301952636d120c648f76a740- vouched by 7773eae1c45bc435d9591068da9c318afacfe486007f5386a70ade477f670d69+ a8be2bb837b0f052f7652f9edf446594a5465eed614d939964ddfcc96e61ba7f+ sha256 79b04130628135a03630a0ed9e92a574f8701847404ec281469348a09b9b3b45+ vouched by 6bd6b1a28b631295a013102d358d371d52ab1c894587aedceaf02e472c88f858+ 6bd6b1a28b631295a013102d358d371d52ab1c894587aedceaf02e472c88f858 (primary)+ sha256 c00c2d9a30c11dd98bb53200ac79c744b063a50489e5780968ea97bcb5745eb1Keyring (.bpf):- Serial: 854623986- Frozen serial: 854623986 (matches)+ Serial: 272801410+ Frozen serial: 272801410 (matches)Members (2):- serial=209590502 type=asymmetric shirudo: 08967f45330deb21bf31301e56bdf154283e2e58 (frozen)- serial=646964383 type=asymmetric shirudo: 8e781f2c1c0e9bccbba9d1d286129128e830e81f (frozen)+ serial=465853497 type=asymmetric shirudo: 30dee65057025367c4c384928bcf1e4cd8fe0265 (frozen)+ serial=91435879 type=asymmetric shirudo: 7fa1d435249690766f8b1397122775d26f1ed92e (frozen)Keyring (.dm-verity):- Serial: 684706098- Frozen serial: 684706098 (matches)+ Serial: 799624487+ Frozen serial: 799624487 (matches)Members (1):- serial=37657992 type=asymmetric shirudo: 08967f45330deb21bf31301e56bdf154283e2e58 (frozen)+ serial=403194297 type=asymmetric shirudo: 7fa1d435249690766f8b1397122775d26f1ed92e (frozen)- ``Cert`` is the runtime primary. The trusted set lists each member by- its SPKI fingerprint, with the SHA-256 of its DER and the member that- vouched for it. ``Keyring (.bpf)`` is what the kernel verifies signed- loaders against: the serial init froze, and one key per member.- ``Keyring (.dm-verity)`` holds the one key the kernel verifies config- roots with. ``(frozen)`` marks a member ``init`` recorded; a member- marked ``(NOT frozen)`` is trusted by the kernel all the same, and- ``shirudo status`` reports the target ``tampered``.+ ``Certificate`` is the runtime primary. The trusted set lists each+ member by its SPKI fingerprint, with the SHA-256 of its DER and the+ member that vouched for it. ``Keyring (.bpf)`` is what the kernel+ verifies signed loaders against: the serial init froze, and one key+ per member. ``Keyring (.dm-verity)`` holds the one key the kernel+ verifies config roots with. ``(frozen)`` marks a member ``init``+ recorded; a member marked ``(not frozen)`` is trusted by the kernel+ all the same, and ``shirudo status`` reports the target ``tampered``.2. Read the same set from the status report, each certificate with the- key that holds it:+ key that holds it. The report folds the keyring sections while+ ``KeyringSealed`` is ``OK``, so ask for them:.. code-block:: console- target# shirudo status+ target# shirudo status --show-full...Keyring (.bpf):- Serial: 854623986- Frozen serial: 854623986 (matches)+ Serial: 272801410+ Frozen serial: 272801410 (matches)Certificates: 2 trusted, 0 revoked, 0 unvouched, 2 in the bpf keyring- 7773eae1c45bc435d9591068da9c318afacfe486007f5386a70ade477f670d69 (primary)- CN=shirudo, ML-DSA-87, issued 2026-10-29- key 209590502 shirudo: 08967f45330deb21bf31301e56bdf154283e2e58 (frozen)- 4e4d8da3b0d1a69205a3767baca002c052e90af92bc9815d245f9b25dc1b7d9a- CN=shirudo, ML-DSA-87, issued 2026-10-29- key 646964383 shirudo: 8e781f2c1c0e9bccbba9d1d286129128e830e81f (frozen)+ a8be2bb837b0f052f7652f9edf446594a5465eed614d939964ddfcc96e61ba7f+ CN=shirudo, ML-DSA-87, issued 2026-11-03+ key 465853497 shirudo: 30dee65057025367c4c384928bcf1e4cd8fe0265 (frozen)+ 6bd6b1a28b631295a013102d358d371d52ab1c894587aedceaf02e472c88f858 (primary)+ CN=shirudo, ML-DSA-87, issued 2026-11-03+ key 91435879 shirudo: 7fa1d435249690766f8b1397122775d26f1ed92e (frozen)...``unvouched`` counts certificates under ``keys/trusted`` without adiff --git a/Documentation/operate/maintain/upgrade.rst b/Documentation/operate/maintain/upgrade.rstindex 28b80566..5f29b9d2 100644--- a/Documentation/operate/maintain/upgrade.rst+++ b/Documentation/operate/maintain/upgrade.rst@@ -80,7 +80,7 @@ differs. In this example the path of the artifact is shortened:.. code-block:: consoletarget# shirudo upatch load --expect-version-id=0000000000000000000000000000000000000000000000000000000000000000 --report=- shirudo-test-lifecycle.upatch- upatch load: version mismatch -- operator expects 0000000000000000000000000000000000000000000000000000000000000000, target is 58b05ab35a2bcefaa649faf15f8c6be0211e24cea710450c1a29298c3b5c7de0; redeploy a matching shirudo or pass --no-version-check+ upatch load: version mismatch, the operator expects 0000000000000000000000000000000000000000000000000000000000000000 and the target is 58b05ab35a2bcefaa649faf15f8c6be0211e24cea710450c1a29298c3b5c7de0; deploy a matching shirudo or pass --no-version-check{"schema":1,"result":"failed","op":"upatch_load","phase":"pre_flight","errno":1,"errno_name":"EPERM","category":"version_mismatch","message":"SHIRUDO_VERSION_ID mismatch (operator vs target)",...}Take the expected ID from the binary in the runtime image, never from the@@ -189,9 +189,9 @@ Verify the upgradeThe ID must be the one you recorded on the operator host.2. Check init as described in :doc:`/operate/deploy/initialize`:- ``shirudo status`` reports ``ok`` and ``Bound in: initrd``, and- ``shirudo image status`` reports ``"pending":false`` and- ``"consistent":true``.+ ``shirudo status`` reports ``ok``, ``shirudo status --show-full``+ shows ``Bound in: initrd``, and ``shirudo image status`` reports+ ``Pending: no`` and ``Consistent: yes``.3. Update your verifiers. The new initrd and UKI change the PCR valuesthat init records when it binds the register, which a verifier pinsdiff --git a/Documentation/operate/plan/hardening.rst b/Documentation/operate/plan/hardening.rstindex 327cde0e..43a4c2a4 100644--- a/Documentation/operate/plan/hardening.rst+++ b/Documentation/operate/plan/hardening.rst@@ -186,8 +186,8 @@ TPM10 by default, and not PCR 15, which systemd extends with themachine ID, file systems and encrypted volumes- Any extension of the config PCR after init blocks every command- but ``status`` until the next reboot, and ``status`` reports- ``tampered``.+ but ``status`` and ``image status`` until the next reboot, and+ ``status`` reports ``tampered``.- partly: init refuses PCRs 9, 11 and above 15, and ``status``detects a later extension* - A ``device:`` TCTIdiff --git a/Documentation/operate/plan/system-requirements.rst b/Documentation/operate/plan/system-requirements.rstindex 10d81c36..05e2914b 100644--- a/Documentation/operate/plan/system-requirements.rst+++ b/Documentation/operate/plan/system-requirements.rst@@ -396,7 +396,7 @@ Run the checks as root on a target:10 of 10 passedA failed check prints ``FAIL`` and its reason, and the command exits 1-after ``init: pre-flight failed (<failed>/<total> checks)``.+after ``init: pre-flight failed, <failed> of <total> checks``.Network-------diff --git a/Documentation/operate/run/attest.rst b/Documentation/operate/run/attest.rstindex d5801298..21771b0a 100644--- a/Documentation/operate/run/attest.rst+++ b/Documentation/operate/run/attest.rst@@ -148,7 +148,8 @@ you trust.The TPM can recover the credential only when the attestation key andthe endorsement key are in it. The command refuses with- ``attest: the challenge was refused (tampered?)`` otherwise.+ ``attest: the TPM refused the challenge; the attestation key or the+ endorsement key is not this TPM's`` otherwise.6. Verify the answer on the operator host:@@ -257,9 +258,9 @@ Verify evidence3. Check the exit status: 0 for ``verdict: ok``, 1 for ``verdict: fail``and 2 for a usage error or a file that is not an evidence document.-The report prints one line per check, ``ok:`` or ``FAIL:``, and-``note:`` lines that check nothing. This is a real report from a test-target, verified with ``--ak-name`` and ``--expect-chain`` only:+The report prints one line per check, ``OK`` or ``FAIL``, and ``NOTE``+lines that check nothing. This is a real report from a test target,+verified with ``--ak-name`` and ``--expect-chain`` only:.. code-block:: console@@ -283,19 +284,19 @@ target, verified with ``--ak-name`` and ``--expect-chain`` only:OK register: certified contents match the listed valueOK quote and certification are of one TPM resetOK config: config root history matches the quoted PCR- note config root has no operator approval; use --expect-config-root with --expect-config-pcr- note config records a selection; direct TPM writer protection is deferred+ NOTE config root has no operator approval; use --expect-config-root with --expect-config-pcr+ NOTE config records a selection; direct TPM writer protection is deferredOK eventlog: this boot has an init recordOK register: the document names index 0x01818E00 and PCRs 9 and 11OK register: public area is bound to PCRs 9 and 11 as recorded- note binding: made in the initrd+ NOTE binding: made in the initrdOK eventlog: one init record for this TPM reset (1 this boot)OK register: init record is of the TPM's current reset countOK eventlog: 2 records replay to the certified valueOK anchor: record digest matches the index nameOK anchor: PCR 9 equals the recorded value extended by the anchorOK state: register equals the expected value- note event after boot: upatch_load basic+ NOTE event after boot: upatch_load basicverdict: okRead it in groups:@@ -309,7 +310,7 @@ Read it in groups:``--expect-config-root``.- The eventlog and binding lines replay this boot's records to thecertified register and recompute the register's name from the PCR- values it was bound to. ``note: binding: made in the initrd`` is the+ values it was bound to. ``note binding: made in the initrd`` is thetarget's own claim. With ``--expect-bind-pcr``, the report adds``binding: PCR 9 held the expected value`` and the same line forPCR 11, which check the binding against values you know.@@ -351,8 +352,8 @@ set only, but a load and an unload happened after boot:OK anchor: PCR 9 equals the recorded value extended by the anchorFAIL state: init event covers the expected certificate, set and tree rootFAIL state: 2 events after boot change the register- note event after boot: upatch_load shirudo-test-basic- note event after boot: upatch_unload shirudo-test-basic+ NOTE event after boot: upatch_load shirudo-test-basic+ NOTE event after boot: upatch_unload shirudo-test-basicverdict: failThe init event line fails too, because that target enrolled two@@ -374,11 +375,11 @@ evidence and the nonce:OK nonce matches the requestOK attestation key: restricted, fixed to this TPMOK attestation key: name matches its public area- note attestation key not pinned: name 000b6e354140b22198138167393ecd1233cfc27e8b16ef0b2b60cce88563c5588dbc+ NOTE attestation key not pinned: name 000b6e354140b22198138167393ecd1233cfc27e8b16ef0b2b60cce88563c5588dbc...- note no expected state given; the register value is e57e1428ab398e758b63f8eda52bac87b5d85c1368c2d8d786ed446448e46239- note event after boot: upatch_load shirudo-test-basic- note event after boot: upatch_unload shirudo-test-basic+ NOTE no expected state given; the register value is e57e1428ab398e758b63f8eda52bac87b5d85c1368c2d8d786ed446448e46239+ NOTE event after boot: upatch_load shirudo-test-basic+ NOTE event after boot: upatch_unload shirudo-test-basicverdict: okThe verdict is ``ok`` and the exit status 0, but the run proves onlydiff --git a/Documentation/operate/run/deliver-packages.rst b/Documentation/operate/run/deliver-packages.rstindex 32d6c4c3..2942f0f5 100644--- a/Documentation/operate/run/deliver-packages.rst+++ b/Documentation/operate/run/deliver-packages.rst@@ -148,7 +148,8 @@ Add a repositorytarget# shirudo bpm config register list- The command prints one repository name per line.+ The command prints ``Registered sources:`` and one repository name+ per line, or ``none``.#. Fetch the repository's index now instead of waiting for the timer:@@ -217,12 +218,19 @@ while it runs... code-block:: consoletarget# shirudo image status- {"root_hash":"12dbf3c750834908c0f6510481e35fbb0cc76cf6b1896de524304535e63aff0f","pcr":14,"sequence":1,"reset_count":1,"restart_count":0,"pending":false,"consistent":true}+ Config root hash: 6d5ed552f4487728d1ccec8604ddb44b66b18e3430614c20bb4d284995f99f63+ PCR: 14+ Sequence: 1+ TPM reset count: 1+ Restart count: 0+ Pending: no+ Consistent: yesThis output is from a target that runs its boot config. After an- update, ``root_hash`` is the root that ``image verify`` printed and- ``sequence`` is higher. ``pending`` must be ``false`` and- ``consistent`` must be ``true``. The command exits 1 otherwise. If an+ update, ``Config root hash`` is the root that ``image verify`` printed+ and ``Sequence`` is higher. ``Pending`` must be ``no`` and+ ``Consistent`` must be ``yes``. The command exits 1 otherwise, and+ ``--json`` prints the same fields as one JSON document. If anactivation stays pending, follow :doc:`/operate/maintain/backup-recovery`.Install a package@@ -246,9 +254,10 @@ Install a packagetarget# shirudo bpm list- The command prints one line per installed package: its name, its- version and the repository it came from, or ``direct`` for an- ``oci://`` install.+ The command prints ``Installed packages:``, a header and one line per+ installed package: its name, its version and the repository it came+ from, or ``direct`` for an ``oci://`` install. With no package+ installed it prints ``none``.#. Check that its upatches are loaded:@@ -422,8 +431,8 @@ longer than 30 seconds for it fails. A long download therefore delaysthe status keepalive and the map export, and a keepalive can fail whileit runs. :doc:`/operate/troubleshoot/troubleshooting` has the message.-Every command except ``status`` is refused while a config activation is-pending, ``bpm uninstall`` included. :doc:`/operate/maintain/backup-recovery`+Every command except ``status`` and ``image status`` is refused while a+config activation is pending, ``bpm uninstall`` included. :doc:`/operate/maintain/backup-recovery`describes that state.Next stepsdiff --git a/Documentation/operate/run/read-status.rst b/Documentation/operate/run/read-status.rstindex e35576e5..9868833c 100644--- a/Documentation/operate/run/read-status.rst+++ b/Documentation/operate/run/read-status.rst@@ -34,7 +34,7 @@ Print the report.. code-block:: console- target# shirudo status --show-full+ target# shirudo statusHost: docsRoles: targetMode: production@@ -63,62 +63,7 @@ Print the reportNAME LOCATION MAPS STATUS AGEshirudo-test-basic fentry/do_nanosleep 0 success 1s- Keyring (.bpf):- Serial: 272801410- Frozen serial: 272801410 (matches)- Certificates: 2 trusted, 0 revoked, 0 unvouched, 2 in the bpf keyring- a8be2bb837b0f052f7652f9edf446594a5465eed614d939964ddfcc96e61ba7f- CN=shirudo, ML-DSA-87, issued 2026-11-03- key 465853497 shirudo: 30dee65057025367c4c384928bcf1e4cd8fe0265 (frozen)- 6bd6b1a28b631295a013102d358d371d52ab1c894587aedceaf02e472c88f858 (primary)- CN=shirudo, ML-DSA-87, issued 2026-11-03- key 91435879 shirudo: 7fa1d435249690766f8b1397122775d26f1ed92e (frozen)-- Keyring (.dm-verity):- Serial: 799624487- Frozen serial: 799624487 (matches)- Certificates: 1 trusted, 1 in the dm-verity keyring- 6bd6b1a28b631295a013102d358d371d52ab1c894587aedceaf02e472c88f858 (config)- CN=shirudo, ML-DSA-87, issued 2026-11-03- key 403194297 shirudo: 7fa1d435249690766f8b1397122775d26f1ed92e (frozen)-- TPM measurement:- TPM: reachable (device:/dev/tpmrm0)- NV index: 0x01818E00 (anchored in PCR 9)- Chain: 7f63313a31ac8ddd3a6a16fce2038322c9c782d5787155d2dc18dfa582dff548- Register name: 000b21eb0d45ac9ee1bb0a87dbb069120e3b8cb251b3d40cc2a86a307ab73f728789- Anchored: yes, name on record- PCR before init: 0000000000000000000000000000000000000000000000000000000000000000- Phase at init: 0000000000000000000000000000000000000000000000000000000000000000 (PCR 11)- Bound in: initrd- Chain vs eventlog: matches- Eventlog: /var/lib/shirudo/eventlog (2 entries, 2324 bytes)-- Eventlog:- TIME TYPE DIGEST DETAIL- 2026-11-03T14:53:17Z init 377ce174fb1f set_digest=e3b0c44298fc..- 2026-11-03T14:54:33Z upatch_load d979b373d4e5 shirudo-test-basic payload=8aee7072a1a1..-- Assets (/var/lib/shirudo):- keys/cert.der present- keys/signing_key.pem absent- eventlog present (2324 bytes)- upatches/ 1 archived- incoming/ empty- bpffs/ mounted-- System:- OS: Ubuntu 26.04.1 LTS- Kernel: 7.3.0-bpf-next+- Kernel version: #1 SMP PREEMPT Tue Nov 3 13:54:40 UTC 2026- Kernel build ID: 132d1451aab18a693c59d5b9519d25a06f2236bf- Architecture: x86_64- CPUs: 4- Memory: 314M/3.85G- Disk: 1.99G/6.61G- Uptime: 0d 0h 1m- Machine ID: 6bae4cfbc0ed04ed63cc4cf8cb0a1b6c- Boot ID: 82639935-1127-4dab-91b5-f818eabc7f13+ Folded: keyrings, TPM measurement, assets (--show-full)2. The report folds the sections whose condition is ``OK``: thekeyrings, the TPM measurement and the assets. To print them all, and@@ -142,71 +87,92 @@ line; a section unfolds on its own when its condition is not ``OK``... code-block:: console- target# shirudo status+ target# shirudo status --show-fullHost: docsRoles: targetMode: productionStatus: ok- Version ID: 447b34bc8bc5547334ced4c737f987a9d3f8f03e332cf234626f0b81b5955064+ Version ID: d0d7aa800303439023907d1979d917d46a21bec21f816689c138728a28e84af9Conditions:- TYPE STATUS DETAIL- LsmAttached OK lsm/bpf link present and pinned- KeyringSealed OK bpf serial 130847582, dm-verity serial 962472513, pins match- ChainIntact OK live register equals the eventlog replay- UpatchesMeasured OK every pinned or archived upatch is in this boot's records- TpmMeasured OK NV index 0x01818E00 readable- ConfigActive OK config dc90bacc356f.. is active+ TYPE STATUS DETAIL+ LsmAttached OK lsm/bpf link present and pinned+ KeyringSealed OK bpf serial 272801410, dm-verity serial 799624487, pins match+ ChainIntact OK live register equals the eventlog replay+ UpatchesMeasured OK every pinned or archived upatch is in this boot's records+ TpmMeasured OK NV index 0x01818E00 readable+ ConfigActive OK config 6d5ed552f448.. is activeTamper attempts (this boot):- LoadNotLoader 21 program load that is not a signed loader+ LoadNotLoader 15 program load that is not a signed loaderMapCreate 1 map creation by another executable- BpfCommand 10 detach, update, delete or unclassified bpf() command+ BpfCommand 8 detach, update, delete or unclassified bpf() command+ BpffsUmount 1 unmount of the private bpffs+ SealWrite 1 write open of a sealed fileSealPtrace 7 ptrace of a shirudo task+ SealEntry 2 entry into a sealed directory, or a sealed inode linked++ Loaded upatches (1):+ NAME LOCATION MAPS STATUS AGE+ shirudo-test-basic fentry/do_nanosleep 0 success 1sKeyring (.bpf):- Serial: 130847582- Frozen serial: 130847582 (matches)+ Serial: 272801410+ Frozen serial: 272801410 (matches)Certificates: 2 trusted, 0 revoked, 0 unvouched, 2 in the bpf keyring- d1bc43c91b9dabf4cd6f3ddf08a177927b3dac8ca833ddc496167253761b4497 (primary)- CN=shirudo, ML-DSA-87, issued 2026-10-29- key 199275792 shirudo: 6ec99b4c3d1c51e461ce1299fae6ab87d212ce9c (frozen)- c1c30b07f86808e81ae1c0458c926f00b85bcc815d371d23d7683903f2d3266e- CN=shirudo, ML-DSA-87, issued 2026-10-29- key 106884895 shirudo: c350bd270c426c5760b202062e15e274ea30f45d (frozen)+ a8be2bb837b0f052f7652f9edf446594a5465eed614d939964ddfcc96e61ba7f+ CN=shirudo, ML-DSA-87, issued 2026-11-03+ key 465853497 shirudo: 30dee65057025367c4c384928bcf1e4cd8fe0265 (frozen)+ 6bd6b1a28b631295a013102d358d371d52ab1c894587aedceaf02e472c88f858 (primary)+ CN=shirudo, ML-DSA-87, issued 2026-11-03+ key 91435879 shirudo: 7fa1d435249690766f8b1397122775d26f1ed92e (frozen)Keyring (.dm-verity):- Serial: 962472513- Frozen serial: 962472513 (matches)+ Serial: 799624487+ Frozen serial: 799624487 (matches)Certificates: 1 trusted, 1 in the dm-verity keyring- d1bc43c91b9dabf4cd6f3ddf08a177927b3dac8ca833ddc496167253761b4497 (config)- CN=shirudo, ML-DSA-87, issued 2026-10-29- key 200951639 shirudo: 6ec99b4c3d1c51e461ce1299fae6ab87d212ce9c (frozen)-- Loaded upatches (1):- NAME LOCATION MAPS STATUS AGE- shirudo-test-basic fentry/do_nanosleep 0 success 2s+ 6bd6b1a28b631295a013102d358d371d52ab1c894587aedceaf02e472c88f858 (config)+ CN=shirudo, ML-DSA-87, issued 2026-11-03+ key 403194297 shirudo: 7fa1d435249690766f8b1397122775d26f1ed92e (frozen)TPM measurement:TPM: reachable (device:/dev/tpmrm0)NV index: 0x01818E00 (anchored in PCR 9)- Chain: 0307d216caac3067fe645d4a548b25ac5ed0f1e8cf5ae3b189feaefc47e81a84- Register name: 000b9b7b0f925415fdf0d5676369f8cc9146b9e3142537148b31e79dbffcc96e72f8- Anchored: yes (name on record)+ Chain: 7f63313a31ac8ddd3a6a16fce2038322c9c782d5787155d2dc18dfa582dff548+ Register name: 000b21eb0d45ac9ee1bb0a87dbb069120e3b8cb251b3d40cc2a86a307ab73f728789+ Anchored: yes, name on recordPCR before init: 0000000000000000000000000000000000000000000000000000000000000000Phase at init: 0000000000000000000000000000000000000000000000000000000000000000 (PCR 11)Bound in: initrdChain vs eventlog: matchesEventlog: /var/lib/shirudo/eventlog (2 entries, 2324 bytes)+ Eventlog:+ TIME TYPE DIGEST DETAIL+ 2026-11-03T14:53:17Z init 377ce174fb1f set_digest=e3b0c44298fc..+ 2026-11-03T14:54:33Z upatch_load d979b373d4e5 shirudo-test-basic payload=8aee7072a1a1..+Assets (/var/lib/shirudo):keys/cert.der presentkeys/signing_key.pem absenteventlog present (2324 bytes)- upatches/ 1 .upatch+ upatches/ 1 archivedincoming/ emptybpffs/ mounted+ System:+ OS: Ubuntu 26.04.1 LTS+ Kernel: 7.3.0-bpf-next++ Kernel version: #1 SMP PREEMPT Tue Nov 3 13:54:40 UTC 2026+ Kernel build ID: 132d1451aab18a693c59d5b9519d25a06f2236bf+ Architecture: x86_64+ CPUs: 4+ Memory: 314M/3.85G+ Disk: 1.99G/6.61G+ Uptime: 0d 0h 1m+ Machine ID: 6bae4cfbc0ed04ed63cc4cf8cb0a1b6c+ Boot ID: 82639935-1127-4dab-91b5-f818eabc7f13+The sections below explain each part.Header@@ -240,7 +206,7 @@ HeaderConditions~~~~~~~~~~-Five conditions, each ``OK``, ``WARN`` or ``ALERT`` with a detail. The+Six conditions, each ``OK``, ``WARN`` or ``ALERT`` with a detail. Theverdict is derived from them... list-table::@@ -256,8 +222,8 @@ verdict is derived from them.- The live ``.bpf`` and ``.dm-verity`` keyrings are the ones``init`` sealed and recorded in the frozen identity map, theyhold no link ``init`` did not freeze, and ``.dm-verity`` still- holds the config key. ``WARN`` ``shirudo keyring absent (not- init'd?)`` before ``init``. ``ALERT`` after it names the keyring+ holds the config key. ``WARN`` ``.bpf keyring absent before+ init`` before ``init``. ``ALERT`` after it names the keyringand what changed: a swapped or missing keyring, links ``init``did not freeze, or the missing config key.* - ``ChainIntact``@@ -292,8 +258,9 @@ Tamper attemptsThe counters of attempts this boot, one per guard point, each refusedthere except ``SealSignal``, which is let through and counted, with thecounters that are not zero listed by name, count and meaning. ``none``-means every counter is zero. ``(none recorded: init has not pinned the-counters this boot)`` means ``init`` did not get that far.+means every counter is zero. ``none recorded before init`` means+``init`` did not get as far as pinning the counters, and ``unavailable:+<error>`` that they could not be read.:ref:`status-tamper-counters` explains how to read them.Keyrings@@ -337,7 +304,7 @@ roots, read the same way.Shown only when the keyring holds a link that is no certificate'skey. Each line names the kind of link, ``key`` for a public key orthe kernel's type such as ``keyring``, its serial and description,- and ``(NOT frozen)`` when ``init`` did not record it. The kernel+ and ``(not frozen)`` when ``init`` did not record it. The kerneltrusts every key such a link reaches, so ``KeyringSealed`` is``ALERT`` and the verdict ``tampered``.@@ -346,8 +313,8 @@ Loaded upatchesOne row per upatch pinned in the private bpffs: its name, the attachlocation resolved from kernel BTF, its number of maps, ``success`` and-the time since it was loaded. ``Loaded upatches (0):`` with no rows-means nothing is loaded.+the time since it was loaded. ``Loaded upatches (0):`` followed by+``none`` means nothing is loaded.TPM measurement~~~~~~~~~~~~~~~@@ -367,8 +334,8 @@ TPM measurementThe TPM name of the NV index, which binds its attributes and policy.``Anchored``- ``yes (name on record)`` when the index is the one ``init`` bound and- recorded. ``NO (index is not the one init bound)`` otherwise.+ ``yes, name on record`` when the index is the one ``init`` bound and+ recorded. ``no, the index is not the one init bound`` otherwise.``PCR before init`` and ``Phase at init``The values of PCR 9 and PCR 11 that ``init`` bound the register to.@@ -389,7 +356,7 @@ TPM measurementreset: ``<n> for this TPM reset, rebound after init``.``Chain vs eventlog``- ``matches``, ``MISMATCH`` or ``n/a`` when there is no+ ``matches``, ``mismatch`` or ``not evaluated`` when there is noregister to compare.``Eventlog``@@ -410,7 +377,7 @@ Assets``eventlog``Whether ``/var/lib/shirudo/eventlog`` exists, and its size.-:src:`upatches/`+``upatches/``The number of archived upatches that ``init`` restores at the nextboot.@@ -421,9 +388,11 @@ AssetsEventlog~~~~~~~~-With ``--include-eventlog`` the report adds every record of the-eventlog, of all boots, between the ``TPM measurement`` and ``Assets``-sections. This target recorded its boot, then one load and one unload:+With ``--include-eventlog`` the report adds an ``Eventlog`` section with+every record of the eventlog, of all boots, after the loaded upatches,+or between the ``TPM measurement`` and ``Assets`` sections when those+are printed. This target recorded its boot, then one load and one+unload:.. code-block:: console@@ -499,7 +468,7 @@ The register does not replay from the eventlog:Status: tampered (live register differs from the eventlog replay)...- ChainIntact ALERT live register differs from the eventlog replay+ ChainIntact ALERT live register differs from the eventlog replaySomething extended or replaced the register without a matching eventlogrecord, the eventlog of this boot was altered or hidden, or the index is@@ -512,7 +481,7 @@ A upatch is pinned or archived without a record:Status: tampered (a upatch is pinned or archived without a record of this boot)...- UpatchesMeasured ALERT 1 pinned or archived without a record of this boot: <name>+ UpatchesMeasured ALERT 1 pinned or archived without a record of this boot: <name>A load was stopped between its pins and its extend, so the upatch runswhile the register does not cover it, an unload was stopped after its@@ -529,7 +498,7 @@ The live keyring is not the one ``init`` sealed:Status: tampered (keyring serial swap detected)...- KeyringSealed ALERT pinned serial <pinned>, live serial <live>: swapped+ KeyringSealed ALERT pinned serial <pinned>, live serial <live>: swappedThe keyring ``init`` sealed is gone:@@ -537,7 +506,7 @@ The keyring ``init`` sealed is gone:Status: tampered (the keyring init froze is gone)...- KeyringSealed ALERT pinned serial <pinned>, the .bpf keyring is gone+ KeyringSealed ALERT pinned serial <pinned>, the .bpf keyring is goneThe same for ``.dm-verity`` reads ``dm-verity keyring serial swapdetected`` or ``the dm-verity keyring init froze is gone``.@@ -549,10 +518,10 @@ for signatures from then on:Status: tampered (a keyring holds a link init did not freeze)...- KeyringSealed ALERT the dm-verity keyring holds 1 link init did not freeze+ KeyringSealed ALERT the dm-verity keyring holds 1 link init did not freezeThe keyring section lists that link under ``Other links`` with-``(NOT frozen)``. If instead the config key is gone from+``(not frozen)``. If instead the config key is gone from``.dm-verity``, the reason is ``the config key init froze is gone``.The config cannot be verified against its records:@@ -561,7 +530,7 @@ The config cannot be verified against its records:Status: tampered (the selected config cannot be verified against its records)...- ConfigActive ALERT the config PCR, activation records and mounted config disagree+ ConfigActive ALERT the config PCR, activation records and mounted config disagreeThe detail of ``ConfigActive`` names the cause:@@ -592,7 +561,7 @@ journal and the state of this boot are the evidence. FollowStatus: lsm-off (LSM not attached, enforcement off)...- LsmAttached ALERT lsm/bpf link absent, enforcement off+ LsmAttached ALERT lsm/bpf link absent, enforcement offEnforcement is not up. Root can load BPF, and the seal on shirudo'sstate is not enforced. A failure of ``init`` in the initrd does not stop@@ -619,7 +588,7 @@ in this state. So does a target booted without the shirudo initrd.Status: reboot-pending (a config activation is pending until the next reboot)...- ConfigActive WARN the activation of config <root>.. is pending until the next reboot+ ConfigActive WARN the activation of config <root>.. is pending until the next rebootA config activation was recorded as pending and did not complete. Thishappens when ``shirudo image update`` is interrupted after it saved the@@ -655,19 +624,20 @@ its own.Status: degraded (no register bound this boot)...- ChainIntact WARN no register bound this boot (init incomplete)- UpatchesMeasured WARN no record of this boot to check the pins against- TpmMeasured WARN NV index 0x01818E00 not bound this boot+ ChainIntact WARN no register bound this boot (init incomplete)+ UpatchesMeasured WARN no record of this boot to check the pins against+ TpmMeasured WARN NV index 0x01818E00 not bound this bootEnforcement is up, but the TPM holds no written measurement register, or``status`` could not read it. The ``Chain`` line of the ``TPM-Measurement`` section tells the two apart: ``unavailable (register not-bound this boot)`` or ``unavailable (TPM error: <error>)``.+measurement`` section, which unfolds in this state, tells the two+apart: ``unavailable, register not bound this boot`` or ``unavailable,+TPM error: <error>``.A failure of ``init`` while binding the register leaves the configactivation pending, which shows as ``reboot-pending``. A ``degraded``-verdict whose ``Chain`` line says ``register not bound this boot``-therefore means the register was bound and then disappeared. Undefining+verdict whose ``Chain`` line says ``unavailable, register not bound this+boot`` therefore means the register was bound and then disappeared. Undefiningthe index takes TPM owner authorization, which root has on a TPM whoseowner authorization is empty. Collect the evidence as for ``tampered``,see :doc:`/operate/troubleshoot/incident-tampered`, then reboot.@@ -749,10 +719,11 @@ keepalive timer sends it to your collector, see.. warning::``shirudo status`` exits 0 whatever the verdict, ``tampered``- included. It exits 1 only when it cannot load its configuration, runs- out of memory or fails to send a keepalive, and 2 on a usage error or- an invalid ``map_export`` setting. Alert on the ``status`` field of- the JSON document, never on the exit code.+ included, unless you pass ``--check``, which exits 1 on ``tampered``+ and 0 on every other verdict. It exits 1 also when it cannot load its+ configuration, runs out of memory or fails to send a keepalive, and 2+ on a usage error or an invalid ``map_export`` setting. Alert on the+ ``status`` field of the JSON document, not on the exit code.Read the verdict:diff --git a/Documentation/operate/run/telemetry.rst b/Documentation/operate/run/telemetry.rstindex 3269a8ec..7ffb54f1 100644--- a/Documentation/operate/run/telemetry.rst+++ b/Documentation/operate/run/telemetry.rst@@ -328,7 +328,8 @@ Check the pipeline.. code-block:: consoletarget# shirudo upatch map- (no pinned maps)+ Pinned maps (0):+ noneThis target has no upatch with maps loaded. With maps, the commandlists each map with its upatch, type and size.@@ -400,15 +401,16 @@ The keepalive body is the ``shirudo status --json`` document.* - ``shirudo.status`` other than ``ok``- Read :doc:`/operate/run/read-status` for each verdict.* - A condition with ``status`` ``ALERT``- - ``LsmAttached``, ``KeyringSealed``, ``ChainIntact`` or- ``ConfigActive`` found tampering or lost enforcement.+ - ``LsmAttached``, ``KeyringSealed``, ``ChainIntact``,+ ``UpatchesMeasured`` or ``ConfigActive`` found tampering or lost+ enforcement.* - ``shirudo.tamper_attempts`` rises- Something on the target tried an operation the guards refused.The counters start at zero each boot. See:doc:`/security/tamper-counters`.* - ``config.activation_pending`` is ``true``- A config activation waits for a reboot. Every command except- ``status`` is refused until then.+ ``status`` and ``image status`` is refused until then.* - ``tpm.chain_matches_eventlog`` is ``false``- The register holds a value the eventlog does not explain. Handleit as in :doc:`/operate/troubleshoot/incident-tampered`.diff --git a/Documentation/operate/troubleshoot/incident-tampered.rst b/Documentation/operate/troubleshoot/incident-tampered.rstindex a4cd5949..392d2d0f 100644--- a/Documentation/operate/troubleshoot/incident-tampered.rst+++ b/Documentation/operate/troubleshoot/incident-tampered.rst@@ -72,9 +72,9 @@ Preserve the evidencetarget# shirudo status --json --include-eventlog > status.json- ``status`` runs in every state, and it exits 0 even when the verdict is- ``tampered``. Keep the file, but do not rely on it: the target wrote- it.+ ``status`` runs in every state, and without ``--check`` it exits 0+ even when the verdict is ``tampered``. Keep the file, but do not rely+ on it: the target wrote it.3. Copy the eventlog, the pending init record and the config activationrecords:@@ -173,8 +173,9 @@ Read the resultrecords do not cover. The ``event after boot`` notes list them.Each was a signed artifact that a process with shirudo'sauthority loaded or unloaded.- - Match every note with the journal's ``upatch load measured`` and- ``upatch unload measured`` lines and with your change records,+ - Match every note with the journal's ``upatch load: <name>+ measured, register <value>`` and ``upatch unload: <name>+ measured, register <value>`` lines and with your change records,timers and tree included. A change nobody authorized means asigning key or root on the target is compromised.* - ``FAIL`` on ``eventlog:`` replay, ``register:``, ``anchor:`` ordiff --git a/Documentation/operate/troubleshoot/troubleshooting.rst b/Documentation/operate/troubleshoot/troubleshooting.rstindex a7383ad7..87261079 100644--- a/Documentation/operate/troubleshoot/troubleshooting.rst+++ b/Documentation/operate/troubleshoot/troubleshooting.rst@@ -24,33 +24,35 @@ Before you begin:ref:`runtime-invocation`.- Run ``shirudo status`` first. It is the target's own report, and itstill runs when most other commands refuse. The ``Status`` line gives- the verdict, and the five conditions below it the checks the verdict+ the verdict, and the six conditions below it the checks the verdictis derived from. A healthy target starts its report like this:.. code-block:: consoletarget# shirudo status- Host: docs- Roles: target- Mode: production- Status: ok- Version ID: 447b34bc8bc5547334ced4c737f987a9d3f8f03e332cf234626f0b81b5955064+ Host: docs+ Roles: target+ Mode: production+ Status: ok+ Version ID: d0d7aa800303439023907d1979d917d46a21bec21f816689c138728a28e84af9Conditions:- TYPE STATUS DETAIL- LsmAttached OK lsm/bpf link present and pinned- KeyringSealed OK bpf serial 130847582, dm-verity serial 962472513, pins match- ChainIntact OK live register equals the eventlog replay- TpmMeasured OK NV index 0x01818E00 readable- ConfigActive OK config dc90bacc356f.. is active+ TYPE STATUS DETAIL+ LsmAttached OK lsm/bpf link present and pinned+ KeyringSealed OK bpf serial 272801410, dm-verity serial 799624487, pins match+ ChainIntact OK live register equals the eventlog replay+ UpatchesMeasured OK every pinned or archived upatch is in this boot's records+ TpmMeasured OK NV index 0x01818E00 readable+ ConfigActive OK config 6d5ed552f448.. is active...A verdict other than ``ok`` is followed by its reason in parentheses,and the condition that raised it shows ``WARN`` or ``ALERT`` with adetail. Look the verdict up under `Status verdicts`_. ``status`` exits- 0 whatever the verdict, so read the ``Status`` line, not the exit- status. If ``status`` itself prints ``shirudo: image state:``, start- from that message under `Commands refused before they run`_.+ 0 whatever the verdict unless you pass ``--check``, so read the+ ``Status`` line, not the exit status. If ``status`` itself prints+ ``shirudo: image state:``, start from that message under `Commands+ refused before they run`_.- Every message shirudo prints also goes to the journal under theidentifier ``shirudo``. Read the messages of this boot, and the two``init`` runs, with:@@ -225,7 +227,7 @@ need it. Nothing changed on the target unless the entry says otherwise... code-block:: consoletarget# shirudo upatch load --expect-chain=0000000000000000000000000000000000000000000000000000000000000000 --report=- /mnt/shirudo-bundle/fixtures/shirudo-test-lifecycle.upatch- upatch load: pre-flight refused (category: tampered, message: chain_drift) -- live chain c50b22ac27c5bb6a90ee5ff9b440fbbd5bb60b84a2aa7b395daec3f330886fcd != expected; re-status and re-issue with the refreshed value+ upatch load: pre-flight refused (category: tampered, message: chain_drift): live register c50b22ac27c5bb6a90ee5ff9b440fbbd5bb60b84a2aa7b395daec3f330886fcd is not the expected one; run status and pass the refreshed value{"schema":1,"result":"failed","op":"upatch_load","phase":"pre_flight","errno":1,"errno_name":"EPERM","category":"tampered","message":"pre-flight check failed",...}Meaning@@ -255,7 +257,7 @@ Action.. code-block:: consoletarget# shirudo upatch load --expect-version-id=0000000000000000000000000000000000000000000000000000000000000000 --report=- /mnt/shirudo-bundle/fixtures/shirudo-test-lifecycle.upatch- upatch load: version mismatch -- operator expects 0000000000000000000000000000000000000000000000000000000000000000, target is 58b05ab35a2bcefaa649faf15f8c6be0211e24cea710450c1a29298c3b5c7de0; redeploy a matching shirudo or pass --no-version-check+ upatch load: version mismatch, the operator expects 0000000000000000000000000000000000000000000000000000000000000000 and the target is 58b05ab35a2bcefaa649faf15f8c6be0211e24cea710450c1a29298c3b5c7de0; deploy a matching shirudo or pass --no-version-check{"schema":1,"result":"failed","op":"upatch_load","phase":"pre_flight","errno":1,"errno_name":"EPERM","category":"version_mismatch","message":"SHIRUDO_VERSION_ID mismatch (operator vs target)",...}Meaning@@ -336,8 +338,8 @@ was built with... code-block:: consoletarget# shirudo upatch unload --report=- /mnt/shirudo-bundle/fixtures/shirudo-test-basic-mismatch.unload.upatch- loaded signed loader: prog_fd=10 keyring=420195959 sig=4853B insns=165 data=2808B- upatch unload: payload_mismatch -- the upatch loaded under 'shirudo-test-basic' is not what the directive expects; refusing+ upatch unload: signed loader accepted, keyring 272801410, 165 instructions+ upatch unload: payload_mismatch, the upatch loaded under 'shirudo-test-basic' is not what the directive expects; refusedupatch unload failed: name=shirudo-test-basic phase=pin category=payload_mismatch err=1 (Operation not permitted) message=loaded payload does not match directive{"schema":1,"result":"failed","op":"upatch_unload","phase":"pin","errno":1,"errno_name":"EPERM","category":"payload_mismatch","message":"loaded payload does not match directive",...}@@ -365,8 +367,8 @@ Actionoperator$ shirudo build --unload <name> --payload-sha256 <payload> --keys-dir <keys-dir> -o <name>.unload.upatch``<name>`` is the upatch name, ``<payload>`` the 64-character digest-from the ``Payload:`` line, and ``<keys-dir>`` the directory of a trusted-signing key.+from the ``Payload sha256:`` line, and ``<keys-dir>`` the directory of a+trusted signing key.``attach_target_missing``~~~~~~~~~~~~~~~~~~~~~~~~~@@ -449,7 +451,7 @@ MeaningThe next record would take the eventlog past ``eventlog.max_bytes``.The command refused before it loaded or extended anything:``upatch load: eventlog /var/lib/shirudo/eventlog would exceed- eventlog.max_bytes=<n>; refusing -- no load, no extend``.+ eventlog.max_bytes <n>; refused, nothing loaded or extended``.CausesThe eventlog grows by one record per boot, load, unload, revocation@@ -470,7 +472,7 @@ Boot and initMeaningOne of the checks ``init`` runs before it changes anything failed.``init`` prints a table with ``FAIL`` and a detail for each failed- check, then ``init: pre-flight failed (<failed>/<total> checks)``.+ check, then ``init: pre-flight failed, <failed> of <total> checks``.In the initrd the table is in the journal of``shirudo-initrd.service``. A passing run looks like this:diff --git a/Documentation/reference/cheat-sheet.rst b/Documentation/reference/cheat-sheet.rstindex 9674fe83..76184954 100644--- a/Documentation/reference/cheat-sheet.rst+++ b/Documentation/reference/cheat-sheet.rst@@ -105,14 +105,8 @@ even when the verdict is ``tampered``:target# shirudo status --json | jq -r .status-Show everything, with the eventlog, the system, the kernel log and the-modules, with :doc:`cli/status`:--.. code-block:: console-- target# shirudo status --show-full--Add the last 50 kernel log lines with :doc:`cli/status`:+Show everything, the folded sections, the eventlog and the system, with+:doc:`cli/status`:.. code-block:: consolediff --git a/Documentation/reference/cli/attest-challenge.rst b/Documentation/reference/cli/attest-challenge.rstindex aabd2e7e..17d9533b 100644--- a/Documentation/reference/cli/attest-challenge.rst+++ b/Documentation/reference/cli/attest-challenge.rst@@ -20,11 +20,12 @@ Usage.. code-block:: none- shirudo attest challenge --evidence=<evidence> --output=<challenge>+ shirudo attest challenge --evidence=<evidence> (-o <challenge> | --output=<challenge>)(--ek-ca=<bundle> | --ek-name=<name> | --trust-presented-ek)[--ak-name=<name>]-Every option takes its value after ``=``.+Every option takes its value after ``=`` or as the next argument, and+``-o`` is ``--output``.Description-----------@@ -68,7 +69,7 @@ Options* - ``--evidence``- ``<evidence>``, a file- Required. Evidence from the target.- * - ``--output``+ * - ``--output``, ``-o``- ``<challenge>``, a path- Required. Where to write the challenge.* - ``--ak-name``@@ -99,9 +100,10 @@ Exit status- A check failed (``verdict: fail``), or the challenge could not bewritten.* - 2- - ``--evidence`` or ``--output`` missing, an unknown option or invalid- value, an unreadable evidence file, or evidence that carries no- endorsement key.+ - ``--evidence`` or ``--output`` missing, an unknown option, an+ option given last without its value, an invalid value, an+ unreadable evidence file, or evidence that carries no endorsement+ key.Examples--------diff --git a/Documentation/reference/cli/attest-predict.rst b/Documentation/reference/cli/attest-predict.rstindex 68e5ccc9..6c09fda8 100644--- a/Documentation/reference/cli/attest-predict.rst+++ b/Documentation/reference/cli/attest-predict.rst@@ -24,11 +24,10 @@ Usage[--expect=<name>=<digest>]... [--tree-root=<digest>][--event=<event>]...[--bind-pcr=9=<value> --bind-pcr=11=<value>- --writer-public=<modulus>]+ --writer-public=<modulus>] [--json]-Every option takes its value after ``=``. ``--cert cert.der`` with a space-is refused. On a host where enforcement is up the image gate refuses-``--cert``.+Every option takes its value after ``=`` or as the next argument. On a+host where enforcement is up the image gate refuses ``--cert``.Description-----------@@ -149,9 +148,9 @@ Exit status- The register's write policy could not be computed, or memory ranout.* - 2- - No ``--cert``, an unknown option, an unreadable file, an invalid- value or event, or ``--bind-pcr`` without both PCRs or without- ``--writer-public``.+ - No ``--cert``, an unknown option, an option given last without+ its value, an unreadable file, an invalid value or event, or+ ``--bind-pcr`` without both PCRs or without ``--writer-public``.Examples--------diff --git a/Documentation/reference/cli/attest-verify.rst b/Documentation/reference/cli/attest-verify.rstindex 977cdef0..2f99f20a 100644--- a/Documentation/reference/cli/attest-verify.rst+++ b/Documentation/reference/cli/attest-verify.rst@@ -28,17 +28,18 @@ Usage[--expect-config-root=<root> --expect-config-pcr=<pcr>][--expect-pcr=<pcr>=<value>]...[--expect-bind-pcr=<pcr>=<value>]...- [--strict-anchor] [--require-initrd]+ [--strict-anchor] [--require-initrd] [--json]-Every option takes its value after ``=``. On a host where enforcement is up-the image gate refuses ``--cert``. Run ``verify`` where enforcement is not-up.+Every option takes its value after ``=`` or as the next argument. On a+host where enforcement is up the image gate refuses ``--cert``. Run+``verify`` where enforcement is not up.Description------------``verify`` prints one line per check, ``ok:``, ``FAIL:`` or ``note:``,-followed by ``verdict: ok`` or ``verdict: fail``. It checks:+``verify`` prints one line per check, ``OK`` or ``FAIL``, and one per+note, ``NOTE``, followed by ``verdict: ok`` or ``verdict: fail``. It+checks:- the nonce, in the document, the quote and the register certification- the attestation key: restricted, fixed to its TPM, its name matching its@@ -151,9 +152,10 @@ Exit status* - 1- ``verdict: fail``.* - 2- - A usage error or an invalid value, ``--evidence`` or ``--nonce``- missing, an option that needs another, an unreadable evidence file- or a file that is not a shirudo evidence document.+ - A usage error or an invalid value, an option given last without+ its value, ``--evidence`` or ``--nonce`` missing, an option that+ needs another, an unreadable evidence file or a file that is not a+ shirudo evidence document.Examples--------@@ -182,19 +184,19 @@ attestation key pinned:OK register: certified contents match the listed valueOK quote and certification are of one TPM resetOK config: config root history matches the quoted PCR- note config root has no operator approval; use --expect-config-root with --expect-config-pcr- note config records a selection; direct TPM writer protection is deferred+ NOTE config root has no operator approval; use --expect-config-root with --expect-config-pcr+ NOTE config records a selection; direct TPM writer protection is deferredOK eventlog: this boot has an init recordOK register: the document names index 0x01818E00 and PCRs 9 and 11OK register: public area is bound to PCRs 9 and 11 as recorded- note binding: made in the initrd+ NOTE binding: made in the initrdOK eventlog: one init record for this TPM reset (1 this boot)OK register: init record is of the TPM's current reset countOK eventlog: 2 records replay to the certified valueOK anchor: record digest matches the index nameOK anchor: PCR 9 equals the recorded value extended by the anchorOK state: register equals the expected value- note event after boot: upatch_load basic+ NOTE event after boot: upatch_load basicverdict: ok``$NONCE`` holds the nonce given to ``shirudo attest``, ``<ak-name>`` the@@ -221,8 +223,8 @@ after boot:OK anchor: PCR 9 equals the recorded value extended by the anchorFAIL state: init event covers the expected certificate, set and tree rootFAIL state: 2 events after boot change the register- note event after boot: upatch_load shirudo-test-basic- note event after boot: upatch_unload shirudo-test-basic+ NOTE event after boot: upatch_load shirudo-test-basic+ NOTE event after boot: upatch_unload shirudo-test-basicverdict: failThe first ``FAIL`` line says that the target enrolls a certificate setdiff --git a/Documentation/reference/cli/attest.rst b/Documentation/reference/cli/attest.rstindex 95e1d69a..a478f497 100644--- a/Documentation/reference/cli/attest.rst+++ b/Documentation/reference/cli/attest.rst@@ -21,16 +21,16 @@ Usage.. code-block:: noneshirudo attest [--nonce=<nonce>] [--pcrs=<list>] [--challenge=<challenge>]- [--output=<path>]+ [-o <path> | --output=<path>]shirudo attest verify ...shirudo attest predict ...shirudo attest challenge ...shirudo attest --list-cmds-Every option takes its value after ``=``. ``attest`` with no argument-produces evidence. It does not print help. The subcommands run on the-operator host: :doc:`attest-verify`, :doc:`attest-predict`,-:doc:`attest-challenge`.+Every option takes its value after ``=`` or as the next argument, and+``-o`` is ``--output``. ``attest`` with no argument produces evidence. It+does not print help. The subcommands run on the operator host:+:doc:`attest-verify`, :doc:`attest-predict`, :doc:`attest-challenge`.Description-----------@@ -80,7 +80,7 @@ Options- ``<challenge>``, a file- none- Credential challenge from ``attest challenge`` to activate.- * - ``--output``+ * - ``--output``, ``-o``- ``<path>``- standard output- Write the evidence to ``<path>`` with mode 0600. A path in sealed@@ -100,11 +100,13 @@ Exit status* - 1- No TPM answered (``attest: no TPM answered (tpm_error)``), theregister is not bound this boot, the TPM refused the challenge- (``attest: the challenge was refused (tampered?)``), or producing+ (``attest: the TPM refused the challenge; the attestation key or+ the endorsement key is not this TPM's``), or producingor writing the evidence failed.* - 2- - An unknown option, an invalid ``--nonce`` or ``--pcrs``, or a- ``--challenge`` file that is not a shirudo credential challenge.+ - An unknown option, an option given last without its value, an+ invalid ``--nonce`` or ``--pcrs``, or a ``--challenge`` file that+ is not a shirudo credential challenge.Files and environment---------------------diff --git a/Documentation/reference/cli/bpm.rst b/Documentation/reference/cli/bpm.rstindex e6d24a6a..009620fa 100644--- a/Documentation/reference/cli/bpm.rst+++ b/Documentation/reference/cli/bpm.rst@@ -135,7 +135,9 @@ image, the image's ``etc/shirudo/bpm/registries.d/`` is used instead, andpath and that ``--cert`` is a certificate, copies the certificate to``/etc/shirudo/bpm/keys/<source>.der`` and writes the source file.Arguments after the endpoint other than ``--cert`` are ignored.-- ``list`` prints the registered source names, one per line.+- ``list`` prints the registered source names under the heading+ ``Registered sources:``, or ``none``. With ``--json`` it prints one+ object with ``schema`` and ``sources``.- ``remove`` and ``rm`` delete the source file and its certificate.The key file verifies the signed index of the repository@@ -151,12 +153,11 @@ the Beefile's ``update`` command for each input to produce the new``.rodata`` (``--rodata-input`` replaces an input file), signs the upatchagain and signs a new unload directive for it. The base package must besigned by the same key and declare ``.rodata`` inputs, and ``--version``-must be greater than its version. Without ``-f``, the Beefile and the+must be greater than its version. Without ``--file``, the Beefile and thecommands it names come from the base package and run on the operatorhost: take base packages only from sources you trust. The output is``<name>-<version>.bee`` in the current directory. Options take their-value as the next argument only. The subcommand's ``--help`` does not list-``--keys-dir``.+value as the next argument only.repo update-----------@@ -236,10 +237,9 @@ keyrefuses with ``EPERM``. On a target with a config image ``add`` isrefused.- ``key list`` prints the fingerprints of the certificates in- ``/var/lib/shirudo/keys``, as a list under a heading or, with- ``--json``, as one object with ``schema`` and ``fingerprints``.- ``list`` and ``config register list`` take ``--json`` the same way,- with ``packages`` (``name``, ``version``, ``source``) and ``sources``.+ ``/var/lib/shirudo/keys`` under the heading ``Package certificates:``,+ or ``none``. With ``--json`` it prints one object with ``schema`` and+ ``fingerprints``.``key add`` with an ``oci://`` reference installs the certificate theregistry serves. Run ``key fingerprint`` on the same reference first and@@ -278,8 +278,8 @@ build``build`` builds and signs a package from a Beefile(:doc:`/upatches/publish/beefile`):-- The Beefile is ``-f``, else ``<context>/Beefile``, with ``<context>``- defaulting to the current directory.+- The Beefile is ``--file``, else ``<context>/Beefile``, with+ ``<context>`` defaulting to the current directory.- The keys directory is ``--keys-dir`` (a leading ``~`` is expanded), else``$SHIRUDO_KEYS_DIR``, else ``/var/lib/shirudo/keys``.- ``vmlinux.h`` is ``--vmlinux``, else ``./vmlinux.h`` or@@ -330,7 +330,11 @@ runs the timer.reverse name order, each measured, removes the package directory anddrops it from the state.-``list`` prints ``<name> <version> <source>`` for each installed package.+``list`` prints the installed packages under the heading ``Installed+packages:`` as a table with the columns ``NAME``, ``VERSION`` and+``SOURCE``, or ``none``. With ``--json`` it prints one object with+``schema`` and ``packages``, a list of ``name``, ``version`` and+``source``.Exit status-----------@@ -357,9 +361,6 @@ Exit status* - 127- A helper subcommand cannot execute ``shirudo-build``.-``bpm install --help`` and ``bpm repo update --help`` do not print help:-they treat ``--help`` as a package and a source.-Files and environment---------------------@@ -386,13 +387,17 @@ entry:operator$ shirudo bpm build ./example-shield --version 1.0.0 --keys-dir ~/shirudo-keysoperator$ shirudo bpm push ./example-shield-1.0.0.bee oci://quay.io/example/example-shield --keys-dir ~/shirudo-keys-On a target, refresh the indexes, install a pinned version and list the-packages:+On a target, refresh the indexes and install a pinned version:.. code-block:: consoletarget# shirudo bpm repo updatetarget# shirudo bpm install example/[email protected]++List the packages of a target without any:++.. code-block:: console+target# shirudo bpm listInstalled packages:nonediff --git a/Documentation/reference/cli/build.rst b/Documentation/reference/cli/build.rstindex 968d4154..738bbd74 100644--- a/Documentation/reference/cli/build.rst+++ b/Documentation/reference/cli/build.rst@@ -21,12 +21,13 @@ Usage.. code-block:: none- shirudo build <input> [-o <output>] [--name <name>]+ shirudo build <input> [-o <output> | --output <output>] [--name <name>][--keys-dir <dir> | --keys-dir=<dir>][--key <signing-key>] [--cert <certificate>][--vmlinux <vmlinux-h>] [--extra-cflags <flags>][--emit-artifacts]- shirudo build --unload <name> [-o <output>] [--payload-sha256 <digest>]+ shirudo build --unload <name> [-o <output> | --output <output>]+ [--payload-sha256 <digest>][--keys-dir <dir> | --keys-dir=<dir>][--key <signing-key>] [--cert <certificate>]shirudo build --help@@ -34,7 +35,8 @@ UsageEvery option except ``--keys-dir`` takes its value as the next argument.The form ``--option=<value>`` is refused as an unknown option, except-``--keys-dir=<dir>``. Options and the input may come in any order.+``--keys-dir=<dir>``. ``-o`` and ``--output`` are the same option.+Options and the input may come in any order.``shirudo build`` executes the ``shirudo-build`` helper with the samearguments (see :doc:`shirudo` for how it finds the helper).@@ -61,8 +63,9 @@ Building a upatch``vmlinux.h`` (``/usr/share/shirudo/vmlinux.h`` in the operatorpackage, ``/usr/local/share/shirudo/vmlinux.h`` after ``makeinstall``). It then runs ``/usr/bin/clang -target bpf -mcpu=v4- -fno-jump-tables -O2 -g -Wall -Wextra -Wshadow -Wtype-limits`` with- the ``vmlinux.h`` directory, the libbpf headers and the shirudo BPF+ -fno-jump-tables -O2 -g -Wall -Wextra -Wshadow -Wtype-limits+ -Wno-missing-declarations -Wno-unused-parameter`` with the+ ``vmlinux.h`` directory, the libbpf headers and the shirudo BPFheaders on the include path, plus ``--extra-cflags``. ``-mcpu=v4``selects BPF instruction set v4, the newest clang knows and one everytarget kernel runs. ``-fno-jump-tables`` keeps a ``switch`` in@@ -95,17 +98,14 @@ digest:characters. Read it from the artifact with ``upatch info --json`` (key``payload_sha256``).#. Without ``--payload-sha256``, the helper reads the digest from- ``/var/lib/shirudo/upatches/<name>.upatch`` on the host it runs on.- Without that file it signs 32 zero bytes and prints a warning.+ ``/var/lib/shirudo/upatches/<name>.upatch`` on the host it runs on,+ and refuses with exit status 2 when that file is absent.#. The output is ``-o``, else ``<name>.unload.upatch`` in the currentdirectory.A target applies a directive only to an upatch whose loaded payload-digest equals the signed one (:doc:`upatch-unload`). The helper's warning-and ``--help`` say that an all-zero digest makes the target skip that-check. It does not: the target compares the digests and refuses a-directive with a zero digest with ``payload_mismatch``. Always pass-``--payload-sha256``.+digest equals the signed one (:doc:`upatch-unload`); a directive with+any other digest is refused with ``payload_mismatch``.Other helper commands~~~~~~~~~~~~~~~~~~~~~@@ -138,7 +138,7 @@ Options- Argument- Default- Description- * - ``-o``+ * - ``-o``, ``--output``- ``<output>``- see above- Where to write the artifact or directive.diff --git a/Documentation/reference/cli/config.rst b/Documentation/reference/cli/config.rstindex 8d5ca2e5..54773231 100644--- a/Documentation/reference/cli/config.rst+++ b/Documentation/reference/cli/config.rst@@ -53,11 +53,10 @@ images:# shirudo config > /etc/shirudo/shirudo.conf-The comments in the output are not a reference. Two of them are wrong: the-``tpm.tcti`` comment points to a section of the documentation that does-not exist, and the ``map_export`` comment says that empty destinations-leave the export timer idle, while the timer runs ``upatch map --all``,-which reads every map and prints it (see :doc:`upatch-map`).+The comments in the output are not a reference. The ``map_export``+comment is wrong: it says that empty destinations leave the export timer+idle, while the timer runs ``upatch map --all``, which reads every map+and prints it (see :doc:`upatch-map`).:doc:`/reference/formats/configuration` describes every setting.Optionsdiff --git a/Documentation/reference/cli/image.rst b/Documentation/reference/cli/image.rstindex 6f3c307a..4f10ddd1 100644--- a/Documentation/reference/cli/image.rst+++ b/Documentation/reference/cli/image.rst@@ -102,9 +102,13 @@ shirudo does not reboot the target.image status-------------``status`` prints one JSON object with the active selection:-``root_hash``, ``pcr``, ``sequence``, ``reset_count``, ``restart_count``,-``pending`` and ``consistent``.+``status`` prints the active selection: the config root hash, the config+PCR, the sequence number, the TPM reset count, the restart count, whether+the activation is pending (``no``, or ``yes, until the next reboot``) and+whether it is consistent with its records (``yes`` or ``no``). With+``--json`` it prints one JSON object with ``root_hash``, ``pcr``,+``sequence``, ``reset_count``, ``restart_count``, ``pending`` and+``consistent`` instead.Options-------@@ -142,6 +146,10 @@ Options- ``<salt>``, 64 hex characters- chosen by ``veritysetup``- ``build``: the dm-verity salt.+ * - ``--json``+ - none+ - off+ - ``status``: print the JSON object.Exit status-----------@@ -160,8 +168,10 @@ Exit statusdoes not verify, or a file is missing. ``update``: refused orfailed, and while pending ``image: activation is pending; furtherchanges are blocked``. ``status``: the activation is pending or- inconsistent, and the JSON is still printed. ``update`` and ``status``- on a host without config images fail with ``No such device``.+ inconsistent, and the report is still printed. On a host without+ config activation state, ``update`` fails with ``image update: No+ such device`` and ``status`` with ``image status: no config+ activation state on this host``.* - 2- No subcommand, an unknown subcommand, a wrong number of argumentsto ``update`` or ``status``, or ``verify`` arguments in anotherdiff --git a/Documentation/reference/cli/init.rst b/Documentation/reference/cli/init.rstindex 8eb591c6..24efa3aa 100644--- a/Documentation/reference/cli/init.rst+++ b/Documentation/reference/cli/init.rst@@ -147,10 +147,10 @@ Exit status* - 1- The bootstrap settings cannot be loaded(``init: authenticated image settings: <error>``), a pre-flight- check failed (``init: pre-flight failed (<n>/<m> checks)``), or a- phase failed (``init: <phase> failed: <error>``).+ check failed (``init: pre-flight failed, <n> of <m> checks``), or+ a phase failed (``init: <phase> failed: <error>``).* - 2- - An unknown option.+ - An unknown option, or ``--json`` without ``--check-only``.Files and environment---------------------diff --git a/Documentation/reference/cli/keys.rst b/Documentation/reference/cli/keys.rstindex 447b5a47..0b636a9f 100644--- a/Documentation/reference/cli/keys.rst+++ b/Documentation/reference/cli/keys.rst@@ -23,15 +23,14 @@ Usageshirudo keys [--keys-dir <dir> | --keys-dir=<dir>] [--json]shirudo keys add <certificate> (--vouch <vouch> | --vouch=<vouch>)[--keys-dir <dir> | --keys-dir=<dir>]- shirudo keys vouch <certificate> [-o <vouch>]+ shirudo keys vouch <certificate> [-o <vouch> | --output <vouch>][--keys-dir <dir> | --keys-dir=<dir>][--key <signing-key>] [--cert <certificate>]shirudo keys revokeshirudo keys --list-cmds``keys`` without a subcommand, or with an option first, shows the key-material. ``shirudo keys --help`` advertises ``keys revoke <fingerprint>-[--promote <fp>]``, but the parser takes no argument and always refuses.+material.Display-------@@ -46,7 +45,7 @@ DisplaySHA-256 of its certificate and the certificate that vouched for it- the ``.bpf`` and ``.dm-verity`` keyrings ``init`` froze: each one'sserial, the frozen serial and every member, whatever its type, marked- ``(frozen)`` when ``init`` recorded it and ``(NOT frozen)`` otherwise+ ``(frozen)`` when ``init`` recorded it and ``(not frozen)`` otherwiseThe keys directory is ``--keys-dir``, else ``$SHIRUDO_KEYS_DIR``, else``/var/lib/shirudo/keys``. On a target with an active config image it is@@ -134,7 +133,7 @@ Options- ``<vouch>``, next argument or after ``=``- none, required- ``add``: the vouch an enrolled key signed for the certificate.- * - ``-o``+ * - ``-o``, ``--output``- ``<vouch>``- ``<certificate>.vouch``- ``vouch``: where to write the vouch.@@ -151,8 +150,8 @@ Options-- Print ``add``, ``revoke`` and ``vouch``, one per line.-``vouch`` takes ``-o``, ``--key`` and ``--cert`` with the value as the next-argument only.+``vouch`` takes ``-o``, ``--output``, ``--key`` and ``--cert`` with the+value as the next argument only.Exit status-----------@@ -168,10 +167,13 @@ Exit status``add``: the certificate is trusted. ``vouch``: the vouch waswritten.* - 1- - Display: no key material on the host, or a certificate or the- frozen keyring cannot be read. ``add``: refused or failed, including on a host with an- active config image. ``vouch``: the key is unusable or signing- failed. ``revoke``: always.+ - Display: no key material on the host, the certificate or a keyring+ cannot be read, the signing key is not the certificate's, or a+ keyring ``init`` froze is gone. ``add``: refused or failed,+ including on a host with an active config image. ``vouch``: the+ key is unusable, the certificate cannot be read, is not ML-DSA-87+ or is the signing key's own, or signing or writing failed.+ ``revoke``: always.* - 2- An unknown option or subcommand, a missing certificate or``--vouch``, an extra argument, or an unusable keys directory path.@@ -226,29 +228,6 @@ Show the key material on a target:Members (1):serial=403194297 type=asymmetric shirudo: 7fa1d435249690766f8b1397122775d26f1ed92e (frozen)- Signing key (/run/shirudo/runtime/keys/signing_key.pem):- Present: no (target host -- private key lives on the operator)-- Trusted set (2 members, 0 revoked, 0 unvouched):- 7773eae1c45bc435d9591068da9c318afacfe486007f5386a70ade477f670d69 (primary)- sha256 75171e034357238625311a1c810f7466835ac1dfbc73e9fbd383523439b24125- 4e4d8da3b0d1a69205a3767baca002c052e90af92bc9815d245f9b25dc1b7d9a- sha256 ba3d36544ecfe66b43ea2db498f8f8e50b09fd6f301952636d120c648f76a740- vouched by 7773eae1c45bc435d9591068da9c318afacfe486007f5386a70ade477f670d69-- Keyring (.bpf):- Serial: 854623986- Frozen serial: 854623986 (matches)- Members (2):- serial=209590502 type=asymmetric shirudo: 08967f45330deb21bf31301e56bdf154283e2e58 (frozen)- serial=646964383 type=asymmetric shirudo: 8e781f2c1c0e9bccbba9d1d286129128e830e81f (frozen)-- Keyring (.dm-verity):- Serial: 684706098- Frozen serial: 684706098 (matches)- Members (1):- serial=37657992 type=asymmetric shirudo: 08967f45330deb21bf31301e56bdf154283e2e58 (frozen)-Vouch for a second operator's certificate:.. code-block:: consolediff --git a/Documentation/reference/cli/shirudo.rst b/Documentation/reference/cli/shirudo.rstindex 638d0bb3..1e04e886 100644--- a/Documentation/reference/cli/shirudo.rst+++ b/Documentation/reference/cli/shirudo.rst@@ -128,11 +128,17 @@ Option formsAn option that takes a value takes it after an equals sign or as thenext argument: ``--cert=cert.der`` and ``--cert cert.der`` are the-same. The same function has the same name on every command: a file to-write is ``-o <path>`` or ``--output <path>``, a certificate file is-``--cert``, a signing key ``--key``, the directory that holds both-``--keys-dir``, a Beefile ``--file``, and ``--json`` prints the JSON form-wherever a command has one.+same, and an option given last with nothing after it is a usage error.+Two groups differ. The commands the ``shirudo-build`` helper serves+(``build``, ``keys vouch``, ``image build``, ``image verify`` and ``bpm+config update``) take the value as the next argument only, except+``--keys-dir``, which takes both forms. ``upatch map --json=<path>``+takes its path after the equals sign only. Each command page states the+forms it accepts. The same function has the same name on every command:+a file to write is ``-o <path>`` or ``--output <path>``, a certificate+file is ``--cert``, a signing key ``--key``, the directory that holds+both ``--keys-dir``, a Beefile ``--file``, and ``--json`` prints the+JSON form wherever a command has one.Runtime binary~~~~~~~~~~~~~~diff --git a/Documentation/reference/cli/status.rst b/Documentation/reference/cli/status.rstindex da4d9424..42b1a4b0 100644--- a/Documentation/reference/cli/status.rst+++ b/Documentation/reference/cli/status.rst@@ -67,12 +67,16 @@ The report shows six conditions, each ``OK``, ``WARN`` or ``ALERT``:* - ``ok``- None of the above.-The human report follows the verdict with the tamper counters that moved-this boot, the ``.bpf`` and ``.dm-verity`` keyrings with the-certificates each should hold and the key that holds each one, the-loaded upatches, the TPM measurement state and the assets under-``/var/lib/shirudo``. :doc:`/operate/run/read-status` explains each field and-:doc:`/reference/formats/status-json` the JSON document.+The human report follows the verdict with the conditions, the tamper+counters that moved this boot and the loaded upatches. Three sections+are folded unless ``--show-full`` asks for them: the ``.bpf`` and+``.dm-verity`` keyrings with the certificates each should hold and the+key that holds each one, the TPM measurement state and the assets under+``/var/lib/shirudo``. On a target the keyrings unfold when+``KeyringSealed`` is not ``OK``, and the TPM measurement when+``ChainIntact`` or ``TpmMeasured`` is not. The last line names the+sections that stayed folded. :doc:`/operate/run/read-status` explains+each field and :doc:`/reference/formats/status-json` the JSON document.With ``--otel``, ``status`` builds the JSON report and sends it as oneOTLP log record named ``shirudo.keepalive``, only when an endpoint is@@ -105,12 +109,13 @@ Options* - ``--include-system``- none- off- - Add a ``system`` section: host, operating system, kernel and its- build ID, machine, boot ID, CPUs, memory, disk and uptime.+ - Add the system section: operating system, kernel release, version+ and build ID, architecture, CPUs, memory, disk, uptime, machine ID+ and boot ID. The JSON ``system`` object carries the host name too.* - ``--include-eventlog``- none- off- - Add the eventlog entries.+ - Add the eventlog records, all boots.* - ``--check``- none- off@@ -138,9 +143,10 @@ reads ``.status`` and the conditions from the JSON document.* - 0- The report was produced.* - 1- - With ``--otel``: the configuration cannot be loaded or the OTLP- request failed. With ``--json``: the document does not fit the- output buffer. Also an allocation failure.+ - With ``--check``: the verdict is ``tampered``. With ``--otel``:+ the configuration cannot be loaded or the OTLP request failed.+ With ``--json``: the document does not fit the output buffer.+ Also an allocation failure.* - 2- An unknown option, or with ``--otel`` an invalid ``map_export``configuration.@@ -196,64 +202,97 @@ Show the state of a target:Folded: keyrings, TPM measurement, assets (--show-full)+Show the folded sections too. ``--show-full`` adds the eventlog and the+system as well:++.. code-block:: console++ target# shirudo status --show-full+ Host: docs+ Roles: target+ Mode: production+ Status: ok+ Version ID: d0d7aa800303439023907d1979d917d46a21bec21f816689c138728a28e84af9+Conditions:- TYPE STATUS DETAIL- LsmAttached OK lsm/bpf link present and pinned- KeyringSealed OK bpf serial 130847582, dm-verity serial 962472513, pins match- ChainIntact OK live register equals the eventlog replay- UpatchesMeasured OK every pinned or archived upatch is in this boot's records- TpmMeasured OK NV index 0x01818E00 readable- ConfigActive OK config dc90bacc356f.. is active+ TYPE STATUS DETAIL+ LsmAttached OK lsm/bpf link present and pinned+ KeyringSealed OK bpf serial 272801410, dm-verity serial 799624487, pins match+ ChainIntact OK live register equals the eventlog replay+ UpatchesMeasured OK every pinned or archived upatch is in this boot's records+ TpmMeasured OK NV index 0x01818E00 readable+ ConfigActive OK config 6d5ed552f448.. is activeTamper attempts (this boot):- LoadNotLoader 21 program load that is not a signed loader+ LoadNotLoader 15 program load that is not a signed loaderMapCreate 1 map creation by another executable- BpfCommand 10 detach, update, delete or unclassified bpf() command+ BpfCommand 8 detach, update, delete or unclassified bpf() command+ BpffsUmount 1 unmount of the private bpffs+ SealWrite 1 write open of a sealed fileSealPtrace 7 ptrace of a shirudo task+ SealEntry 2 entry into a sealed directory, or a sealed inode linked++ Loaded upatches (1):+ NAME LOCATION MAPS STATUS AGE+ shirudo-test-basic fentry/do_nanosleep 0 success 1sKeyring (.bpf):- Serial: 130847582- Frozen serial: 130847582 (matches)+ Serial: 272801410+ Frozen serial: 272801410 (matches)Certificates: 2 trusted, 0 revoked, 0 unvouched, 2 in the bpf keyring- d1bc43c91b9dabf4cd6f3ddf08a177927b3dac8ca833ddc496167253761b4497 (primary)- CN=shirudo, ML-DSA-87, issued 2026-10-29- key 199275792 shirudo: 6ec99b4c3d1c51e461ce1299fae6ab87d212ce9c (frozen)- c1c30b07f86808e81ae1c0458c926f00b85bcc815d371d23d7683903f2d3266e- CN=shirudo, ML-DSA-87, issued 2026-10-29- key 106884895 shirudo: c350bd270c426c5760b202062e15e274ea30f45d (frozen)+ a8be2bb837b0f052f7652f9edf446594a5465eed614d939964ddfcc96e61ba7f+ CN=shirudo, ML-DSA-87, issued 2026-11-03+ key 465853497 shirudo: 30dee65057025367c4c384928bcf1e4cd8fe0265 (frozen)+ 6bd6b1a28b631295a013102d358d371d52ab1c894587aedceaf02e472c88f858 (primary)+ CN=shirudo, ML-DSA-87, issued 2026-11-03+ key 91435879 shirudo: 7fa1d435249690766f8b1397122775d26f1ed92e (frozen)Keyring (.dm-verity):- Serial: 962472513- Frozen serial: 962472513 (matches)+ Serial: 799624487+ Frozen serial: 799624487 (matches)Certificates: 1 trusted, 1 in the dm-verity keyring- d1bc43c91b9dabf4cd6f3ddf08a177927b3dac8ca833ddc496167253761b4497 (config)- CN=shirudo, ML-DSA-87, issued 2026-10-29- key 200951639 shirudo: 6ec99b4c3d1c51e461ce1299fae6ab87d212ce9c (frozen)-- Loaded upatches (1):- NAME LOCATION MAPS STATUS AGE- shirudo-test-basic fentry/do_nanosleep 0 success 2s+ 6bd6b1a28b631295a013102d358d371d52ab1c894587aedceaf02e472c88f858 (config)+ CN=shirudo, ML-DSA-87, issued 2026-11-03+ key 403194297 shirudo: 7fa1d435249690766f8b1397122775d26f1ed92e (frozen)TPM measurement:TPM: reachable (device:/dev/tpmrm0)NV index: 0x01818E00 (anchored in PCR 9)- Chain: 0307d216caac3067fe645d4a548b25ac5ed0f1e8cf5ae3b189feaefc47e81a84- Register name: 000b9b7b0f925415fdf0d5676369f8cc9146b9e3142537148b31e79dbffcc96e72f8- Anchored: yes (name on record)+ Chain: 7f63313a31ac8ddd3a6a16fce2038322c9c782d5787155d2dc18dfa582dff548+ Register name: 000b21eb0d45ac9ee1bb0a87dbb069120e3b8cb251b3d40cc2a86a307ab73f728789+ Anchored: yes, name on recordPCR before init: 0000000000000000000000000000000000000000000000000000000000000000Phase at init: 0000000000000000000000000000000000000000000000000000000000000000 (PCR 11)Bound in: initrdChain vs eventlog: matchesEventlog: /var/lib/shirudo/eventlog (2 entries, 2324 bytes)+ Eventlog:+ TIME TYPE DIGEST DETAIL+ 2026-11-03T14:53:17Z init 377ce174fb1f set_digest=e3b0c44298fc..+ 2026-11-03T14:54:33Z upatch_load d979b373d4e5 shirudo-test-basic payload=8aee7072a1a1..+Assets (/var/lib/shirudo):keys/cert.der presentkeys/signing_key.pem absenteventlog present (2324 bytes)- upatches/ 1 .upatch+ upatches/ 1 archivedincoming/ emptybpffs/ mounted+ System:+ OS: Ubuntu 26.04.1 LTS+ Kernel: 7.3.0-bpf-next++ Kernel version: #1 SMP PREEMPT Tue Nov 3 13:54:40 UTC 2026+ Kernel build ID: 132d1451aab18a693c59d5b9519d25a06f2236bf+ Architecture: x86_64+ CPUs: 4+ Memory: 314M/3.85G+ Disk: 1.99G/6.61G+ Uptime: 0d 0h 1m+ Machine ID: 6bae4cfbc0ed04ed63cc4cf8cb0a1b6c+ Boot ID: 82639935-1127-4dab-91b5-f818eabc7f13+Read the verdict in a script:.. code-block:: consolediff --git a/Documentation/reference/cli/upatch-get.rst b/Documentation/reference/cli/upatch-get.rstindex 7258b15b..b8fde63c 100644--- a/Documentation/reference/cli/upatch-get.rst+++ b/Documentation/reference/cli/upatch-get.rst@@ -93,12 +93,7 @@ Describe a loaded upatch:Program ID: 72Loaded at: 2026-11-03T14:54:33Z (1s ago)Payload sha256: 8aee7072a1a15e4dddc93ad6b253a0e2e70ad6cdf767442aa8a1c1997bc3069f (signature-bound)- Maps:-- Source (kernel BTF line_info):-- <checkout>/testing/fixtures/basic.bpf.c:- 9: int BPF_PROG(shirudo_test_basic)+ Maps: noneSource (kernel BTF line_info):diff --git a/Documentation/reference/cli/upatch-info.rst b/Documentation/reference/cli/upatch-info.rstindex e1bc3aec..55c90449 100644--- a/Documentation/reference/cli/upatch-info.rst+++ b/Documentation/reference/cli/upatch-info.rst@@ -93,7 +93,7 @@ Describe an artifact:Type: LOADPayload type: bpfVersion: 1- Payload SHA256: 46f3d9f5f6568bddb7692cad28e99a86a3104192d8a2251f9ef9ec6d593c2035+ Payload sha256: 46f3d9f5f6568bddb7692cad28e99a86a3104192d8a2251f9ef9ec6d593c2035File size: 8661 bytesLoader:diff --git a/Documentation/reference/cli/upatch-load.rst b/Documentation/reference/cli/upatch-load.rstindex 5ad5d39e..a8659e8c 100644--- a/Documentation/reference/cli/upatch-load.rst+++ b/Documentation/reference/cli/upatch-load.rst@@ -25,9 +25,10 @@ Usage[--no-precheck] [--no-version-check] [--report=<path>]<file>-Every option with a value takes it after ``=``. ``--help`` anywhere on the-line prints the help. Progress and error messages go to standard error,-so with ``--report=-`` standard output carries only the report.+Every option with a value takes it after ``=`` or as the next argument.+``--help`` anywhere on the line prints the help. Progress and error+messages go to standard error, so with ``--report=-`` standard output+carries only the report.Description-----------@@ -174,15 +175,16 @@ Exit status and failure categories* - 1- Refused or failed. The report and the message name the category.* - 2- - A usage error: an unknown option, a second file, no file, or an- ``--expect-chain`` that is not 64 hexadecimal characters. Also the- category ``attach_target_missing``.+ - A usage error: an unknown option, an option given last without+ its value, a second file, no file, or an ``--expect-chain`` that+ is not 64 hexadecimal characters. Also the category+ ``attach_target_missing``.``load`` reports these categories: ``version_mismatch``,``kernel_abi_unsupported``, ``keyring_missing``, ``tampered``,-``eventlog_full``, ``parser_rejected``, ``signature_rejected``,-``signature_unsupported``, ``lsm_denied``, ``verifier_rejected``,-``attach_target_missing``, ``binary_mismatch``,+``eventlog_full``, ``already_loaded``, ``parser_rejected``,+``signature_rejected``, ``signature_unsupported``, ``lsm_denied``,+``verifier_rejected``, ``attach_target_missing``, ``binary_mismatch``,``attach_scope_mismatch``, ``tpm_error`` and ``unknown``.:doc:`/reference/failure-categories` gives the cause and the action foreach. Handle ``tampered`` as an incident@@ -223,7 +225,7 @@ differs, ``load`` refuses before it touches the kernel:.. code-block:: none- upatch load: pre-flight refused (category: tampered, message: chain_drift) -- live chain c50b22ac27c5bb6a90ee5ff9b440fbbd5bb60b84a2aa7b395daec3f330886fcd != expected; re-status and re-issue with the refreshed value+ upatch load: pre-flight refused (category: tampered, message: chain_drift): live register c50b22ac27c5bb6a90ee5ff9b440fbbd5bb60b84a2aa7b395daec3f330886fcd is not the expected one; run status and pass the refreshed valueThe message suggests repeating the command with the live value. Do not.A register that differs from your prediction is an incidentdiff --git a/Documentation/reference/cli/upatch-map.rst b/Documentation/reference/cli/upatch-map.rstindex 099507ae..58d73fcd 100644--- a/Documentation/reference/cli/upatch-map.rst+++ b/Documentation/reference/cli/upatch-map.rst@@ -27,7 +27,8 @@ Usageshirudo upatch map --all [--json | --json=<path>] [--show-full] [--peek][--otel [<otlp-options>]]-Every option with a value takes it after ``=``.+``--json`` takes its path after ``=`` only. The other options with a+value take it after ``=`` or as the next argument.Description-----------@@ -153,10 +154,11 @@ Exit statusthe other maps are still handled. Also, with ``--all``, theconfiguration cannot be loaded.* - 2- - A usage error: an unknown or repeated option, an invalid value,- positional arguments with ``--all``, ``--otel`` without a map, OTLP- options without ``--otel``, an invalid upatch name, or with- ``--all`` an invalid ``map_export`` configuration.+ - A usage error: an unknown or repeated option, an option given last+ without its value, an invalid value, positional arguments with+ ``--all``, ``--otel`` without a map, OTLP options without+ ``--otel``, an invalid upatch name, or with ``--all`` an invalid+ ``map_export`` configuration.Files and environment---------------------@@ -175,7 +177,8 @@ List the pinned maps of a target without any:.. code-block:: consoletarget# shirudo upatch map- (no pinned maps)+ Pinned maps (0):+ noneLook at a serializer-backed map without taking its records from theexporter:diff --git a/Documentation/reference/cli/upatch-unload.rst b/Documentation/reference/cli/upatch-unload.rstindex 81142a2e..4c6ebc97 100644--- a/Documentation/reference/cli/upatch-unload.rst+++ b/Documentation/reference/cli/upatch-unload.rst@@ -111,8 +111,9 @@ Exit status and failure categories* - 1- Refused or failed.* - 2- - A usage error: an unknown option, a second file, no file, or an- ``--expect-chain`` that is not 64 hexadecimal characters.+ - A usage error: an unknown option, an option given last without+ its value, a second file, no file, or an ``--expect-chain`` that+ is not 64 hexadecimal characters.``unload`` reports these categories: ``version_mismatch``,``kernel_abi_unsupported``, ``keyring_missing``, ``tampered``,diff --git a/Documentation/reference/environment.rst b/Documentation/reference/environment.rstindex 6ab89c2e..def72441 100644--- a/Documentation/reference/environment.rst+++ b/Documentation/reference/environment.rst@@ -83,8 +83,9 @@ shirudo and shirudo-build* - ``SHIRUDO_INIT_ARGS``- ``shirudo.service``, from ``/etc/shirudo/init.env``- Arguments appended to ``init``. ``init`` accepts only- ``--check-only``. The runtime drop-in clears ``ExecStart=`` and- ``EnvironmentFile=``, so the variable has no effect with it.+ ``--check-only`` and ``--json``. The runtime drop-in clears+ ``ExecStart=`` and ``EnvironmentFile=``, so the variable has no+ effect with it.* - ``TMPDIR``- ``upatch map`` (snapshot file), ``shirudo-build bpm build``(staging directory), the generator scripts (``mktemp -d``)diff --git a/Documentation/reference/failure-categories.rst b/Documentation/reference/failure-categories.rstindex 14ae5195..fec35253 100644--- a/Documentation/reference/failure-categories.rst+++ b/Documentation/reference/failure-categories.rst@@ -281,7 +281,8 @@ every verdict, ``tampered`` included. Parse ``.status`` of``SHIRUDO_BUILD`` is empty.* - ``init``- 0; 1 on any failure, the pre-flight included; 2 for an unknown- option. ``--check-only`` exits 0 when every check passes, else 1.+ option or for ``--json`` without ``--check-only``.+ ``--check-only`` exits 0 when every check passes, else 1.* - ``status``- 0 for every verdict; 1 when memory runs out, the configurationcannot be loaded for ``--otel`` or the OTLP send fails; 2 for a@@ -311,7 +312,8 @@ every verdict, ``tampered`` included. Parse ``.status`` ofusage error.* - ``bpm tree sync``- 0, also when no tree is configured; 1 on failure and for an- unknown option.+ unknown option; 2 for too many arguments or a ``--report`` path+ that is too long.* - ``bpm build``, ``bpm config update``, ``bpm tree append``- 0; 1 on failure and for a usage error; 127 when the helper ismissing.@@ -321,7 +323,7 @@ every verdict, ``tampered`` included. Parse ``.status`` of* - ``image`` without a subcommand- 2.* - ``image update``- - 0; 1 on failure.+ - 0; 1 on failure; 2 for a usage error.* - ``image status``- 0 when the activation is consistent and not pending; 1 when it ispending or inconsistent (after the JSON) or no record exists.diff --git a/Documentation/reference/files.rst b/Documentation/reference/files.rstindex c3238a6c..4e78cd71 100644--- a/Documentation/reference/files.rst+++ b/Documentation/reference/files.rst@@ -65,6 +65,11 @@ Operator host- ``build``- none- Temporary object, removed after packaging.+ * - ``$TMPDIR/shirudo-bpm-build.XXXXXX/``+ - ``bpm build``+ - ``0700``+ - Staging directory of a package build (``/tmp`` when ``TMPDIR``+ is unset), removed when the build ends.* - ``/etc/shirudo/shirudo.conf``- administrator- none@@ -186,7 +191,7 @@ the label as foreign. In the initrd, ``init`` binds- Config activation record and its event history.* - ``images/<root-hash>.img``, ``.verity``, ``.roothash``, ``.p7s``- ``image update``- - none+ - ``0600``- Fetched config images, named by their dm-verity root hash.* - ``images/incoming-XXXXXX/``- ``image update``@@ -327,10 +332,10 @@ by ``BPF_OBJ_GET`` (``ObjGet``). Directories stay listable.``inode_rmdir_link``, ``bpf2_inode_rename_link``,``inode_mkdir_link``, ``inode_symlink_link``, ``inode_link_link``,``kernel_load_data_link``, ``kernel_read_file_link``- - Links of the observer hooks.+ - Links of the exec identity, directory entry and kexec guards.* - ``file_ioctl_link``, ``file_ioctl_compat_link``,``bdev_integrity_link``, ``bdev_free_link``- - Links of the image observer hooks.+ - Links of the ioctl guard and the dm-verity device recorders.* - ``seal_*_link``- Links of the seal hooks, one per hook, such as``seal_file_open_link`` and ``seal_mmap_link``.diff --git a/Documentation/reference/formats/bpm-formats.rst b/Documentation/reference/formats/bpm-formats.rstindex e34fef9f..9221621d 100644--- a/Documentation/reference/formats/bpm-formats.rst+++ b/Documentation/reference/formats/bpm-formats.rst@@ -80,9 +80,10 @@ Names128 characters.* - Package version- ``bpm build --version``- - ``[A-Za-z0-9._+-]``, does not start with ``.``, fewer than 128- characters. The newest version is chosen by SemVer 2.0.0- precedence, build metadata ignored.+ - Starts with a letter or digit, then ``[A-Za-z0-9._+-]``, fewer+ than 128 characters. The target also accepts a version that+ starts with another character than ``.``. The newest version is+ chosen by SemVer 2.0.0 precedence, build metadata ignored.* - upatch name- The source file's basename without ``.bpf.c``, ``.bpf.o`` or ``.o``- The Beefile cannot override it. 1 to 255 characters ofdiff --git a/Documentation/reference/formats/status-json.rst b/Documentation/reference/formats/status-json.rstindex 3c602ff6..e69c4bab 100644--- a/Documentation/reference/formats/status-json.rst+++ b/Documentation/reference/formats/status-json.rst@@ -18,9 +18,10 @@ sends, see :doc:`otlp`. Options and exit status are intarget# shirudo status --json-``status`` exits ``0`` for every verdict, ``tampered`` included. A-monitor reads ``status`` and the fields in `Fields to alert on`_, never-the exit status alone.+``status`` exits ``0`` for every verdict, ``tampered`` included, unless+``--check`` is given, which exits ``1`` for ``tampered``. A monitor+reads ``status`` and the fields in `Fields to alert on`_, never the+exit status alone.Top-level fields----------------@@ -58,7 +59,7 @@ determined, as noted.* - ``reason``- string or ``null``- The reason the human report prints after the verdict, ``null``- for ``ok``.+ for ``ok``, see `Reasons`_.* - ``conditions``- array of object- Six conditions, each with ``type``, ``status`` and ``detail``,@@ -175,6 +176,49 @@ Verdicts* - ``ok``- None of the above.+Reasons+~~~~~~~++``reason`` is ``null`` for ``ok`` and otherwise one of these strings.+For ``tampered`` it names the first cause that applies, in the order+listed. For ``degraded`` it is ``no TPM answered`` when no TPM+answered, else ``no register bound this boot``.++.. list-table::+ :header-rows: 1+ :widths: 18 82++ * - ``status``+ - ``reason``+ * - ``tampered``+ - ``live register differs from the eventlog replay``+ * -+ - ``a upatch is pinned or archived without a record of this boot``+ * -+ - ``the selected config cannot be verified against its records``+ * -+ - ``the keyring init froze is gone``+ * -+ - ``keyring serial swap detected``+ * -+ - ``the dm-verity keyring init froze is gone``+ * -+ - ``dm-verity keyring serial swap detected``+ * -+ - ``a keyring holds a link init did not freeze``+ * -+ - ``the config key init froze is gone``+ * - ``lsm-off``+ - ``LSM not attached, enforcement off``+ * - ``init-pending``+ - ``.bpf keyring absent before init``+ * - ``reboot-pending``+ - ``a config activation is pending until the next reboot``+ * - ``degraded``+ - ``no register bound this boot``+ * -+ - ``no TPM answered``+Conditions----------@@ -226,6 +270,13 @@ its details that applies, in the order listed.* -- ``OK``- ``bpf serial <serial>, dm-verity serial <serial>, pins match``+ * -+ - ``OK``+ - ``bpf serial <serial>, pin matches``, when ``init`` recorded no+ ``.dm-verity`` serial+ * -+ - ``OK``+ - ``bpf serial <serial>, no pin recorded``* - ``ChainIntact``- ``OK``- ``live register equals the eventlog replay``@@ -235,6 +286,9 @@ its details that applies, in the order listed.* -- ``WARN``- ``no TPM answered, no register to replay``+ * -+ - ``WARN``+ - ``chain present, replay not evaluated``* -- ``ALERT``- ``live register differs from the eventlog replay``@@ -511,7 +565,8 @@ tpm* - ``register_anchored``- boolean- The register's name equals the name this boot's ``init``- record gives, for the TPM's current reset count.+ record gives, for the TPM's current reset count, and the+ recorded PCR values and writer key give that name.* - ``init_records``- integer- ``init`` records this boot.diff --git a/Documentation/security/security-model.rst b/Documentation/security/security-model.rstindex aa99cf2b..646b974a 100644--- a/Documentation/security/security-model.rst+++ b/Documentation/security/security-model.rst@@ -93,7 +93,7 @@ The properties above hold only on a deployment that provides the:ref:`assumptions <tm-assumptions>`. In brief:- A trusted kernel with the BPF LSM, the signed-loader ABI and the- ``tpm_command`` patch+ carried kernel patches- Module signature enforcement and lockdown in integrity mode, no32-bit compatibility, no hibernation and no writes under mountedfile systemsdiff --git a/Documentation/security/tamper-counters.rst b/Documentation/security/tamper-counters.rstindex 926bc2fd..e50025b5 100644--- a/Documentation/security/tamper-counters.rst+++ b/Documentation/security/tamper-counters.rst@@ -162,11 +162,6 @@ counter.- perf event bound to a shirudo task- ``lsm/perf_event_alloc``- ``EACCES``- * - ``SealSignal``- - a signal other than 0 to a shirudo task from a task without- authority; let through- - ``lsm/task_kill``- - none* - ``ExecTraced``- exec of shirudo by a traced task- ``lsm.s/bprm_check_security`` in the seal object, and@@ -177,7 +172,8 @@ counter.- ``lsm.s/inode_create``, ``lsm.s/inode_mkdir``,``lsm.s/inode_symlink``, ``lsm.s/inode_mknod`` and``lsm.s/inode_link`` in the seal object, which read the- directory's label, and ``lsm.s/inode_rename`` for the destination+ directory's label, ``lsm.s/inode_link`` for a labeled source, and+ ``lsm.s/inode_rename`` for the destination- ``EACCES``* - ``PerfAttach``- program attached to a perf event by another executable@@ -191,7 +187,7 @@ counter.- ``EPERM``* - ``SealCopyUp``- overlay copy-up of a sealed inode- - ``lsm.s/inode_copy_up``+ - ``lsm.s/inode_copy_up``, every caller- ``EPERM``* - ``Kexec``- kexec image or initramfs load@@ -210,6 +206,11 @@ counter.descriptor; ``lsm/file_open`` in the ``bpf2`` object: anon-directory inode in the private bpffs- ``EACCES``+ * - ``SealSignal``+ - signal to a shirudo task (let through)+ - ``lsm/task_kill``: a signal other than 0 to a marked task from a+ task without authority; the signal is delivered+ - noneUnless the row says every caller, a task with runtime authority isnot refused and moves nothing.@@ -273,8 +274,8 @@ open the counter map, and its attempt moves ``ObjGet``.``shirudo status`` prints the section ``Tamper attempts (thisboot):`` with one line per counter that is not zero: its name, itscount and its meaning. It prints ``none`` when every counter is zero,-and ``(none recorded: init has not pinned the counters this boot)``-before ``init`` has run.+``none recorded before init`` before ``init`` has pinned the map, and+``unavailable:`` with the error when the map cannot be read.``shirudo status --json`` carries every counter under``tamper_attempts``, with the sum in ``total`` and each counter by name@@ -290,7 +291,10 @@ What a non-zero counter means-----------------------------A counter that moved means that a guard refused an operation this boot.-The refusal is what moved it: the operation did not happen.+The refusal is what moved it: the operation did not happen. The one+exception is ``SealSignal``, which counts a signal the seal delivered:+the task it went to may have been stopped, and the next upatch command+and ``shirudo status`` find what a stopped load left.A non-zero counter does not mean:@@ -299,9 +303,9 @@ A non-zero counter does not mean:capabilities, so an unprivileged process moves the counters of``bpf()`` commands.- That a foreign program made it. ``BpfCommand``, ``Kexec``,- ``BpffsUmount``, ``BpffsUmountAbove``, ``BpffsMount`` and a malformed- TPM command count refusals of shirudo's own tasks too, and a shirudo- binary outside the runtime image moves ``ObjGet``.+ ``BpffsUmount``, ``BpffsUmountAbove``, ``BpffsMount``, ``SealCopyUp``+ and a malformed TPM command count refusals of shirudo's own tasks+ too, and a shirudo binary outside the runtime image moves ``ObjGet``.- That the operation was the one the meaning names. ``PerfAttach``counts the ioctl number on any file, whatever the device.diff --git a/Documentation/security/threat-model.rst b/Documentation/security/threat-model.rstindex 087f25a7..695a98eb 100644--- a/Documentation/security/threat-model.rst+++ b/Documentation/security/threat-model.rst@@ -147,18 +147,26 @@ without the protection.checked.* - A3- The kernel has the signed-loader ABI of the bpf-next tree shirudo- targets, the ``tpm_command`` LSM hook, and xattr kfuncs that- return a ``security.bpf.`` label to an LSM program without the- calling task's read permission. Upstream has neither the hook nor- the latter, and shirudo carries them as- :src:`kernel/0002-tpm-Let-LSMs-inspect-userspace-commands.patch`+ targets, the ``tpm_command`` LSM hook, xattr kfuncs that return+ a ``security.bpf.`` label to an LSM program without the calling+ task's read permission, sleepable LSM programs on+ ``inode_mkdir``, ``inode_link``, ``inode_set_acl``,+ ``inode_remove_acl``, ``inode_file_setattr`` and+ ``inode_copy_up``, and a ``dentry->d_parent`` the verifier+ trusts. Upstream has none of these, and shirudo carries them as+ :src:`kernel/0002-tpm-Let-LSMs-inspect-userspace-commands.patch`,+ :src:`kernel/0003-bpf-Read-security.bpf-xattrs-for-LSM-programs-without-the-caller-s-permission.patch`,+ :src:`kernel/0004-bpf-Let-sleepable-LSM-programs-attach-to-the-remaining-inode-hooks.patch`and- :src:`kernel/0003-bpf-Read-security.bpf-xattrs-for-LSM-programs-without-the-caller-s-permission.patch`.- - T1 needs the ABI, T5 the hook, T3 the label read.+ :src:`kernel/0005-bpf-Treat-dentry-d_parent-as-a-trusted-pointer.patch`.+ - T1 needs the ABI, T5 the hook, T3 the label read, the sleepable+ hooks and the trusted parent.- Partly. The pre-flight check ``signed_loader_kernel_abi`` tests- the ABI. Without the hook the ``bpf2`` object does not load and- ``init`` fails. Without the label read, the seal falls back to- its marks where a read fails for the caller (T3).+ the ABI. Without the hook the ``bpf2`` object does not load, and+ without the sleepable hooks and the trusted parent the ``seal``+ object does not load; ``init`` fails either way. Without the+ label read, the seal falls back to its marks where a read fails+ for the caller (T3).* - A4- The kernel refuses unsigned modules (``CONFIG_MODULE_SIG`` withenforcement) and runs with lockdown in integrity mode@@ -383,7 +391,7 @@ Figure 1 shows the parties and where trust ends.Figure 1. Trust boundaries and the evidence boundary.The target TCB is the kernel with its configuration and command line-(A1, A4, A11) and the ``tpm_command`` patch; the firmware, boot loader+(A1, A4, A11) and the carried kernel patches (A3); the firmware, boot loaderand UKI (A6); the TPM (A15); the initrd and every unit it runs before``shirudo-initrd.service`` completes; and the runtime image. Theruntime image holds the shirudo binary with its two embedded BPF@@ -653,13 +661,12 @@ the seal attaches. On every later run a state root without the label isrefused, since it is a tree bound over the path rather than the one``init`` sealed (``t6123``). For a labeled inode, a write open, anunlink or the removal of an empty directory, either end of a rename, a-setattr (truncate, chmod, chown, utimes) and an xattr change need+setattr (truncate, chmod, chown, utimes), a change of its inode flags+with ``chattr``, an xattr change and a change of its POSIX ACL needruntime authority (``SealWrite``, ``SealUnlink``, ``SealRename``,-``SealSetattr``, ``SealXattr``), and for a marked one so do a change of-its POSIX ACL (``SealXattr``) and of its inode flags with ``chattr``-(``SealSetattr``), whose hooks cannot read the label. Only an-authorized task sets or removes the exact seal label or changes the-policy label on any inode (``SealLabel``).+``SealSetattr``, ``SealXattr``); every one of those hooks reads the+label. Only an authorized task sets or removes the exact seal label or+changes the policy label on any inode (``SealLabel``).The label is a public constant, the same on every build. It marks atarget and never grants authority: a file system root mounts can carry@@ -723,9 +730,9 @@ inode its label inside the transaction that creates it. Evicting theinode cache therefore opens nothing (``t6118``, ``t6144``). A labeledinode is hard-linked nowhere by a task without authority, so its labelcannot be kept alive beside the state it left. An overlay copy-up of a-labeled inode is refused (``SealCopyUp``), so a write through an-overlay root mounts over sealed state fails instead of landing in-root's upper directory.+labeled inode is refused to every caller, shirudo included+(``SealCopyUp``), so a write through an overlay root mounts over sealed+state fails instead of landing in root's upper directory.shirudo opens sealed state without following symbolic links and takesno entry without the label for its own: ``init`` ignores such an entry@@ -904,8 +911,10 @@ pins the register does notcover and the upatch attached: ``shirudo status`` reports them(``UpatchesMeasured``, verdict ``tampered``) and the next upatchcommand, ``bpm``'s included, undoes them, pins and archives, before it-acts; ``init`` restores only an archive whose load the eventlog records-without a later unload. A measuring+acts. The same scan finds the pins an unload stopped after its extend+leaves, and an archive without a record of its load; ``init`` restores+only an archive whose load the eventlog records without a later unload+(``t6144``). A measuringcommand holds a lock beside the eventlog from its extend to its append,a load or an unload from that undo to its append, so the register andthe log advance in one order and the undo never takes a load in flight@@ -1094,7 +1103,9 @@ T10 An attempt that leaves no traceA refusal the operator never sees invites the next attempt. Each namedpoint at which a guard refuses counts the refusal in ``shirudo_tamper``,-an array map ``init`` creates, freezes and pins at every boot. Only the+an array map ``init`` creates, freezes and pins at every boot. One+point counts what it lets through: a signal to an authorized task from+a task without authority (``SealSignal``, T3). Only thehooks add to it, and no task resets it from userspace. ``shirudostatus`` lists the counters that are not zero with their meaning,``status --json`` carries them all, and the keepalive carries the total@@ -1669,14 +1680,14 @@ U13 Revocation does not reach everythingU14 The operator runs commands from a registry package:Affects: ``shirudo bpm config update --base-package oci://...``- without ``-f`` on the operator host.+ without ``--file`` on the operator host.:Consequence: The command takes the Beefile from a package checkedonly against the registry's manifest digest and runs its updatercommands on the host that holds the signing key. A hostileregistry becomes ADV-F.:Status: Confirmed in code; the usage text says the commands aretrusted as operator-side code.- :Meanwhile: Always pass ``-f`` with a local Beefile, or a local+ :Meanwhile: Always pass ``--file`` with a local Beefile, or a local``.bee`` file as the base package.U15 Certificates are fetched without a pin@@ -1792,8 +1803,8 @@ the procedures.The deployer:-- Builds the kernel with the signed-loader ABI and the ``tpm_command``- patch (A3), ``CONFIG_MODULE_SIG`` with enforcement and+- Builds the kernel with the signed-loader ABI and the carried kernel+ patches (A3), ``CONFIG_MODULE_SIG`` with enforcement and``CONFIG_SECURITY_LOCKDOWN_LSM`` (A4), ``CONFIG_COMPAT=n`` (A5), bothdm-verity keyring options off and no foreign built-in certificate(A7), the TPM driver without ``i2c-dev`` or ``spidev`` on its bus@@ -1809,8 +1820,8 @@ The deployer:certificates included (U4)- Treats the TPM owner password as known to root (R20)- Never runs ``shirudo bpm config update --base-package oci://...``- without ``-f`` (U14), and checks the fingerprint of every certificate- it installs (U15)+ without ``--file`` (U14), and checks the fingerprint of every+ certificate it installs (U15)- Watches the size of the eventlog (U6) and the keepalives, and treats a``tampered`` status as an incident to understand, not a condition toretry (:doc:`/operate/troubleshoot/incident-tampered`)diff --git a/Documentation/start/guides/attest-target.rst b/Documentation/start/guides/attest-target.rstindex bab53722..4ff9e5e6 100644--- a/Documentation/start/guides/attest-target.rst+++ b/Documentation/start/guides/attest-target.rst@@ -94,7 +94,7 @@ Challenge the attestation keyOK attestation key: the pinned keyOK endorsement key: name matches its public areaOK endorsement key: TCG default template under the endorsement policy- note no endorsement certificate: the endorsement key is trusted as presented+ NOTE no endorsement certificate: the endorsement key is trusted as presentedchallenge: build/test-vm/vms/quickstart/result/challenge.jsoncredential: b17d3f29447eaf539bcffa2556b010082a7a10e2b7ab60746c485d176b7a40cc@@ -148,7 +148,7 @@ Answer the challenge on the target.. code-block:: consoleattest: the challenge was made for another attestation key- attest: the challenge was refused (tampered?)+ attest: the TPM refused the challenge; the attestation key or the endorsement key is not this TPM'sVerify the enrollment---------------------@@ -173,8 +173,8 @@ Verify the enrollmentOK anchor: PCR 9 equals the recorded value extended by the anchorOK state: init event covers the expected certificate, set and tree rootOK state: 6 events after boot change the register- note event after boot: upatch_load basic- note event after boot: upatch_unload basic+ NOTE event after boot: upatch_load basic+ NOTE event after boot: upatch_unload basic...verdict: ok@@ -258,8 +258,8 @@ Verify evidenceOK anchor: record digest matches the index nameOK anchor: PCR 9 equals the recorded value extended by the anchorOK state: register equals the expected value- note event after boot: upatch_load basic- note event after boot: upatch_unload basic+ NOTE event after boot: upatch_load basic+ NOTE event after boot: upatch_unload basic...verdict: ok@@ -275,8 +275,8 @@ still reports ``verdict: ok``:operator$ shirudo attest verify --evidence="$RESULT/ev.json" --nonce="$NONCE3" --ak-name="$AK"...OK anchor: PCR 9 equals the recorded value extended by the anchor- note no expected state given; the register value is 52764aa4e68b762c7e5bbacf1261bd3242b44a0b66876f34c89c5b8d57da7177- note event after boot: upatch_load basic+ NOTE no expected state given; the register value is 52764aa4e68b762c7e5bbacf1261bd3242b44a0b66876f34c89c5b8d57da7177+ NOTE event after boot: upatch_load basic...verdict: okdiff --git a/Documentation/start/guides/first-upatch.rst b/Documentation/start/guides/first-upatch.rstindex 75d2a245..418db4c2 100644--- a/Documentation/start/guides/first-upatch.rst+++ b/Documentation/start/guides/first-upatch.rst@@ -104,7 +104,7 @@ Build and sign itType: LOADPayload type: bpfVersion: 1- Payload SHA256: d7eaea457b679a8e9a6d4a8708ded501c6a3f604c8756388d9e5e4d6f2922c6f+ Payload sha256: d7eaea457b679a8e9a6d4a8708ded501c6a3f604c8756388d9e5e4d6f2922c6f...Check that ``Name`` is ``sleep-count`` and ``Type`` is ``LOAD``.@@ -130,13 +130,12 @@ Load it and read the map.. code-block:: consoletarget# shirudo upatch load /workspace/shirudo/build/tutorial/sleep-count.upatch- loaded signed loader: prog_fd=10 keyring=531121468 sig=4853B insns=148 data=3024B- loader ok, retval=0 (maps=1 progs=1)- attached + pinned prog 0 (raw_tracepoint) -> /run/shirudo/bpffs/upatches/sleep-count/link- pinned map 0 (calls, type=2) -> /run/shirudo/bpffs/upatches/sleep-count/maps/calls- upatch load: name=sleep-count keyring=531121468 progs=1- upatch load: chain extended, value=88e45b0c80b0ffe83d471b6372402082a5dcf82173adc5c4bdd631039fe4609c- upatch load measured: name=sleep-count chain=88e45b0c80b0ffe83d471b6372402082a5dcf82173adc5c4bdd631039fe4609c+ upatch load: signed loader accepted, keyring 272801410, 148 instructions+ upatch load: loader ran, 1 maps and 1 programs+ upatch load: program 0 (raw_tracepoint) pinned at /run/shirudo/bpffs/upatches/sleep-count/link+ upatch load: map 0 (calls) pinned at /run/shirudo/bpffs/upatches/sleep-count/maps/calls+ upatch load: sleep-count loaded, 1 programs, keyring 272801410+ upatch load: sleep-count measured, register 88e45b0c80b0ffe83d471b6372402082a5dcf82173adc5c4bdd631039fe4609cThe loader created the map and the program in the kernel. shirudopinned both in its private bpffs and measured the load.@@ -152,6 +151,7 @@ Load it and read the map.. code-block:: consoletarget# shirudo upatch map+ Pinned maps (1):UPATCH MAP TYPE ENTRIESsleep-count calls array max=1@@ -160,13 +160,13 @@ Load it and read the map.. code-block:: consoletarget# shirudo upatch map sleep-count calls- Name: sleep-count- Map: calls- Type: array- Max entries: 1- Entries: 1 of 1- Key type: unsigned int (4 B)- Value type: unsigned long long (8 B)+ Name: sleep-count+ Map: calls+ Type: array+ Max entries: 1+ Entries: 1 of 1+ Key type: unsigned int (4 B)+ Value type: unsigned long long (8 B)Contents:key = 0@@ -185,18 +185,18 @@ Unload it.. code-block:: consoletarget# shirudo upatch unload /workspace/shirudo/build/tutorial/sleep-count.unload.upatch- loaded signed loader: prog_fd=10 keyring=531121468 sig=4853B insns=165 data=2808B- upatch unload: payload matches for 'sleep-count'- upatch unload: chain extended, value=52764aa4e68b762c7e5bbacf1261bd3242b44a0b66876f34c89c5b8d57da7177- upatch unload measured: name=sleep-count chain=52764aa4e68b762c7e5bbacf1261bd3242b44a0b66876f34c89c5b8d57da7177- upatch unload: detached + unpinned sleep-count+ upatch unload: signed loader accepted, keyring 272801410, 165 instructions+ upatch unload: sleep-count carries the directive's payload+ upatch unload: sleep-count measured, register 52764aa4e68b762c7e5bbacf1261bd3242b44a0b66876f34c89c5b8d57da7177+ upatch unload: sleep-count detached and unpinned2. Check that the map is gone:.. code-block:: consoletarget# shirudo upatch map- (no pinned maps)+ Pinned maps (0):+ noneThe count was lost with the unload: the map lived only as long as theupatch. A single counter fits an array map. An upatch that accumulatesdiff --git a/Documentation/start/guides/publish-package.rst b/Documentation/start/guides/publish-package.rstindex 34ccdb9b..fd34577e 100644--- a/Documentation/start/guides/publish-package.rst+++ b/Documentation/start/guides/publish-package.rst@@ -140,12 +140,11 @@ none, so here the target installs by direct reference.target# BPM_OCI_SCHEME=http shirudo bpm install oci://10.0.2.2:5000/example/hello:1.0.0upatch load: --no-precheck, pre-flight state check skipped- loaded signed loader: prog_fd=11 keyring=531121468 sig=4853B insns=124 data=2376B- loader ok, retval=0 (maps=0 progs=1)- attached + pinned prog 0 (raw_tracepoint) -> /run/shirudo/bpffs/upatches/hello/link- upatch load: name=hello keyring=531121468 progs=1- upatch load: chain extended, value=55a8c670eb10d9bc6a9dc7475e3fc94407066016798dddbc59870138525f61b6- upatch load measured: name=hello chain=55a8c670eb10d9bc6a9dc7475e3fc94407066016798dddbc59870138525f61b6+ upatch load: signed loader accepted, keyring 272801410, 124 instructions+ upatch load: loader ran, 0 maps and 1 programs+ upatch load: program 0 (raw_tracepoint) pinned at /run/shirudo/bpffs/upatches/hello/link+ upatch load: hello loaded, 1 programs, keyring 272801410+ upatch load: hello measured, register 55a8c670eb10d9bc6a9dc7475e3fc94407066016798dddbc59870138525f61b6The target honors ``BPM_OCI_SCHEME`` as the operator does. Itdownloads the package and checks its digest against the registry's@@ -160,7 +159,9 @@ none, so here the target installs by direct reference... code-block:: consoletarget# shirudo bpm list- hello 1.0.0 direct+ Installed packages:+ NAME VERSION SOURCE+ hello 1.0.0 direct``direct`` marks a package installed by reference rather than from aregistered repository.@@ -183,11 +184,10 @@ Remove ittarget# shirudo bpm uninstall helloupatch unload: --no-precheck, pre-flight state check skipped- loaded signed loader: prog_fd=11 keyring=531121468 sig=4853B insns=165 data=2808B- upatch unload: payload matches for 'hello'- upatch unload: chain extended, value=f4f9b2f7cb9b442d78acc3b0527ad79a4cf9dd1eae1eaedffce9263c53571c05- upatch unload measured: name=hello chain=f4f9b2f7cb9b442d78acc3b0527ad79a4cf9dd1eae1eaedffce9263c53571c05- upatch unload: detached + unpinned hello+ upatch unload: signed loader accepted, keyring 272801410, 165 instructions+ upatch unload: hello carries the directive's payload+ upatch unload: hello measured, register f4f9b2f7cb9b442d78acc3b0527ad79a4cf9dd1eae1eaedffce9263c53571c05+ upatch unload: hello detached and unpinnedThe target runs the unload directives that shipped in the package andremoves the package. ``shirudo bpm list`` no longer lists it.diff --git a/Documentation/start/install.rst b/Documentation/start/install.rstindex c4912ee2..258e1463 100644--- a/Documentation/start/install.rst+++ b/Documentation/start/install.rst@@ -240,8 +240,9 @@ enforces once it boots through the shirudo initrd with everything thatnot write drop-ins for them.:doc:`/operate/deploy/boot-integration` sets these up. After the reboot,-``shirudo status`` on the target shows ``Status: ok``, ``Mode:-production`` and ``Bound in: initrd``.+``shirudo status`` on the target shows ``Status: ok`` and ``Mode:+production``, and ``shirudo status --show-full`` shows ``Bound in:+initrd``.Next steps----------diff --git a/Documentation/start/quickstart.rst b/Documentation/start/quickstart.rstindex 300768ae..17132a18 100644--- a/Documentation/start/quickstart.rst+++ b/Documentation/start/quickstart.rst@@ -177,77 +177,25 @@ Check enforcementFolded: keyrings, TPM measurement, assets (--show-full)- Conditions:- TYPE STATUS DETAIL- LsmAttached OK lsm/bpf link present and pinned- KeyringSealed OK bpf serial 130847582, dm-verity serial 962472513, pins match- ChainIntact OK live register equals the eventlog replay- TpmMeasured OK NV index 0x01818E00 readable- ConfigActive OK config dc90bacc356f.. is active-- Tamper attempts (this boot):- LoadNotLoader 15 program load that is not a signed loader- MapCreate 1 map creation by another executable- BpfCommand 8 detach, update, delete or unclassified bpf() command- SealPtrace 6 ptrace of a shirudo task-- Keyring (.bpf):- Serial: 130847582- Frozen serial: 130847582 (matches)- Certificates: 2 trusted, 0 revoked, 0 unvouched, 2 in the bpf keyring- d1bc43c91b9dabf4cd6f3ddf08a177927b3dac8ca833ddc496167253761b4497 (primary)- CN=shirudo, ML-DSA-87, issued 2026-10-29- key 199275792 shirudo: 6ec99b4c3d1c51e461ce1299fae6ab87d212ce9c (frozen)- c1c30b07f86808e81ae1c0458c926f00b85bcc815d371d23d7683903f2d3266e- CN=shirudo, ML-DSA-87, issued 2026-10-29- key 106884895 shirudo: c350bd270c426c5760b202062e15e274ea30f45d (frozen)-- Keyring (.dm-verity):- Serial: 962472513- Frozen serial: 962472513 (matches)- Certificates: 1 trusted, 1 in the dm-verity keyring- d1bc43c91b9dabf4cd6f3ddf08a177927b3dac8ca833ddc496167253761b4497 (config)- CN=shirudo, ML-DSA-87, issued 2026-10-29- key 200951639 shirudo: 6ec99b4c3d1c51e461ce1299fae6ab87d212ce9c (frozen)-- Loaded upatches (0):-- TPM measurement:- TPM: reachable (device:/dev/tpmrm0)- NV index: 0x01818E00 (anchored in PCR 9)- Chain: dc21c3dabcd2fd0a751c7146ad71c595f2386a4406feb64c3d6e2bd65c5bc706- Register name: 000b9b7b0f925415fdf0d5676369f8cc9146b9e3142537148b31e79dbffcc96e72f8- Anchored: yes (name on record)- PCR before init: 0000000000000000000000000000000000000000000000000000000000000000- Phase at init: 0000000000000000000000000000000000000000000000000000000000000000 (PCR 11)- Bound in: initrd- Chain vs eventlog: matches- Eventlog: /var/lib/shirudo/eventlog (1 entries, 1975 bytes)-- Assets (/var/lib/shirudo):- keys/cert.der present- keys/signing_key.pem absent- eventlog present (1975 bytes)- upatches/ absent- incoming/ absent- bpffs/ mounted-Your serials, digests and counts differ: the bundle generates its ownkeys, and the TPM and the guest are your own. Look at these parts:- ``Status: ok`` with every condition ``OK``. Scripts read the verdict- from ``shirudo status --json``, because the command exits with 0- whatever the verdict is.+ from ``shirudo status --json``: the command exits with 0 whatever+ the verdict is, unless ``--check`` makes it exit with 1 on+ ``tampered``.- ``Mode: production``: the LSM link is pinned.- - The keyring: the frozen serial matches the live one, and the ``.bpf``- keyring holds two certificates. The primary one belongs to the- bundle's signing key. The other is a second certificate, vouched for- by the first, which the test VM enrolls to exercise a set of keys.- - The TPM measurement: ``Bound in: initrd`` and ``Chain vs eventlog:- matches``. ``Chain`` is the register's value, and the eventlog holds- one entry, the boot event.- The tamper attempts: calls the policy refused since boot. Othersoftware on the guest has already made some.+ - The last line names the sections the report folds while their+ condition is ``OK``. ``shirudo status --show-full`` prints them.+ In the keyring section, the frozen serial matches the live one, and+ the ``.bpf`` keyring holds two certificates. The primary one belongs+ to the bundle's signing key. The other is a second certificate,+ vouched for by the first, which the test VM enrolls to exercise a+ set of keys. In the TPM measurement section, ``Bound in: initrd``+ and ``Chain vs eventlog: matches``. ``Chain`` is the register's+ value, and the eventlog holds one entry, the boot event.2. Try to read one of shirudo's pins as root:@@ -316,7 +264,7 @@ VM enrolled its certificate. You sign with that key on the host.Type: LOADPayload type: bpfVersion: 1- Payload SHA256: 46f3d9f5f6568bddb7692cad28e99a86a3104192d8a2251f9ef9ec6d593c2035+ Payload sha256: 46f3d9f5f6568bddb7692cad28e99a86a3104192d8a2251f9ef9ec6d593c2035File size: 8661 bytesLoader:@@ -337,7 +285,7 @@ VM enrolled its certificate. You sign with that key on the host.Decoders:(none)- ``Payload SHA256`` identifies what the upatch loads. The target records+ ``Payload sha256`` identifies what the upatch loads. The target recordsit with the load, and the register measures it.5. Keep the payload digest:@@ -370,7 +318,7 @@ Load itupatch load: loader ran, 0 maps and 1 programsupatch load: program 0 (raw_tracepoint) pinned at /run/shirudo/bpffs/upatches/basic/linkupatch load: basic loaded, 1 programs, keyring 272801410- upatch load: basic measured, register 7f63313a31ac8ddd3a6a16fce2038322c9c782d5787155d2dc18dfa582dff548+ upatch load: basic measured, register ff0eb201e073fdeeba80a4b268f039bea58ec6dd2998e6651c4834ee99f3e103The kernel checked the loader's signature against the ``.bpf`` keyring(the serial from the status report) before it accepted the load. The@@ -386,7 +334,7 @@ Load ittarget# shirudo upatch listArchived upatches (/var/lib/shirudo/upatches):NAME LOADED TYPE KIND PAYLOAD- basic yes load bpf 8aee7072a1a15e4d..+ basic yes load bpf 46f3d9f5f6568bdd..The target keeps a copy of the artifact and loads it again at the nextboot.@@ -399,20 +347,13 @@ Load it...Loaded upatches (1):NAME LOCATION MAPS STATUS AGE- basic fentry/do_nanosleep 0 success 1s-- TPM measurement:- ...- Chain: 7f63313a31ac8ddd3a6a16fce2038322c9c782d5787155d2dc18dfa582dff548- ...- Eventlog: /var/lib/shirudo/eventlog (2 entries, 2324 bytes)+ basic fentry/do_nanosleep 0 success 1s...-TPM measurement:...Chain: ff0eb201e073fdeeba80a4b268f039bea58ec6dd2998e6651c4834ee99f3e103...- Eventlog: /var/lib/shirudo/eventlog (2 entries, 2311 bytes)+ Eventlog: /var/lib/shirudo/eventlog (2 entries, 2324 bytes)...The register moved from its boot value to the value the load printed,@@ -485,15 +426,15 @@ nothing but the evidence, your certificates and your artifacts.OK register: certified contents match the listed valueOK quote and certification are of one TPM resetOK config: config root history matches the quoted PCR- note config root has no operator approval; use --expect-config-root with --expect-config-pcr- note config records a selection; direct TPM writer protection is deferred+ NOTE config root has no operator approval; use --expect-config-root with --expect-config-pcr+ NOTE config records a selection; direct TPM writer protection is deferredOK eventlog: this boot has an init record...OK eventlog: 2 records replay to the certified valueOK anchor: record digest matches the index nameOK anchor: PCR 9 equals the recorded value extended by the anchorOK state: register equals the expected value- note event after boot: upatch_load basic+ NOTE event after boot: upatch_load basicverdict: ok``<register-after-events>`` is the last line of the prediction. The@@ -519,7 +460,7 @@ Unload ittarget# shirudo upatch unload basic.unload.upatchupatch unload: signed loader accepted, keyring 272801410, 165 instructionsupatch unload: basic carries the directive's payload- upatch unload: basic measured, register 256f5ad373d8728c777455949bef6ee362c2460c06740ac971f7fba5b19315cc+ upatch unload: basic measured, register fe7bd139c02aca0d6e5efc3940c1cd902adbe676b7875be4c73c878b3f5212b8upatch unload: basic detached and unpinnedThe target ran the signed directive, checked that the loaded payload isdiff --git a/Documentation/upatches/learn/kernel-fix-tutorial.rst b/Documentation/upatches/learn/kernel-fix-tutorial.rstindex c22946bd..f2936421 100644--- a/Documentation/upatches/learn/kernel-fix-tutorial.rst+++ b/Documentation/upatches/learn/kernel-fix-tutorial.rst@@ -202,7 +202,7 @@ Read the artifact back before it leaves the operator host:Type: LOADPayload type: bpfVersion: 1- Payload SHA256: f3e2894d7c20d90e759b9d716849fc2acf01ff5de2ad8565b1e0f0320ef9e711+ Payload sha256: f3e2894d7c20d90e759b9d716849fc2acf01ff5de2ad8565b1e0f0320ef9e711File size: 10069 bytesLoader:@@ -223,7 +223,7 @@ Read the artifact back before it leaves the operator host:Decoders:(none)-``Payload SHA256`` is the SHA-256 of the signed loader and its data. The+``Payload sha256`` is the SHA-256 of the signed loader and its data. Thesigned sections hold the name and the attach metadata, one program entryfor the fentry program. The file carries no decoders, because the sourcedeclares none.@@ -256,20 +256,19 @@ runtime image. Load the upatch and print the report:target# shirudo-runtime upatch load --report=- \/mnt/shirudo-src/build/rpl-shield/cve-2026-63984-rpl.upatch- loaded signed loader: prog_fd=10 keyring=531121468 sig=4853B insns=172 data=3480B- loader ok, retval=0 (maps=2 progs=1)- attached + pinned prog 0 (raw_tracepoint) -> /run/shirudo/bpffs/upatches/cve-2026-63984-rpl/link- pinned map 0 (hits, type=6) -> /run/shirudo/bpffs/upatches/cve-2026-63984-rpl/maps/hits- pinned map 1 (activity, type=6) -> /run/shirudo/bpffs/upatches/cve-2026-63984-rpl/maps/activity- upatch load: name=cve-2026-63984-rpl keyring=531121468 progs=1- upatch load: chain extended, value=3380b0e2d22c066ecba561c182869b1366e5706f73fc3a657b907394953cfbfc- upatch load measured: name=cve-2026-63984-rpl chain=3380b0e2d22c066ecba561c182869b1366e5706f73fc3a657b907394953cfbfc+ upatch load: signed loader accepted, keyring 531121468, 172 instructions+ upatch load: loader ran, 2 maps and 1 programs+ upatch load: program 0 (raw_tracepoint) pinned at /run/shirudo/bpffs/upatches/cve-2026-63984-rpl/link+ upatch load: map 0 (hits) pinned at /run/shirudo/bpffs/upatches/cve-2026-63984-rpl/maps/hits+ upatch load: map 1 (activity) pinned at /run/shirudo/bpffs/upatches/cve-2026-63984-rpl/maps/activity+ upatch load: cve-2026-63984-rpl loaded, 1 programs, keyring 531121468+ upatch load: cve-2026-63984-rpl measured, register 3380b0e2d22c066ecba561c182869b1366e5706f73fc3a657b907394953cfbfc{"schema":1,"result":"ok","op":"upatch_load","phase":"done","errno":null,"errno_name":null,"category":"ok","message":"","verifier_log":"","loader_return":0,"upatch":{"path":"/mnt/shirudo-src/build/rpl-shield/cve-2026-63984-rpl.upatch","name":"cve-2026-63984-rpl","payload_sha256":"f3e2894d7c20d90e759b9d716849fc2acf01ff5de2ad8565b1e0f0320ef9e711"},"kernel":{"release":"7.3.0-bpf-next+"},"tpm":{"nv_index":"0x01818E00","chain_after":"3380b0e2d22c066ecba561c182869b1366e5706f73fc3a657b907394953cfbfc"}}The log lines go to standard error and the JSON report to standardoutput. The report has ``"result":"ok"``, phase ``done`` and category``ok``, and its ``tpm.chain_after`` is the measurement register after the-load. ``attached + pinned prog 0 (raw_tracepoint)`` means that shirudo+load. ``program 0 (raw_tracepoint) pinned at ...`` means that shirudoattached the fentry program through ``BPF_RAW_TRACEPOINT_OPEN`` at thefunction the verifier bound, and pinned the link.:doc:`/upatches/test/debugging` explains the report when a load fails.@@ -309,12 +308,12 @@ Read one map:target# shirudo-runtime upatch map cve-2026-63984-rpl hitsName: cve-2026-63984-rpl- Map: hits- Type: percpu_array (64 CPUs)- Max entries: 1- Entries: 1 of 1- Key type: unsigned int (4 B)- Value type: unsigned long long (8 B)+ Map: hits+ Type: percpu_array (64 CPUs)+ Max entries: 1+ Entries: 1 of 1+ Key type: unsigned int (4 B)+ Value type: unsigned long long (8 B)Contents:key=0: sum=0@@ -336,11 +335,10 @@ Apply the unload directive:target# shirudo-runtime upatch unload --report=- \/mnt/shirudo-src/build/rpl-shield/cve-2026-63984-rpl.unload.upatch- loaded signed loader: prog_fd=10 keyring=531121468 sig=4853B insns=165 data=2808B- upatch unload: payload matches for 'cve-2026-63984-rpl'- upatch unload: chain extended, value=3b96bfbac667807c99332a8d2ba9d2a7b5eb74db42aba18eea452bef9a7d0c6b- upatch unload measured: name=cve-2026-63984-rpl chain=3b96bfbac667807c99332a8d2ba9d2a7b5eb74db42aba18eea452bef9a7d0c6b- upatch unload: detached + unpinned cve-2026-63984-rpl+ upatch unload: signed loader accepted, keyring 531121468, 165 instructions+ upatch unload: cve-2026-63984-rpl carries the directive's payload+ upatch unload: cve-2026-63984-rpl measured, register 3b96bfbac667807c99332a8d2ba9d2a7b5eb74db42aba18eea452bef9a7d0c6b+ upatch unload: cve-2026-63984-rpl detached and unpinned{"schema":1,"result":"ok","op":"upatch_unload","phase":"done","errno":null,"errno_name":null,"category":"ok","message":"","verifier_log":"","loader_return":0,"upatch":{"path":"/mnt/shirudo-src/build/rpl-shield/cve-2026-63984-rpl.unload.upatch","name":"cve-2026-63984-rpl","payload_sha256":"f3e2894d7c20d90e759b9d716849fc2acf01ff5de2ad8565b1e0f0320ef9e711"},"kernel":{"release":"7.3.0-bpf-next+"},"tpm":{"nv_index":"0x01818E00","chain_after":"3b96bfbac667807c99332a8d2ba9d2a7b5eb74db42aba18eea452bef9a7d0c6b"}}The report again shows category ``ok``. The kernel verified thediff --git a/Documentation/upatches/publish/beefile.rst b/Documentation/upatches/publish/beefile.rstindex 19b86817..ceddc885 100644--- a/Documentation/upatches/publish/beefile.rst+++ b/Documentation/upatches/publish/beefile.rst@@ -11,7 +11,7 @@ Beefile referenceA Beefile describes a package: its name, the files it ships, the upatches``shirudo bpm build`` compiles and signs into it, and the entries``shirudo bpm tree append`` publishes to an upatch tree. ``bpm build``-reads ``<context>/Beefile``, or the file given with ``-f``, and treats+reads ``<context>/Beefile``, or the file given with ``--file``, and treatsthe directory that holds it as the package directory. Every path in theBeefile is relative to that directory. The package archives the Beefileunchanged as its ``Beefile`` member. :doc:`/reference/cli/bpm` lists the@@ -222,10 +222,11 @@ libbpf headers.bit = 0x1paths = ["/usr/local/apache", "/usr/bin/apache"]-``id`` maps to one one-hot 64-bit mask. Repeating the same ID and mask in-other upatches extends that policy; an ID cannot change masks, and two-different IDs cannot use the same mask in one package. Paths may name-non-executable files.+``id`` maps to one one-hot 64-bit mask. ``bit`` is read as hexadecimal,+with or without ``0x``, so ``bit = 10`` is ``0x10``. Repeating the same+ID and mask in other upatches extends that policy; an ID cannot change+masks, and two different IDs cannot use the same mask in one package.+Every path is absolute and may name a non-executable file.For an upatch with at least one policy table, include ``policy.h`` inits BPF source so it declares both shared maps with the required ABI.@@ -238,7 +239,7 @@ programs must treat them as read-only by contract.The generator and the updater run on the operator host with theoperator's rights. The target receives only the signed result. Without-``-f``, ``bpm config update`` takes the Beefile and the updater from the+``--file``, ``bpm config update`` takes the Beefile and the updater from thebase package and runs them. It also trusts the base package's unsignedheader to locate ``.rodata`` before it re-signs, so run it only on a basepackage you built or verified yourself.@@ -323,7 +324,8 @@ Unknown keys and tables* - Where- Result* - an unknown key in ``[package]``, ``[[files]]``, ``[[upatches]]``,- ``[[upatches.rodata]]`` or ``[upatches.tree.selector]``+ ``[[upatches.rodata]]``, ``[[upatches.policy]]`` or+ ``[upatches.tree.selector]``- refused* - an unknown array of tables, ``[[name]]``- refused@@ -352,6 +354,10 @@ Limits and reserved names- 16* - arguments per ``generator`` or ``update`` command- 16+ * - ``[[upatches.policy]]`` tables per upatch+ - 64+ * - ``paths`` per policy table+ - 16* - values per selector key- 16* - keys in each of ``kconfig`` and ``labels``diff --git a/Documentation/upatches/publish/publishing.rst b/Documentation/upatches/publish/publishing.rstindex d3bbe383..c6786edb 100644--- a/Documentation/upatches/publish/publishing.rst+++ b/Documentation/upatches/publish/publishing.rst@@ -41,7 +41,7 @@ Build the packageoperator$ shirudo bpm build <package-dir> --version <version> \--keys-dir <keys-dir>- ``<package-dir>`` holds the ``Beefile``; pass ``-f <file>`` for a+ ``<package-dir>`` holds the ``Beefile``; pass ``--file <file>`` for aBeefile with another name. ``<version>`` is the new version and``<keys-dir>`` your key directory. The command prints the path of``<name>-<version>.bee``, which it writes into the current directory.diff --git a/Documentation/upatches/test/testing.rst b/Documentation/upatches/test/testing.rstindex ee64be3a..c0cc0bf8 100644--- a/Documentation/upatches/test/testing.rst+++ b/Documentation/upatches/test/testing.rst@@ -53,10 +53,10 @@ Boot the test VM.. code-block:: consoletarget# shirudo-runtime status- Host: upatch-dev- Roles: target- Mode: production- Status: ok+ Host: upatch-dev+ Roles: target+ Mode: production+ Status: ok...The ``Status:`` line reads ``ok``. In the VM, run every shirudo commanddiff --git a/builtin-attest.c b/builtin-attest.cindex 3d850340..5fe3b561 100644--- a/builtin-attest.c+++ b/builtin-attest.c@@ -512,7 +512,7 @@ out:}/*- * The report is one check or note per line, OK, FAIL or note then the+ * The report is one check or note per line, OK, FAIL or NOTE then the* text, which the JSON form carries as an array of objects.*/static int report_emit_json(const char *report, const char *verdict)@@ -538,7 +538,7 @@ static int report_emit_json(const char *report, const char *verdict)kind = "ok";else if (len > 8 && !strncmp(line, " FAIL ", 8))kind = "fail";- else if (len > 8 && !strncmp(line, " note ", 8))+ else if (len > 8 && !strncmp(line, " NOTE ", 8))kind = "note";if (kind) {size_t n = min(len - 8, sizeof(text) - 1);@@ -1091,7 +1091,7 @@ static int cmd_attest_evidence(int argc, const char **argv)return 1;}if (ret == -EKEYREJECTED) {- pr_err("attest: the challenge was refused (tampered?)");+ pr_err("attest: the TPM refused the challenge; the attestation key or the endorsement key is not this TPM's");return 1;}if (ret) {diff --git a/builtin-bpm.c b/builtin-bpm.cindex d8c70b04..812ce7be 100644--- a/builtin-bpm.c+++ b/builtin-bpm.c@@ -2099,7 +2099,7 @@ static int cmd_bpm_tree_sync(int argc, const char **argv)return 2;}} else if (is_help(argv[i])) {- printf("usage: shirudo bpm tree sync [--dry-run] [--report=<path>]\n");+ fprintf(stderr, "usage: shirudo bpm tree sync [--dry-run] [--report=<path>]\n");ret = 0;goto out;} else {@@ -2862,6 +2862,10 @@ int cmd_bpm(int argc, const char **argv)if (!strcmp(sub, "repo") && argc >= 3 && !strcmp(argv[2], "update")) {int lock, ret = 0;+ if (argc == 4 && is_help(argv[3])) {+ fprintf(stderr, "usage: shirudo bpm repo update [<source>]\n");+ return 0;+ }if (argc > 4)return 2;if (curl_global_init(CURL_GLOBAL_DEFAULT) != CURLE_OK)@@ -2923,6 +2927,10 @@ int cmd_bpm(int argc, const char **argv)}if (!strcmp(sub, "key"))return cmd_bpm_key(argc - 1, argv + 1);+ if (!strcmp(sub, "install") && argc == 3 && is_help(argv[2])) {+ fprintf(stderr, "usage: shirudo bpm install <package>\n");+ return 0;+ }if (!strcmp(sub, "install") && argc == 3)return with_tables(bpm_install, argv[2], "install");if (!strcmp(sub, "list")) {diff --git a/builtin-keys.c b/builtin-keys.cindex ae3ff5be..a2c78972 100644--- a/builtin-keys.c+++ b/builtin-keys.c@@ -509,7 +509,7 @@ static const struct help_section keys_help_sections[] = {static const struct help keys_help = {.usage = "shirudo keys [--keys-dir <dir>] [--json]\n"" shirudo keys add <cert.der> --vouch <file>\n"- " shirudo keys revoke <fingerprint> [--promote <fp>]\n"+ " shirudo keys revoke\n"" shirudo keys vouch <cert.der> [-o <file>]",.summary = "Inspect the shirudo key material this host holds: the ""on-disk cert and\nsigning key (if present), the trusted "diff --git a/builtin-status.c b/builtin-status.cindex 44923b3b..5d80f76a 100644--- a/builtin-status.c+++ b/builtin-status.c@@ -354,7 +354,7 @@ static const struct help_item status_options[] = {"system and eventlog sections" },{ "--include-system", "add the system section: OS, kernel, machine, ""memory, disk, uptime" },- { "--include-eventlog", "add this boot's eventlog records" },+ { "--include-eventlog", "add the eventlog records, all boots" },};static const struct help_section status_help_sections[] = {diff --git a/builtin-upatch.c b/builtin-upatch.cindex e22aa246..dc1ac2dd 100644--- a/builtin-upatch.c+++ b/builtin-upatch.c@@ -1409,7 +1409,8 @@ static int attach_and_pin_progs(const struct loader_ctx *cx,goto out;}made[i] = true;- pr_info("pinned serializer prog %u -> %s", i, pin);+ pr_info("upatch load: serializer program %u pinned at %s",+ i, pin);continue;}if (spec->role == UPATCH_PROG_ROLE_TEST_RUN) {@@ -1429,7 +1430,8 @@ static int attach_and_pin_progs(const struct loader_ctx *cx,goto out;}made[i] = true;- pr_info("pinned test-run prog %u -> %s", i, pin);+ pr_info("upatch load: test-run program %u pinned at %s",+ i, pin);continue;}attach_seen++;@@ -1554,7 +1556,7 @@ static int pin_upatch_maps(const struct loader_ctx *cx,continue;err = bpf_map_get_info_by_fd(md->map_fd, &info, &info_len);if (err) {- pr_warn("upatch maps: get_info(map %u): %s",+ pr_warn("upatch load: map %u info: %s",i, strerror(errno));continue;}@@ -1571,12 +1573,12 @@ static int pin_upatch_maps(const struct loader_ctx *cx,if (stat(pin, &st) == 0)continue; /* already pinned (idempotent) */if (obj_pin(md->map_fd, pin) != 0) {- pr_warn("upatch maps: pin %s: %s", pin,+ pr_warn("upatch load: pin %s: %s", pin,strerror(errno));continue;}- pr_info("pinned map %u (%s, type=%u) -> %s",- i, info.name, (__u32)info.type, pin);+ pr_info("upatch load: map %u (%s) pinned at %s",+ i, info.name, pin);}return 0;}@@ -2403,9 +2405,8 @@ static int upatch_chain_event_locked(const char *tag, const char *type,return ret;}if (ret) {- pr_err("upatch %s: chain extend failed (category: tpm_error) "- "-- op done but chain NOT advanced; operator must "- "reconcile", op);+ pr_err("upatch %s: register extend failed (category: tpm_error): "+ "done but not measured; the operator must reconcile", op);return ret;}if (measured)@@ -2984,8 +2985,8 @@ static int cmd_upatch_load(int argc, const char **argv)*/err = persist_upatch(file, name);if (err) {- pr_err("upatch load: loaded but failed to persist to %s: %s "- "-- not measured", UPATCHES_DIR, strerror(-err));+ pr_err("upatch load: loaded but not archived under %s: %s; "+ "not measured", UPATCHES_DIR, strerror(-err));unload_unmeasured(name);rep_fail(&rep, "persist", "unknown", -err,"persist failed; the load was undone");diff --git a/completion/shirudo.bash b/completion/shirudo.bashindex facae0d6..e987f8a0 100644--- a/completion/shirudo.bash+++ b/completion/shirudo.bash@@ -3,24 +3,24 @@## bash completion for shirudo#-# Command and subcommand name lists are pulled live from the binary via-# `shirudo <command> --list-cmds`, so adding a (sub)command in the-# C dispatch table makes it appear here automatically -- this file does-# NOT need editing for new names. Per-command FLAG lists are still-# hand-maintained below; update them when a flag is added or removed.+# Command and subcommand names come from the binary through+# `shirudo <command> --list-cmds`, so a new (sub)command in the C dispatch+# table appears here by itself. The option lists are kept by hand: update+# them when an option is added or removed. A valued option takes its+# value after a space or after `=`, so the lists offer the bare name,+# except where the parser takes `=` only.## Install: copied to $(sharedir)/bash-completion/completions/shirudo by# `make install`. To try it in place: `source completion/shirudo.bash`._shirudo(){- local cur cword cmd sub bin+ local cur prev cword cmd sub bincur="${COMP_WORDS[COMP_CWORD]}"+ prev="${COMP_WORDS[COMP_CWORD-1]}"cword=$COMP_CWORDbin="${COMP_WORDS[0]}"- # First word: the top-level command, pulled live from the binary- # the user is completing -- always matches that build.if (( cword == 1 )); thenlocal cmdscmds=$("$bin" --list-cmds 2>/dev/null)@@ -37,8 +37,8 @@ _shirudo()subs=$("$bin" image --list-cmds 2>/dev/null)COMPREPLY=( $(compgen -W "$subs" -- "$cur") )elif [[ $cur == -* && $sub == build ]]; then- COMPREPLY=( $(compgen -W "-o --kind --keys-dir --key \- --cert --salt" -- "$cur") )+ COMPREPLY=( $(compgen -W "-o --output --kind --keys-dir \+ --key --cert --salt --builder" -- "$cur") )elif [[ $cur == -* && $sub == verify ]]; thenCOMPREPLY=( $(compgen -W "--cert" -- "$cur") )elif [[ $cur == -* && $sub == status ]]; then@@ -55,24 +55,23 @@ _shirudo()elif [[ $cur == -* ]]; thencase "$sub" inload|unload)- COMPREPLY=( $(compgen -W "--expect-chain= \- --expect-version-id= --no-precheck \- --no-version-check --report=" \- -- "$cur") )+ COMPREPLY=( $(compgen -W "--expect-chain \+ --expect-version-id --no-precheck \+ --no-version-check --report" -- "$cur") );;info|list)COMPREPLY=( $(compgen -W "--json" -- "$cur") );;map)COMPREPLY=( $(compgen -W "--json= --show-full \- --otel \- --otel-endpoint= --otel-insecure \- --otel-retries= --s3-uri=s3://" -- "$cur") )+ --all --peek --otel --otel-endpoint \+ --otel-insecure --otel-retries \+ --tenant-id --s3-uri" -- "$cur") );;get)- # no flags beyond --help- COMPREPLY=()- ;;+ COMPREPLY=( $(compgen -W "--json --show-full" \+ -- "$cur") )+ ;;esacelseCOMPREPLY=( $(compgen -f -X '!*.upatch' -- "$cur") \@@ -86,35 +85,46 @@ _shirudo()COMPREPLY=( $(compgen -W "$subs" -- "$cur") )elif [[ $sub == config && cword -eq 3 ]]; thenCOMPREPLY=( $(compgen -W "register update" -- "$cur") )- elif [[ $sub == config && ${COMP_WORDS[3]} == update && ${COMP_WORDS[COMP_CWORD-1]} == --base-package ]]; then- COMPREPLY=( $(compgen -f -X '!*.bee' -- "$cur") )- elif [[ $sub == config && ${COMP_WORDS[3]} == update && (${COMP_WORDS[COMP_CWORD-1]} == -f ||- ${COMP_WORDS[COMP_CWORD-1]} == --file) ]]; then+ elif [[ $sub == config && ${COMP_WORDS[3]} == update &&+ ($prev == --base-package || $prev == --file) ]]; thenCOMPREPLY=( $(compgen -f -X '!*.bee' -- "$cur") )- elif [[ $sub == config && ${COMP_WORDS[3]} == update && ${COMP_WORDS[COMP_CWORD-1]} == --rodata-input ]]; then+ elif [[ $sub == config && ${COMP_WORDS[3]} == update &&+ $prev == --keys-dir ]]; then+ COMPREPLY=( $(compgen -d -- "$cur") )+ elif [[ $sub == config && ${COMP_WORDS[3]} == update &&+ $prev == --rodata-input ]]; thenCOMPREPLY=( $(compgen -f -- "$cur") $(compgen -d -- "$cur") )- elif [[ $sub == config && ${COMP_WORDS[3]} == update && $cur == -* ]]; then- COMPREPLY=( $(compgen -W "--base-package --version -f --file --keys-dir --rodata-input" -- "$cur") )+ elif [[ $sub == config && ${COMP_WORDS[3]} == update &&+ $cur == -* ]]; then+ COMPREPLY=( $(compgen -W "--base-package --version --file \+ --keys-dir --rodata-input" -- "$cur") )elif [[ $sub == config && ${COMP_WORDS[3]} == update ]]; then- COMPREPLY=( $(compgen -f -X '!*.bee' -- "$cur") $(compgen -d -- "$cur") )- elif [[ $sub == config && ${COMP_WORDS[3]} == register && cword -eq 4 ]]; then+ COMPREPLY=( $(compgen -f -X '!*.bee' -- "$cur") \+ $(compgen -d -- "$cur") )+ elif [[ $sub == config && ${COMP_WORDS[3]} == register &&+ cword -eq 4 ]]; thenCOMPREPLY=( $(compgen -W "add list remove" -- "$cur") )- elif [[ $sub == config && ${COMP_WORDS[3]} == register && ${COMP_WORDS[4]} == list ]]; then+ elif [[ $sub == config && ${COMP_WORDS[3]} == register &&+ ${COMP_WORDS[4]} == list ]]; thenCOMPREPLY=( $(compgen -W "--json" -- "$cur") )- elif [[ ($sub == list || ($sub == key && ${COMP_WORDS[3]} == list)) && $cur == -* ]]; then+ elif [[ $sub == config && ${COMP_WORDS[3]} == register &&+ ${COMP_WORDS[4]} == add && $cur == -* ]]; then+ COMPREPLY=( $(compgen -W "--cert" -- "$cur") )+ elif [[ ($sub == list || ($sub == key && ${COMP_WORDS[3]} == list)) &&+ $cur == -* ]]; thenCOMPREPLY=( $(compgen -W "--json" -- "$cur") )- elif [[ $sub == config && ${COMP_WORDS[3]} == register && ${COMP_WORDS[4]} == add && $cur == -* ]]; then- COMPREPLY=( $(compgen -W "--cert=" -- "$cur") )elif [[ $sub == repo && cword -eq 3 ]]; thenCOMPREPLY=( $(compgen -W "update" -- "$cur") )elif [[ $sub == info && cword -eq 3 ]]; thenCOMPREPLY=( $(compgen -W "upatches data" -- "$cur") \$(compgen -f -X '!*.bee' -- "$cur") \$(compgen -d -- "$cur") )- elif [[ $sub == info && ${COMP_WORDS[3]} == upatches && cword -eq 4 ]]; then+ elif [[ $sub == info && ${COMP_WORDS[3]} == upatches &&+ cword -eq 4 ]]; thenCOMPREPLY=( $(compgen -f -X '!*.bee' -- "$cur") \$(compgen -d -- "$cur") )- elif [[ $sub == info && ${COMP_WORDS[3]} == upatches && cword -eq 5 ]]; then+ elif [[ $sub == info && ${COMP_WORDS[3]} == upatches &&+ cword -eq 5 ]]; thenCOMPREPLY=( $(compgen -W "--all" -- "$cur") )elif [[ $sub == info && ${COMP_WORDS[3]} == data && cword -eq 4 ]]; thenCOMPREPLY=( $(compgen -f -X '!*.bee' -- "$cur") \@@ -127,49 +137,49 @@ _shirudo()elif [[ $sub == info ]]; thenCOMPREPLY=( $(compgen -f -X '!*.bee' -- "$cur") \$(compgen -d -- "$cur") )- elif [[ $sub == build && (${COMP_WORDS[COMP_CWORD-1]} == -f ||- ${COMP_WORDS[COMP_CWORD-1]} == --file) ]]; then+ elif [[ $sub == build && $prev == --file ]]; thenCOMPREPLY=( $(compgen -f -X '!*.bee' -- "$cur") \$(compgen -d -- "$cur") )- elif [[ $sub == build && ${COMP_WORDS[COMP_CWORD-1]} == --keys-dir ]]; then+ elif [[ $sub == build && $prev == --keys-dir ]]; thenCOMPREPLY=( $(compgen -d -- "$cur") )- elif [[ $sub == build && ${COMP_WORDS[COMP_CWORD-1]} == --vmlinux ]]; then+ elif [[ $sub == build && $prev == --vmlinux ]]; thenCOMPREPLY=( $(compgen -f -- "$cur") )- elif [[ $sub == build && ${COMP_WORDS[COMP_CWORD-1]} == --rodata-input ]]; then+ elif [[ $sub == build && $prev == --rodata-input ]]; thenCOMPREPLY=( $(compgen -f -- "$cur") $(compgen -d -- "$cur") )elif [[ $sub == build && $cur == -* ]]; then- COMPREPLY=( $(compgen -W "-f --file --version --keys-dir \+ COMPREPLY=( $(compgen -W "--file --version --keys-dir \--vmlinux --rodata-input" -- "$cur") )elif [[ $sub == build ]]; thenCOMPREPLY=( $(compgen -d -- "$cur") )elif [[ $sub == tree && cword -eq 3 ]]; thenCOMPREPLY=( $(compgen -W "sync append" -- "$cur") )elif [[ $sub == tree && ${COMP_WORDS[3]} == sync && $cur == -* ]]; then- COMPREPLY=( $(compgen -W "--dry-run --report=" -- "$cur") )+ COMPREPLY=( $(compgen -W "--dry-run --report" -- "$cur") )elif [[ $sub == tree && ${COMP_WORDS[3]} == append && $cur == -* ]]; thenCOMPREPLY=( $(compgen -W "--keys-dir --key --cert --tree-id \--reference --op" -- "$cur") )elif [[ $sub == tree && ${COMP_WORDS[3]} == append ]]; then- COMPREPLY=( $(compgen -f -X '!*.bee' -- "$cur") $(compgen -d -- "$cur") )+ COMPREPLY=( $(compgen -f -X '!*.bee' -- "$cur") \+ $(compgen -d -- "$cur") )elif [[ $sub == push && $cur == -* ]]; then- COMPREPLY=( $(compgen -W "--keys-dir --index-cert --index-key" -- "$cur") )+ COMPREPLY=( $(compgen -W "--keys-dir --index-cert \+ --index-key" -- "$cur") )elif [[ $sub == push ]]; then- COMPREPLY=( $(compgen -f -X '!*.bee' -- "$cur") $(compgen -d -- "$cur") )+ COMPREPLY=( $(compgen -f -X '!*.bee' -- "$cur") \+ $(compgen -d -- "$cur") )elif [[ $sub == key && cword -eq 3 ]]; thenlocal subssubs=$("$bin" bpm key --list-cmds 2>/dev/null)COMPREPLY=( $(compgen -W "$subs" -- "$cur") )elif [[ $sub == key && (${COMP_WORDS[3]} == add ||${COMP_WORDS[3]} == fingerprint) ]]; then- COMPREPLY=( $(compgen -f -X '!*.bee' -- "$cur") $(compgen -f -- "$cur") )- elif [[ $sub == install && $cword -eq 3 ]]; then- COMPREPLY=( $(compgen -W "example/package" -- "$cur") )+ COMPREPLY=( $(compgen -f -- "$cur") )fi;;build)if [[ $cur == -* ]]; then- COMPREPLY=( $(compgen -W "-o --name --key --cert \- --vmlinux --extra-cflags --unload \+ COMPREPLY=( $(compgen -W "-o --output --name --keys-dir \+ --key --cert --vmlinux --extra-cflags --unload \--payload-sha256 --emit-artifacts" -- "$cur") )elseCOMPREPLY=( $(compgen -f -X '!*.bpf.c' -- "$cur") \@@ -181,48 +191,46 @@ _shirudo()COMPREPLY=( $(compgen -W "--check-only --json" -- "$cur") );;status)- COMPREPLY=( $(compgen -W "--json \- --include-system --include-eventlog \- --check --show-full" -- "$cur") )+ COMPREPLY=( $(compgen -W "--json --otel --check --show-full \+ --include-system --include-eventlog" -- "$cur") );;attest)if [[ $cword -eq 2 && $cur != -* ]]; thenCOMPREPLY=( $(compgen -W "verify predict challenge" -- "$cur") )elif [[ $sub == verify ]]; then- COMPREPLY=( $(compgen -W "--evidence= --nonce= --ak-name= \- --cert= --upatch= --expect= --tree-root= \- --expect-chain= --expect-pcr= --expect-credential= \- --allow-runtime-events --strict-anchor --json \- --expect-config-root= --expect-config-pcr=" -- "$cur") )+ COMPREPLY=( $(compgen -W "--evidence --nonce --ak-name \+ --ek-name --cert --upatch --expect --tree-root \+ --expect-chain --expect-pcr --expect-bind-pcr \+ --expect-credential --expect-config-root \+ --expect-config-pcr --allow-runtime-events \+ --strict-anchor --require-initrd --json" -- "$cur") )elif [[ $sub == predict ]]; then- COMPREPLY=( $(compgen -W "--cert= --upatch= --expect= \- --tree-root= --event= --json" -- "$cur") )+ COMPREPLY=( $(compgen -W "--cert --upatch --expect \+ --tree-root --event --writer-public --bind-pcr \+ --json" -- "$cur") )elif [[ $sub == challenge ]]; then- COMPREPLY=( $(compgen -W "--evidence= --ek-ca= --output=" \+ COMPREPLY=( $(compgen -W "--evidence --ek-ca --ak-name \+ --ek-name --trust-presented-ek -o --output" \-- "$cur") )else- COMPREPLY=( $(compgen -W "--nonce= --pcrs= --challenge= \- --output=" -- "$cur") )+ COMPREPLY=( $(compgen -W "--nonce --pcrs --challenge \+ -o --output" -- "$cur") )fi;;keys)if (( cword == 2 )); thenlocal subssubs=$("$bin" keys --list-cmds 2>/dev/null)- COMPREPLY=( $(compgen -W "$subs --keys-dir= --json" -- "$cur") )+ COMPREPLY=( $(compgen -W "$subs --keys-dir --json" -- "$cur") )elif [[ $cur == -* ]]; thencase "$sub" inadd)- COMPREPLY=( $(compgen -W "--vouch= --keys-dir=" \+ COMPREPLY=( $(compgen -W "--vouch --keys-dir" \-- "$cur") );;vouch)- COMPREPLY=( $(compgen -W "-o --keys-dir= --key \- --cert" -- "$cur") )- ;;- revoke)- COMPREPLY=( $(compgen -W "--promote= --force" \- -- "$cur") )+ COMPREPLY=( $(compgen -W "-o --output --keys-dir \+ --key --cert" -- "$cur") );;esacelse@@ -230,14 +238,13 @@ _shirudo()fi;;genkey)- COMPREPLY=( $(compgen -W "--keys-dir= --force -f" -- "$cur") )+ COMPREPLY=( $(compgen -W "--keys-dir --force -f" -- "$cur") );;config|version|help)- # nothing to complete beyond --help / --list-cmds;;esac- # A "--flag=" completion takes a value -- don't append a space.+ # A completion that ends in `=` takes its value right after it.if (( ${#COMPREPLY[@]} == 1 )) && [[ ${COMPREPLY[0]} == *= ]]; thencompopt -o nospace 2>/dev/nullfidiff --git a/testing/functional/tamperproof/t6111-seal-scratch.sh b/testing/functional/tamperproof/t6111-seal-scratch.shindex b4b4d8f7..2e1bc5a5 100644--- a/testing/functional/tamperproof/t6111-seal-scratch.sh+++ b/testing/functional/tamperproof/t6111-seal-scratch.sh@@ -250,7 +250,7 @@ for name, op in [sys.exit(bad)PYEOF-test_expect_success 'a label read that fails through an idmapped mount leaves a marked file sealed' '+test_expect_success 'a labelled file stays sealed through an idmapped mount' 'mkdir -p "$WORK/idm" &&unshare -m sh -c "mount --bind -o X-mount.idmap=0:65534:1 $MNT $WORK/idm &&@@ -260,7 +260,7 @@ test_expect_success 'a label read that fails through an idmapped mount leaves a[ ! -e "$MNT/moved" ]'-test_expect_success 'root cannot change the inode flags of a marked file' '+test_expect_success 'root cannot change the inode flags of a labelled file' '! sh -c ": >> $MNT/idmapped" 2>/dev/null &&! chattr +i "$MNT/idmapped" 2>/dev/null &&! lsattr -d "$MNT/idmapped" | awk "{print \$1}" | grep -q idiff --git a/testing/functional/tpm/t4003-register.sh b/testing/functional/tpm/t4003-register.shindex 3af081e5..73ff1f46 100644--- a/testing/functional/tpm/t4003-register.sh+++ b/testing/functional/tpm/t4003-register.sh@@ -266,7 +266,7 @@ test_expect_success 'a challenge made from the evidence activates on the target'grep -q "^ OK attestation key: the pinned key" "$WORK/challenge.out" &&grep -q "^ OK endorsement key: the pinned key" "$WORK/challenge.out" &&grep -q "^ OK endorsement key: TCG default template" "$WORK/challenge.out" &&- grep -q "^ note no endorsement certificate" "$WORK/challenge.out" &&+ grep -q "^ NOTE no endorsement certificate" "$WORK/challenge.out" &&sed -n "s/^credential: //p" "$WORK/challenge.out" >"$WORK/credential" &&[ "$(wc -c <"$WORK/credential")" = 65 ] &&./helper/test-tpm-wire public "$(py "import json; print(json.load(open(\"$WORK/evidence.json\"))[\"ek\"][\"public\"])")" |@@ -376,7 +376,7 @@ test_expect_success 'a late binding is told apart by the phase value and the ini--ak-name="$(cat "$WORK/ak")" --cert="$WORK/keys/cert.der" \--strict-anchor >"$WORK/report6" &&grep -qx "verdict: ok" "$WORK/report6" &&- grep -q "^ note binding: made in the root file system" "$WORK/report6" &&+ grep -q "^ NOTE binding: made in the root file system" "$WORK/report6" &&grep -q "^ OK eventlog: one init record for this TPM reset (2 this boot)" "$WORK/report6" &&grep -q "^ OK register: init record is of the TPM" "$WORK/report6" &&grep -q "^ OK quote and certification are of one TPM reset" "$WORK/report6" &&diff --git a/testing/functional/tpm/t4004-config-attest.sh b/testing/functional/tpm/t4004-config-attest.shindex c87ee2dd..4720fab7 100755--- a/testing/functional/tpm/t4004-config-attest.sh+++ b/testing/functional/tpm/t4004-config-attest.sh@@ -114,7 +114,7 @@ test_expect_success 'without operator approval the report names its limit explic"$S" attest verify --evidence="$WORK/b.json" --nonce="$NONCE" \--ak-name="$(field "$WORK/b.json" ak.name)" --expect-chain="$CHAIN" \>"$WORK/unapproved" &&- grep -q "^ note config root has no operator approval" "$WORK/unapproved" &&+ grep -q "^ NOTE config root has no operator approval" "$WORK/unapproved" &&grep -q "direct TPM writer protection is deferred" "$WORK/unapproved"'diff --git a/tools/shirudo-build/bpm-build.c b/tools/shirudo-build/bpm-build.cindex 6b3ed5f0..0f7d14b2 100644--- a/tools/shirudo-build/bpm-build.c+++ b/tools/shirudo-build/bpm-build.c@@ -1939,8 +1939,9 @@ static int __build_bpm_config_update(int argc, char **argv,"usage: shirudo bpm config update ""--base-package <package.bee|oci://host/repo:tag> ""--version <version> "- "[--file <name>.bee] [--rodata-input <name>=<path>]...\n"- "Without -f, the Beefile and updater inputs come from "+ "[--file <name>.bee] [--keys-dir <dir>] "+ "[--rodata-input <name>=<path>]...\n"+ "Without --file, the Beefile and updater inputs come from ""--base-package and are trusted as operator-side code.\n");return 0;} else if (!strcmp(argv[i], "--file")) {diff --git a/tools/shirudo-build/shirudo-build.c b/tools/shirudo-build/shirudo-build.cindex e08aa43f..53d8fa6c 100644--- a/tools/shirudo-build/shirudo-build.c+++ b/tools/shirudo-build/shirudo-build.c@@ -69,7 +69,7 @@ static void usage(FILE *fp)" then %s.\n""--payload-sha256: 64 hex chars; if omitted, read from the local\n"" archive /var/lib/shirudo/upatches/<name>.upatch,\n"- " else all-zero (target skips the payload check).\n"+ " which must then exist.\n""--emit-artifacts: for a .bpf.c input, also keep the compiled\n"" .bpf.o next to the .upatch (instead of a temp\n"" file that is removed). Reports every emitted\n"@@ -306,12 +306,9 @@ int main(int argc, char **argv)}} else {/*- * No explicit digest: consult the operator's local- * archive so the unload still binds payload_mismatch.- * Absent there too, fall through with the all-zero- * payload, which the target reads as "no expected- * payload" and skips the check (the documented, less- * safe escape hatch).+ * No explicit digest: take it from the operator's local+ * archive, since the target refuses a directive whose+ * digest is not the loaded payload's.*/char archive[PATH_MAX];struct upatch u;@@ -329,11 +326,9 @@ int main(int argc, char **argv)pr_info("--payload-sha256 derived from archive %s",archive);} else {- pr_warn("--payload-sha256 omitted and no archive "- "entry at %s; the directive will carry no "- "expected payload and the target will skip "- "the payload_mismatch check. Pass "- "--payload-sha256 to bind it.", archive);+ pr_err("--payload-sha256 omitted and no archive at %s; pass the digest upatch info shows",+ archive);+ return 2;}}diff --git a/util/attest.c b/util/attest.cindex 518f1ddb..7390fd75 100644--- a/util/attest.c+++ b/util/attest.c@@ -649,7 +649,7 @@ static void note(struct reporter *r, const char *fmt, ...)if (r->len + 8 >= r->cap)return;- n = strscpy(r->buf + r->len, " note ", r->cap - r->len);+ n = strscpy(r->buf + r->len, " NOTE ", r->cap - r->len);if (n > 0)r->len += (size_t)n;va_start(ap, fmt);diff --git a/util/conditions.c b/util/conditions.cindex bcab2c56..00052a15 100644--- a/util/conditions.c+++ b/util/conditions.c@@ -273,7 +273,7 @@ void status_reason(const struct conditions_input *in,} else if (strcmp(v, "lsm-off") == 0) {strscpy(buf, "LSM not attached, enforcement off", cap);} else if (strcmp(v, "init-pending") == 0) {- strscpy(buf, "target hasn't been `shirudo init`'d", cap);+ strscpy(buf, ".bpf keyring absent before init", cap);} else if (strcmp(v, "reboot-pending") == 0) {strscpy(buf, "a config activation is pending until the next reboot",cap);diff --git a/util/conditions.h b/util/conditions.hindex 0b4d327f..6ae78190 100644--- a/util/conditions.h+++ b/util/conditions.h@@ -59,8 +59,8 @@ struct condition {/** Maximum number of conditions returned today (LsmAttached,- * KeyringSealed, ChainIntact, TpmMeasured, ConfigActive); callers can- * size their stack array off this.+ * KeyringSealed, ChainIntact, UpatchesMeasured, TpmMeasured,+ * ConfigActive); callers can size their stack array off this.*/#define CONDITIONS_MAX 6diff --git a/util/eventlog.c b/util/eventlog.cindex 48ff1828..3448a872 100644--- a/util/eventlog.c+++ b/util/eventlog.c@@ -313,8 +313,10 @@ static int adopt_pending(void)* The register and the eventlog advance together only while one process* at a time extends and appends: two measuring commands under locks of* their own interleaved extend, extend, append, append and left a log- * that replays the events in the other order. Every measuring path holds- * this from its extend to its append; it lives beside the log it guards.+ * that replays the events in the other order. A load or an unload holds+ * this from before it touches the pins to its append, every other+ * measuring path from its extend to its append; it lives beside the log+ * it guards.*/int eventlog_lock(void){diff --git a/util/eventlog.h b/util/eventlog.hindex 03d016d5..764361f6 100644--- a/util/eventlog.h+++ b/util/eventlog.h@@ -38,7 +38,11 @@ int eventlog_append_to(const char *path, const char *json_line);/* 0 when nothing was pending. */int eventlog_adopt_pending(void);-/* Held from a register extend to its append; -errno when not taken. */+/*+ * Held by a load or an unload from before it touches the pins to its+ * append, by every other measuring path from the extend to the append;+ * -errno when not taken.+ */int eventlog_lock(void);void eventlog_unlock(int fd);diff --git a/util/upatch_maps.c b/util/upatch_maps.cindex d23e402e..c16646ee 100644--- a/util/upatch_maps.c+++ b/util/upatch_maps.c@@ -1429,8 +1429,9 @@ void upatch_maps_print_summary(const struct map_summary *list,{size_t i;+ printf("Pinned maps (%zu):\n", n);if (n == 0) {- printf(" (no pinned maps)\n");+ printf(" none\n");return;}printf(" %-22s %-16s %-18s %s\n", "UPATCH", "MAP", "TYPE",@@ -1462,12 +1463,12 @@ static void print_type_def(const char *label, const char *def, __u32 size){const char *p = def;- printf("%-21s", label);+ printf("%-22s ", label);while (*p) {const char *nl = strchr(p, '\n');if (nl) {- printf("%.*s\n%-21s", (int)(nl - p), p, "");+ printf("%.*s\n%-22s ", (int)(nl - p), p, "");p = nl + 1;} else {printf("%s", p);@@ -1496,40 +1497,40 @@ void upatch_maps_print_detail(const struct map_view *v){__u32 i;- printf("Name: %s\n", v->upatch);- printf("Map: %s\n", v->name);+ printf("%-22s %s\n", "Name:", v->upatch);+ printf("%-22s %s\n", "Map:", v->name);if (upatch_map_is_percpu(v->type))- printf("Type: %s (%u CPUs)\n",+ printf("%-22s %s (%u CPUs)\n", "Type:",v->type_name, v->n_cpus);else- printf("Type: %s\n", v->type_name);- printf("Max entries: %u\n", v->max_entries);+ printf("%-22s %s\n", "Type:", v->type_name);+ printf("%-22s %u\n", "Max entries:", v->max_entries);if (v->skipped) {- printf("Status: skipped: %s\n",+ printf("%-22s skipped: %s\n", "Status:",v->skipped_reason ? v->skipped_reason : "(no reason)");return;}if (v->serialized) {__u32 p;- printf("Status: serialized\n");- printf("Serialized pages: %u\n", v->n_serial_pages);- printf("Serialized bytes: %llu\n",+ printf("%-22s serialized\n", "Status:");+ printf("%-22s %u\n", "Serialized pages:", v->n_serial_pages);+ printf("%-22s %llu\n", "Serialized bytes:",v->serial_bytes_total);for (p = 0; p < v->n_serial_pages; p++) {const struct serial_page *page =&v->serial_pages[p];printf("\nPage %u:\n", page->page_index);- printf(" Cursor: %llu\n",+ printf(" %-22s %llu\n", "Cursor:",page->cursor);- printf(" Next cursor: %llu\n",+ printf(" %-22s %llu\n", "Next cursor:",page->next_cursor);- printf(" Done: %s\n",+ printf(" %-22s %s\n", "Done:",page->done ? "true" : "false");- printf(" Flags: 0x%x\n", page->flags);- printf(" Chunks: %u\n", page->chunks);- printf(" Bytes: %u\n", page->bytes);+ printf(" %-22s 0x%x\n", "Flags:", page->flags);+ printf(" %-22s %u\n", "Chunks:", page->chunks);+ printf(" %-22s %u\n", "Bytes:", page->bytes);if (page->bytes) {printf("\n Data (hex):\n");print_serialized_hex(page->data, page->bytes);@@ -1537,23 +1538,23 @@ void upatch_maps_print_detail(const struct map_view *v)}return;}- printf("Entries: %u of %u%s\n", v->n_entries,+ printf("%-22s %u of %u%s\n", "Entries:", v->n_entries,v->max_entries,v->truncated ? " (truncated; use --show-full)" : "");if (v->key_type_def[0])print_type_def("Key type:", v->key_type_def, v->key_size);else if (v->btf_key_type[0])- printf("Key type: %s (%u B)\n",+ printf("%-22s %s (%u B)\n", "Key type:",v->btf_key_type, v->key_size);else- printf("Key size: %u B (no BTF)\n", v->key_size);+ printf("%-22s %u B (no BTF)\n", "Key size:", v->key_size);if (v->value_type_def[0])print_type_def("Value type:", v->value_type_def, v->value_size);else if (v->btf_value_type[0])- printf("Value type: %s (%u B per CPU)\n",+ printf("%-22s %s (%u B per CPU)\n", "Value type:",v->btf_value_type, v->value_size);else- printf("Value size: %u B (no BTF)\n", v->value_size);+ printf("%-22s %u B (no BTF)\n", "Value size:", v->value_size);if (v->n_entries == 0)return;