Skip to content

eBPF-based security platform

upatch: report only a missing or wrong XDP program pin as tampered

John Fastabende7379e797f5f
diff --git a/Documentation/reference/failure-categories.rst b/Documentation/reference/failure-categories.rst
index 9273d9aa..07067aad 100644
--- a/Documentation/reference/failure-categories.rst
+++ b/Documentation/reference/failure-categories.rst
@@ -245,13 +245,16 @@ Categories
- Check ``shirudo status``. A register ahead of the eventlog shows as
``tampered``; handle that as an incident.
* - ``unknown``
- - ``parse``, ``target_verify``, ``signed_loader_load``,
- ``payload_load``, ``link_create``, ``persist``
+ - ``pre_flight``, ``parse``, ``target_verify``,
+ ``signed_loader_load``, ``payload_load``, ``link_create``,
+ ``persist``
- 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).
+ both). From ``upatch reconcile``, an XDP program pin that cannot
+ be opened for a reason that says nothing about the pin, such as
+ ``EMFILE`` or ``ENOMEM``.
- Read ``message`` and the journal. For ``persist``, check the space
on the file system that holds ``/var/lib/shirudo``.
diff --git a/builtin-upatch.c b/builtin-upatch.c
index 146afaae..e84e6e19 100644
--- a/builtin-upatch.c
+++ b/builtin-upatch.c
@@ -4399,9 +4399,13 @@ static int reconcile_prog_failed(const char *name, int err,
if (err == -EACCES || err == -EPERM)
rep_fail(rep, "pre_flight", "lsm_denied", err,
"the guards refused the XDP program pin");
- else
+ /* Only these say what the pin is; EMFILE or ENOMEM say nothing. */
+ else if (err == -ENOENT || err == -ESTALE)
rep_fail(rep, "pre_flight", "tampered", err,
"an XDP program pin is missing or not XDP");
+ else
+ rep_fail(rep, "pre_flight", "unknown", err,
+ "cannot open an XDP program pin");
return 1;
}