Skip to content

eBPF-based security platform

docs: describe the runs the kernel skipped in status and upatch get

Jiri Olsac8509c787487
diff --git a/.agents/skills/bpf-concurrency/SKILL.md b/.agents/skills/bpf-concurrency/SKILL.md
index 788ff6d7..219d75fb 100644
--- a/.agents/skills/bpf-concurrency/SKILL.md
+++ b/.agents/skills/bpf-concurrency/SKILL.md
@@ -57,7 +57,10 @@ The kernel skips `kprobe` and `kretprobe` runs while another runs on the
CPU or the CPU is in a `bpf()` map call, nested `fentry`, `fexit`,
`fmod_ret` and `tp_btf` runs, `kretprobe` returns beyond its
instances and `uretprobe` and `uretprobe.multi` returns beyond the
-task's 64, so a detector can miss what it looks for. Refuse an
+task's 64, so a detector can miss what it looks for; on a target,
+`shirudo status` (`MISSED`, `missed_runs`) and `shirudo upatch get`
+show the skips the kernel counts, and `-` or `null` for the uprobe
+kinds, whose skips it does not count. Refuse an
operation in an `lsm` program, never in `fmod_ret`: a skipped
`fmod_ret` run lets the call through, and a task can arrange the skip.
An `lsm` program does not see what an LSM before it refused, and its
diff --git a/Documentation/operate/deploy/boot-integration.rst b/Documentation/operate/deploy/boot-integration.rst
index 09132e2d..5e1a69b5 100644
--- a/Documentation/operate/deploy/boot-integration.rst
+++ b/Documentation/operate/deploy/boot-integration.rst
@@ -519,8 +519,8 @@ Boot and verify
none
Loaded upatches (1):
- NAME LOCATION MAPS STATUS AGE
- shirudo-test-basic fentry/do_nanosleep 0 success 1s
+ NAME LOCATION MAPS MISSED STATUS AGE
+ shirudo-test-basic fentry/do_nanosleep 0 0 success 1s
Folded: keyrings, TPM measurement, assets (--show-full)
diff --git a/Documentation/operate/deploy/initialize.rst b/Documentation/operate/deploy/initialize.rst
index 5e78363e..c74770dd 100644
--- a/Documentation/operate/deploy/initialize.rst
+++ b/Documentation/operate/deploy/initialize.rst
@@ -102,8 +102,8 @@ Check that init worked
none
Loaded upatches (1):
- NAME LOCATION MAPS STATUS AGE
- shirudo-test-basic fentry/do_nanosleep 0 success 1s
+ NAME LOCATION MAPS MISSED STATUS AGE
+ shirudo-test-basic fentry/do_nanosleep 0 0 success 1s
Folded: keyrings, TPM measurement, assets (--show-full)
diff --git a/Documentation/operate/run/read-status.rst b/Documentation/operate/run/read-status.rst
index f0e6982b..c95f580c 100644
--- a/Documentation/operate/run/read-status.rst
+++ b/Documentation/operate/run/read-status.rst
@@ -62,8 +62,8 @@ Print the report
none
Loaded upatches (1):
- NAME LOCATION MAPS STATUS AGE
- shirudo-test-basic fentry/do_nanosleep 0 success 1s
+ NAME LOCATION MAPS MISSED STATUS AGE
+ shirudo-test-basic fentry/do_nanosleep 0 0 success 1s
Folded: keyrings, TPM measurement, assets (--show-full)
@@ -117,8 +117,8 @@ line; a section unfolds on its own when its condition is not ``OK``.
none
Loaded upatches (1):
- NAME LOCATION MAPS STATUS AGE
- shirudo-test-basic fentry/do_nanosleep 0 success 1s
+ NAME LOCATION MAPS MISSED STATUS AGE
+ shirudo-test-basic fentry/do_nanosleep 0 0 success 1s
Keyring (.bpf):
Serial: 272801410
@@ -421,9 +421,15 @@ Loaded upatches
~~~~~~~~~~~~~~~
One row per upatch pinned in the private bpffs: its name, the attach
-location resolved from kernel BTF, its number of maps, ``success`` and
-the time since it was loaded. A loaded Java agent follows them with the
-location ``java`` and no maps. ``Loaded upatches (0):`` followed by
+location resolved from kernel BTF, its number of maps, the runs of its
+programs the kernel skipped, ``success`` and the time since it was
+loaded. ``MISSED`` is ``-`` for an upatch of no attach kind the kernel
+counts skipped runs of, such as ``lsm``, ``xdp`` or a uprobe, and ``?``
+when they cannot be read. A count that grows means the upatch misses
+events it is meant to see; :ref:`runs-the-kernel-skips` says when that
+happens, and ``shirudo upatch get`` splits the count by program. A
+loaded Java agent follows them with the location ``java``, no maps and
+``-`` for ``MISSED``. ``Loaded upatches (0):`` followed by
``none`` means nothing is loaded.
TPM measurement
diff --git a/Documentation/reference/cli/status.rst b/Documentation/reference/cli/status.rst
index b1900a0f..5ad1092d 100644
--- a/Documentation/reference/cli/status.rst
+++ b/Documentation/reference/cli/status.rst
@@ -223,8 +223,8 @@ Show the state of a target:
none
Loaded upatches (1):
- NAME LOCATION MAPS STATUS AGE
- shirudo-test-basic fentry/do_nanosleep 0 success 1s
+ NAME LOCATION MAPS MISSED STATUS AGE
+ shirudo-test-basic fentry/do_nanosleep 0 0 success 1s
Folded: keyrings, TPM measurement, assets (--show-full)
@@ -261,8 +261,8 @@ system as well:
none
Loaded upatches (1):
- NAME LOCATION MAPS STATUS AGE
- shirudo-test-basic fentry/do_nanosleep 0 success 1s
+ NAME LOCATION MAPS MISSED STATUS AGE
+ shirudo-test-basic fentry/do_nanosleep 0 0 success 1s
Keyring (.bpf):
Serial: 272801410
diff --git a/Documentation/reference/cli/upatch-get.rst b/Documentation/reference/cli/upatch-get.rst
index 6abcff6c..95f4a436 100644
--- a/Documentation/reference/cli/upatch-get.rst
+++ b/Documentation/reference/cli/upatch-get.rst
@@ -30,6 +30,12 @@ Description
``fentry/do_nanosleep``.
- the program ID, the load time and the payload digest recorded on the
pin.
+- ``Missed runs``: the runs of its programs the kernel skipped since the
+ load, summed over every link of a kind that counts them, with one line
+ per program when more than one does. ``not counted for this attach
+ kind`` for an upatch of none of them, ``unavailable`` when a link or
+ program cannot be read. :ref:`runs-the-kernel-skips` says which kinds
+ count and what.
- the source lines from the program's BTF line info, which the signed
loader installed. They are exact but cover only the lines the compiler
kept.
@@ -55,7 +61,10 @@ Options
- off
- Print one JSON object: ``schema`` and ``upatch`` with ``name``,
``location``, ``prog_id``, ``loaded_at``, ``age``,
- ``payload_sha256``, ``source`` and ``maps``.
+ ``payload_sha256``, ``missed_runs`` (the total, or ``null`` when
+ no program counts them or they cannot be read), ``programs`` (one
+ object per counted program, with its ``location`` and
+ ``missed_runs``), ``source`` and ``maps``.
* - ``--show-full``
- none
- off
@@ -94,6 +103,7 @@ Describe a loaded upatch:
Program ID: 72
Loaded at: 2026-11-03T14:54:33Z (1s ago)
Payload sha256: 8aee7072a1a15e4dddc93ad6b253a0e2e70ad6cdf767442aa8a1c1997bc3069f (signature-bound)
+ Missed runs: 0
Maps: none
Source (kernel BTF line_info):
diff --git a/Documentation/reference/formats/status-json.rst b/Documentation/reference/formats/status-json.rst
index 230f3001..d230d168 100644
--- a/Documentation/reference/formats/status-json.rst
+++ b/Documentation/reference/formats/status-json.rst
@@ -481,6 +481,11 @@ upatches_loaded
* - ``n_maps``
- integer
- Maps pinned for the upatch.
+ * - ``missed_runs``
+ - integer or ``null``
+ - Runs of the upatch's programs the kernel skipped since the load,
+ a lower bound. ``null`` for an upatch of no attach kind that
+ counts them, or when they cannot be read.
* - ``loaded_at``
- string
- Change time of the upatch's pin directory, or of a Java agent's
@@ -917,6 +922,7 @@ indented here:
"location": "fentry/do_nanosleep",
"status": "success",
"n_maps": 0,
+ "missed_runs": 0,
"loaded_at": "2026-11-03T14:54:33Z",
"age_sec": 1,
"payload_sha256": "8aee7072a1a15e4dddc93ad6b253a0e2e70ad6cdf767442aa8a1c1997bc3069f"
diff --git a/Documentation/start/quickstart.rst b/Documentation/start/quickstart.rst
index 16c461c2..2b77d285 100644
--- a/Documentation/start/quickstart.rst
+++ b/Documentation/start/quickstart.rst
@@ -397,8 +397,8 @@ Load it
target# shirudo status --show-full
...
Loaded upatches (1):
- NAME LOCATION MAPS STATUS AGE
- basic fentry/do_nanosleep 0 success 1s
+ NAME LOCATION MAPS MISSED STATUS AGE
+ basic fentry/do_nanosleep 0 0 success 1s
...
TPM measurement:
...
diff --git a/Documentation/upatches/write/pitfalls.rst b/Documentation/upatches/write/pitfalls.rst
index 8113867a..974c12c8 100644
--- a/Documentation/upatches/write/pitfalls.rst
+++ b/Documentation/upatches/write/pitfalls.rst
@@ -15,18 +15,22 @@ shows any of it. This page lists what the kernel does that a upatch has
to plan for, for the attach kinds ``shirudo build`` accepts.
:doc:`memory-consistency/hazards` covers the runs that interleave.
+.. _runs-the-kernel-skips:
+
Runs the kernel skips
---------------------
-The kernel skips some runs of a program and counts them only in the
-program's ``recursion_misses``, which ``struct bpf_prog_info`` reports:
+The kernel skips some runs of a program. It counts most in the program's
+``recursion_misses``, which ``struct bpf_prog_info`` reports, and some in
+the link, which ``struct bpf_link_info`` reports:
- A ``kprobe``, ``kretprobe``, ``kprobe.multi`` or ``kretprobe.multi``
run, while another program of these four kinds runs on the CPU, and
while the CPU is in a ``bpf()`` call that looks up, updates or deletes
a map element from userspace, as shirudo makes when it reads a
upatch's maps. A ``kprobe`` hit inside the handler of another
- ``kprobe`` is missed by the kprobe itself.
+ ``kprobe`` is missed by the kprobe itself, and counted in the link's
+ ``perf_event.kprobe.missed``.
- A ``kprobe.multi`` or ``kretprobe.multi`` hit while ftrace already
traces a function in the same context on the CPU, such as a watched
function the program calls itself, and the return of a function a
@@ -39,7 +43,8 @@ program's ``recursion_misses``, which ``struct bpf_prog_info`` reports:
with preemptible RCU, or one an NMI interrupted.
- The return of a function a ``kretprobe`` watches, when more calls of
it are in flight than the probe has instances for: the larger of 10
- and twice the number of CPUs.
+ and twice the number of CPUs. The link's ``perf_event.kprobe.missed``
+ counts it.
- The return of a function a ``uretprobe``, a ``uretprobe.multi`` or
their ``.s`` forms watch, when the task already waits on the returns of
64 calls that return probes watch, and the return of a function that
@@ -47,8 +52,15 @@ program's ``recursion_misses``, which ``struct bpf_prog_info`` reports:
case, rate-limited, and counts neither.
A detector built on these kinds can therefore miss the event it looks
-for, and a count it keeps is a lower bound. ``lsm`` and ``xdp`` programs
-are never skipped.
+for, and a count it keeps is a lower bound. ``lsm``, ``xdp``,
+``cgroup_skb`` and ``netfilter`` programs are never skipped.
+
+``shirudo status`` shows, in its ``MISSED`` column and ``missed_runs``,
+the sum of what the kernel counts for each upatch: every program's
+``recursion_misses`` and every kprobe link's own counter, and ``shirudo
+upatch get`` shows it per program. For a uprobe kind it shows ``-`` and
+``null``, as the kernel counts none of the runs it skips, and the sum
+leaves out what the kernel does not count for the others either.
Enforce in lsm programs
-----------------------