Skip to content

eBPF-based security platform

upatch: declare the upatch lifecycle in util/upatch.h

Daniel Borkmanna5d464e1b000
diff --git a/builtin.h b/builtin.h
index a5e13ab9..71bf623c 100644
--- a/builtin.h
+++ b/builtin.h
@@ -26,23 +26,6 @@ int cmd_init(int argc, const char **argv);
int cmd_upatch(int argc, const char **argv);
int cmd_bpm(int argc, const char **argv);
-int shirudo_upatch_apply(const char *path);
-int shirudo_upatch_install(const char *path);
-int shirudo_upatch_remove(const char *path);
-
-/*
- * Detach, unpin and unarchive without a directive, because the key
- * that signed the upatch was revoked: 1 when the unload was measured,
- * 0 when only the archive went, -errno otherwise.
- */
-int shirudo_upatch_purge(const char *name, const char *reason);
-
-/*
- * Internal lifecycle result: the signed payload was valid, but its kprobe
- * target is unavailable because the backing module is not loaded.
- */
-#define UPATCH_INSTALL_TARGET_MISSING 2
-
/* Either-side. */
int cmd_status(int argc, const char **argv);
int cmd_attest(int argc, const char **argv);
diff --git a/util/upatch.h b/util/upatch.h
index 09f5d48f..aea2930e 100644
--- a/util/upatch.h
+++ b/util/upatch.h
@@ -141,4 +141,26 @@ int prog_specs_parse(const void *metadata, __u32 metadata_len,
__u32 nr_progs, struct shirudo_prog_spec **out);
void prog_specs_free(struct shirudo_prog_spec *specs, __u32 nr_progs);
+/*
+ * The target's upatch lifecycle, which builtin-upatch.c implements for
+ * init, bpm and keys: load, install, unload.
+ */
+int shirudo_upatch_apply(const char *path);
+int shirudo_upatch_install(const char *path);
+int shirudo_upatch_remove(const char *path);
+
+/*
+ * shirudo_upatch_install() when the signed payload is valid but its
+ * kprobe target is not there, because the module that has it is not
+ * loaded.
+ */
+#define UPATCH_INSTALL_TARGET_MISSING 2
+
+/*
+ * Detach, unpin and unarchive without a directive, because the key
+ * that signed the upatch was revoked: 1 when the unload was measured,
+ * 0 when only the archive went, -errno otherwise.
+ */
+int shirudo_upatch_purge(const char *name, const char *reason);
+
#endif /* SHIRUDO_UTIL_UPATCH_H */