Debug a failed load#
When shirudo upatch load or unload fails, its JSON report says
how far the operation got and why it stopped. This page shows how to get
the report, how to read the phase, the category and the verifier log, and
what to change for each failure.
Before you begin#
Root on the target where the load failed, and the
.upatchfileThe source and the
vmlinux.hthe upatch was built from, on the operator host
Get the report#
Load the upatch again with a report:
target# shirudo upatch load --report=- <file>.upatch
<file>is the upatch.--report=<path>writes the report to a file instead of standard output. Log lines, including the verifier log, go to standard error and to the journal. In the test VM, runshirudo-runtimeinstead ofshirudo.A failed load is undone: shirudo removes whatever it pinned, and a load that the measurement register did not record is taken back out. You can load again after every change.
Read three fields of the report:
phase, the step that failed,category, the kind of failure, anderrno_name, the error the kernel or shirudo returned.messageadds a short description. Failure categories and exit status defines every category and the exit status of each command.For a upatch that a package or the tree delivered, the same failure is in the journal:
target# journalctl -t shirudo -p err
Find the cause#
Look up the phase and the category. A load goes through the phases in this order and stops at the first failure.
Phase
Category
Cause and what to do
pre_flight version_mismatch --expect-names another shirudo build than the target runs. Build with the target’s version, or drop the option.version- id pre_flight kernel_abi_ unsupported The kernel’s BTF lacks the signed-loader fields shirudo needs.
messagenames the field. Boot a kernel that meets System requirements.pre_flight keyring_missing shirudo inithas not frozen a trust anchor this boot. The target is not initialized.pre_flight tamperedThe
.bpfkeyring is not the oneinitfroze, shirudo’s LSM link is not pinned, or the register is not the--expect-value. Do not retry. Follow Respond to a tampered target.chain pre_flight eventlog_full The eventlog would grow past
eventlog.. Nothing was loaded. The operator has to make room.max_ bytes parseparser_rejected The file is not a valid upatch, is an unload directive, has a name that is not signed or not allowed, a payload digest that does not match its content, or attach metadata that is missing or invalid. Rebuild it with
shirudo buildand check that you passed the right file.pinalready_loaded A upatch of that name is loaded. Unload it with its signed directive first; nothing was touched.
target_verify attach_,target_ missing binary_,mismatch parser_,rejected lsm_denied The binary of a
uprobe,uretprobe,uprobe.ormulti uretprobe.upatch is missing, differs from the one the upatch was built against, is shorter than a recorded offset, or could not be read. Rebuild against the binary the target runs.multi signed_loader_ load signature_rejected The signature does not verify against the
.bpfkeyring: the upatch was signed with a key the target did not enroll, or it changed after signing. Compareshirudo keyson the target with your certificate.signed_loader_ load keyring_missing The keyring holds no key for the signer.
signed_loader_ load signature_unsupported The kernel cannot verify ML-DSA signatures, because it lacks
CONFIG_.CRYPTO_ MLDSA signed_loader_ load lsm_denied The LSM refused a BPF command, usually because the command did not run as shirudo’s runtime binary.
signed_loader_ load verifier_rejected The verifier refused the loader itself. Read the verifier log.
payload_load verifier_rejected The loader ran and failed: the verifier refused a payload program, a CO-RE relocation found no match, a BTF attach target does not exist, or a map could not be created. Read the verifier log and
loader_.return link_create attach_target_ missing A
kprobesymbol that kallsyms does not list, often in a module that is not loaded, a kernel without the kprobe PMU, or a missing/sys/. The command exits with 2.fs/ cgroup link_create attach_scope_ mismatch The kernel attached somewhere else than the metadata names, because the command ran in another cgroup or network namespace or with a changed sysfs. Load from the host’s initial namespaces.
link_create kernel_,abi_ unsupported lsm_,denied binary_mismatch The kernel does not support the attachment, the LSM refused it, or the uprobe binary changed.
link_create unknownAny other error.
EEXIST: a upatch of the same name is loaded. Unload it first.EINVAL: the kernel refused the attachment, such asbpf_outside an error-injection function.override_ return() EADDRNOTAVAIL: kallsyms lists thekprobesymbol more than once.persistunknownThe archive copy could not be written. The load was undone.
tpm_extend tamperedThe register refused the extend because it is not the one
initbound. The load was undone. Treat it as an incident.tpm_extend tpm_error The TPM or the eventlog failed. When the extend itself failed, the load was undone.
An unload reports these besides the shared ones:
Phase
Category
Cause and what to do
parseparser_rejected The file is a load directive, or its target name is not signed.
pinpayload_mismatch The loaded upatch has another payload digest than the directive expects, or its recorded digest cannot be read. Build the directive with
--payload-set to the digest of the loaded build, fromsha256 shirudo upatch info --json.donealready_unloaded Nothing of that name is loaded. Exit status 0, nothing measured.
pindetach_failed The unload was measured, but the pins could not be removed. Apply the directive again.
Read the verifier log#
For
verifier_rejected, read the report’sverifier_log, which keeps up to 16 MiB of the kernel’s log. In phasesigned_loader_loadit is the log of the loader’s own load. In phasepayload_loadit is the log of the last load the loader made, since the loader passes the same buffer to each map, BTF and program load, so its end is about the step that failed. The log on standard error is cut at 4096 bytes when the loader returned an error. The report has all of it.loader_returnis the loader’s negative error.Match the last lines of the log:
Log
Cause and what to do
invalid func unknown#195896080A CO-RE relocation found no matching type or field in the target’s BTF, and the kernel replaced the instruction. Build against the target kernel’s
vmlinux., or test for the field withh bpf_and skip the access.core_ field_ exists() <function>() is not modifiablefmod_on a function the kernel does not admit. Attach elsewhere. Attach kinds lists the rules.ret <function> is not sleepableA
.ssection on a function or hook that cannot sleep. Use the section without.s.LSM programs must have a GPL compatible license,cannot call GPL-restricted function from non- GPL compatible program Declare
char _license[] SEC("license") = "Dual BSD/.GPL"; no log,
errno_name ENOENT,loader_-2return The loader did not find the
fentry,fexit,fmod_,ret lsmortp_target in the kernel’s BTF. The function does not exist on this kernel, has another name, or is inlined. Choose another attach point, or limit the upatch to kernels that have it.btf any other verifier message
The verifier’s own diagnosis of the program. Fix the source. The kernel’s BPF documentation explains the messages.
Fix and load again#
Change the source or the build, rebuild and sign, and load the new file. A rebuilt upatch has a new payload digest, so build its unload directive again too.
Confirm the result with the report’s category
okand with:target# shirudo upatch get <name>
<name>is the upatch name. Use shirudo’s own commands to look at a loaded upatch: the LSM refuses every other tool a descriptor of shirudo’s maps and links, by pin or by id, and counts each attempt asObjGet.
Next steps#
shirudo upatch load for the report’s fields
CO-RE and BTF for how relocations resolve
Test a upatch on a target for the test VM