Failure categories and exit status#
shirudo upatch load, unload and reconcile classify every
refusal by a phase and a category. Both appear in the operation report
(--report) and in the upatch unload failed: journal line. Other
commands report failures as messages and exit status only.
Phases#
The table lists the phases in the order a load first reaches them. A
load runs the --expect-version-id check of pre_flight, reads the
artifact and checks its header in parse, runs the other
pre_flight checks, refuses a name that is loaded in pin, checks
the rest of the artifact in parse, and then goes from
target_verify to done. An unload passes parse and
pre_flight, verifies the directive’s signature in
signed_loader_load, compares the payload in pin, measures in
tpm_extend and removes the pins in pin.
Phase |
What runs |
|---|---|
|
The |
|
Reading and staging the artifact, the header checks, the upatch
name, the signed name, |
|
Load: refusing a name that is loaded. Unload: comparing the payload recorded on the pin directory, or the archive of a Java upatch, with the directive’s, and removing the pins or the jar. |
|
Opening each |
|
Creating, filling and freezing |
|
A Java upatch only, in place of |
|
A Java load only, in place of |
|
|
|
Attaching each program, checking the link against the attach metadata, pinning it in the private bpffs and recording the payload on the pin directory. |
|
Load only: copying the artifact to
|
|
Extending the measurement register and appending the eventlog record. |
|
The operation completed. |
Categories#
Category |
Phases |
Meaning and errno |
Action |
|---|---|---|---|
|
|
|
Compare |
|
|
|
Run a kernel that meets System requirements. |
|
|
|
Check |
|
|
|
Do not retry. Keep the eventlog and the journal and handle the target as an incident: Respond to a tampered target. |
|
|
No errno. |
Wait for |
|
|
|
Raise |
|
|
|
Rebuild the artifact with |
|
|
|
Load the module or install the binary, then load again. |
|
|
|
Narrow the signed device-class mask, or configure or change the device so that it reports multi-buffer XDP. See Attach kinds. |
|
|
|
Change the setting that rules XDP out, which |
|
|
|
Unload the upatch that holds the device, detach the other program, or narrow the signed device-class mask. See Attach kinds. |
|
|
|
Rebuild the upatch against the installed binary. |
|
|
|
Fetch or rebuild the artifact. Check that the file was not modified after signing. |
|
|
|
Build the kernel with |
|
|
|
Check the tamper counters in |
|
|
The errno of the call, or the loader’s return value. The verifier
rejected the loader, |
Read |
|
|
An XDP mismatch also fails boot restore, and stops an
|
Run the load in the host’s initial cgroup and network namespaces and with the host’s sysfs. |
|
|
|
Unload it with its signed directive first. |
|
|
Nothing was detached or removed. |
Compare the |
|
|
The errno of the removal. The unload was measured, then removing the pins failed. |
Repeat the unload. Each attempt records another unload event. |
|
|
The errno of the call. The register lock could not be taken, or this
boot’s records could not be read or what they do not cover could not
be undone, in which case nothing was loaded or detached, or the TPM
or the extend failed. A failed extend undoes a load and detaches
nothing for an unload, though a lost answer can leave the register
moved, and the message then reads |
Check |
|
|
The errno of the call. Any other failure: out of memory, a failed
hash of the loader, an unclassified attach error, a payload that
cannot be recorded on the pin directory or a failed archive copy
(the load is undone for both). In |
Read |
A successful operation reports the category ok. An unload of a
upatch that has no pins reports already_unloaded, exits 0 and
records no event, after removing an archive of the directive’s payload.
Refusals before a command runs#
On an enforcing target every command except init, genkey,
build, help, version, image build and image verify
passes a gate first. A refusal prints shirudo: image state:
<strerror> and exits 1.
Message |
Cause |
|---|---|
|
An argument starts with |
|
The binary is not the runtime binary, so the LSM refuses it access to the frozen record. |
|
A config activation is pending. Only |
|
The config activation record or the mounted config cannot be
verified. Only |
|
A frozen record exists but enforcement is not active. |
Exit status#
Monitoring must not rely on exit status: shirudo status exits 0 for
every verdict, tampered included. Parse .status of
shirudo status --json instead, see status JSON.
Command |
Exit status |
|---|---|
|
1, after the help text. |
|
|
Unknown or ambiguous command |
|
Any command |
1 when the hardening fails ( |
|
0; 1 on failure or when keys exist without |
|
The exit status of |
|
0; 1 on any failure, the pre-flight included; 2 for an unknown
option or for |
|
0 for every verdict; 1 when memory runs out, the configuration
cannot be loaded for |
|
|
|
0; 1 on refusal or failure; 2 for a usage error and for
|
|
0, |
|
0 when the pass finishes, whatever each device’s outcome; 1 when it stops; 2 for a usage error. |
|
0; 1 on failure; 2 for a usage error. |
|
0; 1 when the upatch is not found or cannot be read; 2 for a usage error or an invalid name. |
|
0; 1 on a read or export failure; 2 for a usage error or an invalid
|
|
|
|
0, an already installed package included; 1 on failure; 2 for a usage error. |
|
0, also when no tree is configured; 1 on failure and for an
unknown option; 2 for too many arguments or a |
|
0; 1 on failure and for a usage error; 127 when the helper is missing. |
|
0; 1 on failure; 2 for a usage error; 127 when the helper is missing. |
|
|
|
0; 1 on failure; 2 for a usage error. |
|
0 when the activation is consistent and not pending; 1 when it is pending or inconsistent (after the JSON) or no record exists. |
|
0; 1 when no TPM answers, the register is not bound, the challenge is refused or the output cannot be written; 2 for a usage error or an unreadable challenge. |
|
0 for |
|
0; 1 when the write policy cannot be computed; 2 for a usage error or invalid input. |
|
0; 1 for |
|
0; 1 when no key material or no |
|
0; 1 on failure, and always on a target with a config image; 2 for a usage error. |
|
|
|
0; 1 when the configuration cannot be loaded or |
|
Operation report#
--report=<path> writes one JSON object after the operation, also
after a refusal. --report=- writes it to standard output. A usage
error writes no report. shirudo creates the file with mode 0644 and
refuses a sealed file, a path under a sealed directory and a symbolic
link.
Field |
Type |
Value |
|---|---|---|
|
integer |
|
|
string |
|
|
string |
|
|
string |
The phase that failed, or |
|
integer or null |
The positive errno, null when there is none. |
|
string or null |
The errno’s symbolic name, such as |
|
string |
One of the categories above, |
|
string |
A short description, at most 255 bytes. Empty on success. |
|
string |
The kernel’s log from |
|
integer |
The loader’s return value from |
|
string |
The path given on the command line, with U+FFFD for each byte that is no UTF-8. |
|
string |
The upatch name from the header, as the file has it and with U+FFFD for each byte that is no UTF-8: a name the load refuses is reported too. Empty when the operation stopped before the artifact was read. |
|
string |
For a load, the artifact’s payload digest. For an unload, the payload the directive expects. Empty when the operation stopped before the artifact was read. |
|
string |
The running kernel’s release, from |
|
object or null |
Present on success when the register moved, else null. |
|
string |
The register’s NV index, |
|
string |
The register value after the extend, 64 hex characters. |
A successful load:
{"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-bundle/fixtures/shirudo-test-basic.upatch",
"name":"shirudo-test-basic",
"payload_sha256":"8aee7072a1a15e4dddc93ad6b253a0e2e70ad6cdf767442aa8a1c1997bc3069f"},
"kernel":{"release":"7.3.0-bpf-next+"},
"tpm":{"nv_index":"0x01818E00",
"chain_after":"c50b22ac27c5bb6a90ee5ff9b440fbbd5bb60b84a2aa7b395daec3f330886fcd"}}
A load refused because the register differs from --expect-chain. The
journal line names the cause, chain_drift:
{"schema":1,"result":"failed","op":"upatch_load","phase":"pre_flight",
"errno":1,"errno_name":"EPERM","category":"tampered",
"message":"pre-flight check failed","verifier_log":"","loader_return":0,
"upatch":{"path":"/mnt/shirudo-bundle/fixtures/shirudo-test-lifecycle.upatch",
"name":"shirudo-test-lifecycle",
"payload_sha256":"2324dff6596d09695c57b45a234627a9e3efbd60c9a2818c5914e6c9e52f17b0"},
"kernel":{"release":"7.3.0-bpf-next+"},"tpm":null}
A load refused by --expect-version-id, before the artifact was read:
{"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)",
"verifier_log":"","loader_return":0,
"upatch":{"path":"/mnt/shirudo-bundle/fixtures/shirudo-test-lifecycle.upatch",
"name":"","payload_sha256":""},
"kernel":{"release":"7.3.0-bpf-next+"},"tpm":null}
A load of an artifact signed by a key the target does not trust:
{"schema":1,"result":"failed","op":"upatch_load",
"phase":"signed_loader_load","errno":126,"errno_name":"ENOKEY",
"category":"keyring_missing",
"message":"BPF_PROG_LOAD of signed loader failed",
"verifier_log":"signature verification failed: -126\n","loader_return":0,
"upatch":{"path":"/mnt/shirudo-bundle/fixtures/shirudo-test-foreign.upatch",
"name":"shirudo-test-foreign",
"payload_sha256":"d3e0d0a546f9aacc9e5828d479793dc4e848c4e835c8ac2bd55b2584374bc913"},
"kernel":{"release":"7.3.0-bpf-next+"},"tpm":null}
An unload directive that expects another payload than the loaded one:
{"schema":1,"result":"failed","op":"upatch_unload","phase":"pin",
"errno":1,"errno_name":"EPERM","category":"payload_mismatch",
"message":"loaded payload does not match directive","verifier_log":"",
"loader_return":0,
"upatch":{"path":"/mnt/shirudo-bundle/fixtures/shirudo-test-basic-mismatch.unload.upatch",
"name":"shirudo-test-basic",
"payload_sha256":"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"},
"kernel":{"release":"7.3.0-bpf-next+"},"tpm":null}
shirudo prints each report on one line. The examples are wrapped.
Tree sync report#
shirudo bpm tree sync writes its own report to standard output, or
to --report=<path> with mode 0600.
Field |
Type |
Value |
|---|---|---|
|
integer |
|
|
boolean |
Whether |
|
integer |
Operations whose selector matches this target. |
|
integer |
Operations whose selector does not match. |
|
integer |
Operations applied and measured in this run. |
|
integer |
|
|
boolean |
Whether the register is bound this boot. |
|
integer |
The last operation sequence number this target has processed. |
|
string or null |
The tree’s projection root, null without a bound register. |
A failed sync logs bpm tree sync: phase=<phase> seq=<seq> id=<id>
rc=<rc> (<strerror>) and exits 1:
Phase |
Failure |
|---|---|
|
An operation of the publication is malformed or its digest does not match. |
|
The |
|
The segment the tag names starts further past the node’s last
applied |
|
A sealed segment of the walk cannot be fetched, |
|
A sealed segment is not the one its successor names: another
digest, tree, head or a generation that is not lower, or it does
not follow the node’s state ( |
|
The segment’s |
|
The publication’s operations up to the node’s last applied
|
|
An interrupted operation above the cursor is not one the
publication holds ( |
|
The selector cannot be evaluated: the node labels or the kernel config cannot be read. The cursor stays on the operation. |
|
The operation digest is malformed. |
|
|
|
The artifact cannot be fetched or does not match its digests. |
|
The load or unload failed. |
|
The recorded projection root is malformed. |
|
The next projection root cannot be computed. The register is not extended. |
|
The register extend failed. |
|
The tree eventlog record cannot be appended. |
|
The operation’s |
|
|
|
The per-operation status file cannot be written. |