Integrity counters#
The tamper counters count attempts on shirudo’s own state. The
integrity counters count attempts on the running kernel: each way root
has to change or read it that bpf2 refuses, what lockdown in
integrity mode refuses, /proc/kcore and the resume location, has a
counter, and the guard adds one to it when it refuses. The counters
live in the array map shirudo_integrity, which init creates,
freezes and pins at /run/shirudo/bpffs/integrity at every boot, so
they count this boot’s refusals. No task resets them from userspace;
only the hooks add to them. Threat T6 of the Threat model says
what the guards keep, and T10 why they count.
Counters#
The name and the meaning are what shirudo status prints. Each
counter but HibernateLocation is a lockdown reason the kernel asks
lsm/locked_down about, refused with EPERM to every caller,
shirudo’s own tasks included.
Counter |
Meaning |
Reason and condition |
|---|---|---|
|
module load without a valid signature |
|
|
|
|
|
EFI runtime services through |
|
|
kexec of a kernel without a valid signature |
|
|
PCI configuration write or BAR mapping |
|
|
raw I/O port access |
|
|
model-specific register write |
|
|
ACPI table override or custom method |
|
|
device tree overlay |
|
|
PCMCIA CIS override |
|
|
serial port I/O or IRQ reconfiguration |
|
|
module parameter that sets hardware addresses |
|
|
MMIO tracing |
|
|
debugfs file that writes or maps |
|
|
xmon write access |
|
|
BPF program that writes user memory |
|
|
kernel debugger write |
|
|
RTAS error injection |
|
|
Xen user action that writes memory |
|
|
|
|
|
EFI variable naming a resume device |
|
|
lockdown reason this build does not name |
A reason of integrity mode that a later kernel adds |
The hibernation check, LOCKDOWN_HIBERNATION, is refused without a
count: every read of /sys/power/state makes it.
Reading the counters#
shirudo status, started from the runtime image as for the tamper
counters, prints the section Integrity attempts (this boot): after
Tamper attempts (this boot):, with one line per counter that is not
zero: its name, its count and its meaning. It prints none when
every counter is zero, 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
integrity_attempts, with the sum in total and each counter by
name in counters, null before init has pinned the map.
The keepalive, shirudo status --otel, carries every counter in the
integrity list of its body, after tamper, zeros included and in
the order of this page, and the TPM quotes the body. The list is
null, and bit 6 of the body’s flags set, when the counters
cannot be read.
What a non-zero counter means#
A counter that moved means that bpf2 refused a change or a read of
the running kernel this boot: the operation did not happen. It does not
mean that the kernel is compromised, nor that root made the attempt:
honest tools move some counters. Debugfs moves when a tool opens a
writable debugfs file to read it, Tiocsserial when setserial
reconfigures a port, and ModuleSignature on modprobe --force,
which makes a signed module count as unsigned.
A counter does not change the verdict of shirudo status, as a tamper
counter does not. To act on one, see
Respond to a tampered target.