Skip to content

eBPF-based security platform

treewide: open block comments on a line of their own

Daniel Borkmann04cd9f2d35c4
diff --git a/builtin-bpm.c b/builtin-bpm.c
index 517899d0..98248c33 100644
--- a/builtin-bpm.c
+++ b/builtin-bpm.c
@@ -721,8 +721,10 @@ static int load_cached_index(const char *source, struct bpm_index_entry *entries
return rc;
}
-/* Strict enough for repository selection: numeric dotted core, optional
- * prerelease, and build metadata. Build metadata does not affect order. */
+/*
+ * Strict enough for repository selection: numeric dotted core, optional
+ * prerelease, and build metadata. Build metadata does not affect order.
+ */
static int semver_compare(const char *a, const char *b)
{
const char *pa = a, *pb = b;
@@ -818,8 +820,10 @@ static int package_install(const struct bpm_source *s, const struct bpm_index_en
if ((rc = bpm_oci_parse_endpoint(s->endpoint, &c))) return rc;
if ((rc = bpm_oci_url(&c, entry->repository[0] ? entry->repository : entry->name, "manifests", entry->manifest_digest, url, sizeof(url)))) return rc;
if ((rc = bpm_oci_get_memory(&c, url, "application/vnd.oci.image.manifest.v1+json", &manifest))) goto out;
- /* Repository indexes carry a sha256 manifest digest; direct OCI
- * references carry the tag in this field and cannot be digest-checked. */
+ /*
+ * Repository indexes carry a sha256 manifest digest; direct OCI
+ * references carry the tag in this field and cannot be digest-checked.
+ */
if (!strncmp(entry->manifest_digest, "sha256:", 7)) {
char manifest_hex[65];
if (bpm_sha256_hex(manifest.data, manifest.len, manifest_hex, sizeof(manifest_hex)) ||
@@ -1365,8 +1369,10 @@ static int tree_measure_operation(const struct shirudo_tree_operation *op,
return shirudo_eventlog_append(line);
}
-/* Complete the only non-idempotent window: the process may have
- * appended the event before the sealed cursor was committed. */
+/*
+ * Complete the only non-idempotent window: the process may have
+ * appended the event before the sealed cursor was committed.
+ */
static int tree_recover_pending(const struct shirudo_tree_publication *pub,
struct shirudo_tree_state *state)
{
@@ -2065,8 +2071,11 @@ int cmd_bpm(int argc, const char **argv)
bpm_tree_usage();
return 0;
}
- /* The tree is optional. Avoid taking the BPM lock (and avoid
- * requiring writable state directories) when it is not configured. */
+ /*
+ * The tree is optional. Avoid taking the BPM lock (and
+ * avoid requiring writable state directories) when it is
+ * not configured.
+ */
if (access(SHIRUDO_BPM_TREE_ETC_PATH, F_OK) != 0 && errno == ENOENT)
return 0;
if (curl_global_init(CURL_GLOBAL_DEFAULT) != CURLE_OK)
@@ -2105,9 +2114,12 @@ int cmd_bpm(int argc, const char **argv)
return bpm_finish(lock, rc, "install");
for (i = 0; i < n_state; i++) {
if (!strcmp(state[i].name, direct ? selected.name : name))
- /* Installation is idempotent by package name. This also
- * avoids contacting the repository for a package that is
- * already active. Use `bpm upgrade` to change versions. */
+ /*
+ * Installation is idempotent by package name.
+ * This also avoids contacting the repository
+ * for a package that is already active. Use
+ * `bpm upgrade` to change versions.
+ */
return bpm_finish(lock, 0, "install");
}
if (!direct) {
diff --git a/builtin-upatch.c b/builtin-upatch.c
index 28a27cac..dd4a5adb 100644
--- a/builtin-upatch.c
+++ b/builtin-upatch.c
@@ -3075,8 +3075,10 @@ int shirudo_upatch_purge(const char *name, const char *reason)
return rc ? rc : 1;
}
-/* Native BPM lifecycle hooks. Keep package installation on the exact
- * same signed/persisted path as the public upatch commands. */
+/*
+ * Native BPM lifecycle hooks. Keep package installation on the exact
+ * same signed/persisted path as the public upatch commands.
+ */
int shirudo_upatch_install(const char *path)
{
const char *argv[] = { "load", "--no-precheck", path };
diff --git a/builtin.h b/builtin.h
index fa8fbf40..78c8ab05 100644
--- a/builtin.h
+++ b/builtin.h
@@ -44,8 +44,10 @@ int shirudo_upatch_remove(const char *path);
*/
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. */
+/*
+ * Internal lifecycle result: the signed payload was valid, but its kprobe
+ * target is unavailable because the backing module is not loaded.
+ */
#define SHIRUDO_UPATCH_INSTALL_TARGET_MISSING 2
/* Either-side. */
diff --git a/upatches/kernel-cve/sources/cve-2026-23315-wifi-mt76-oob-access-mt76-connac2-mac-write/observability/cve-2026-23315-caller-predicate.bpf.c b/upatches/kernel-cve/sources/cve-2026-23315-wifi-mt76-oob-access-mt76-connac2-mac-write/observability/cve-2026-23315-caller-predicate.bpf.c
index e02fa468..8658ae73 100644
--- a/upatches/kernel-cve/sources/cve-2026-23315-wifi-mt76-oob-access-mt76-connac2-mac-write/observability/cve-2026-23315-caller-predicate.bpf.c
+++ b/upatches/kernel-cve/sources/cve-2026-23315-wifi-mt76-oob-access-mt76-connac2-mac-write/observability/cve-2026-23315-caller-predicate.bpf.c
@@ -40,9 +40,11 @@ static __always_inline void count_event(void *map)
(*count)++;
}
-/* 7.2 source evidence: mt76_connac2_mac_write_txwi() passes skb as arg3 to
+/*
+ * 7.2 source evidence: mt76_connac2_mac_write_txwi() passes skb as arg3 to
* mt76_connac2_mac_write_txwi_80211(); the vulnerable helper reads the action
- * fields only after the IEEE80211_MIN_ACTION_SIZE check. */
+ * fields only after the IEEE80211_MIN_ACTION_SIZE check.
+ */
SEC("kprobe/mt76_connac2_mac_write_txwi")
int BPF_KPROBE(cve_2026_23315_caller_predicate,
void *dev, void *txwi, struct sk_buff *skb)
diff --git a/upatches/kernel-cve/sources/cve-2026-80725-net-gro-properly-validate-big-tcp-aggregation-criteria/observability/cve-2026-80725-big-tcp-gro-observe.bpf.c b/upatches/kernel-cve/sources/cve-2026-80725-net-gro-properly-validate-big-tcp-aggregation-criteria/observability/cve-2026-80725-big-tcp-gro-observe.bpf.c
index 092bc66c..56b79aea 100644
--- a/upatches/kernel-cve/sources/cve-2026-80725-net-gro-properly-validate-big-tcp-aggregation-criteria/observability/cve-2026-80725-big-tcp-gro-observe.bpf.c
+++ b/upatches/kernel-cve/sources/cve-2026-80725-net-gro-properly-validate-big-tcp-aggregation-criteria/observability/cve-2026-80725-big-tcp-gro-observe.bpf.c
@@ -56,8 +56,10 @@ struct {
__type(value, __u64);
} control SEC(".maps");
-/* 0=legacy-cross, 1=non-tcp, 2=encap, 3=ipv6-headroom,
- * 4=gro-limit, 5=e2big-return. */
+/*
+ * 0=legacy-cross, 1=non-tcp, 2=encap, 3=ipv6-headroom,
+ * 4=gro-limit, 5=e2big-return.
+ */
struct {
__uint(type, BPF_MAP_TYPE_PERCPU_ARRAY);
__uint(max_entries, 6);
diff --git a/util/bpm_oci.c b/util/bpm_oci.c
index 0ae8fe05..8931f2b4 100644
--- a/util/bpm_oci.c
+++ b/util/bpm_oci.c
@@ -307,8 +307,11 @@ static int load_registry_auth(const char *registry, struct bpm_oci_client *c)
}
rc = bpm_read_file(authfile, &body, &body_len, 4u * 1024u * 1024u);
if (rc) return rc == -ENOENT ? 0 : rc;
- /* The auth file is local input; require the registry key and auth member
- * to occur in the same JSON object before accepting credentials. */
+ /*
+ * The auth file is local input; require the registry key and auth
+ * member to occur in the same JSON object before accepting
+ * credentials.
+ */
snprintf(needle, sizeof(needle), "\"%s\"", registry);
p = strstr((char *)body, needle);
if (!p) { xfree(body, body_len + 1); return 0; }
@@ -406,8 +409,10 @@ static int curl_once_ex(struct bpm_oci_client *c, const char *method,
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, errbuf);
curl_easy_setopt(curl, CURLOPT_NOSIGNAL, 1L);
- /* OCI registries commonly redirect blob GETs to a signed CDN URL.
- * Follow only for file downloads, never for manifest or upload calls. */
+ /*
+ * OCI registries commonly redirect blob GETs to a signed CDN URL.
+ * Follow only for file downloads, never for manifest or upload calls.
+ */
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, file ? 1L : 0L);
if (file) {
const char *redirect_protocols =
@@ -671,9 +676,11 @@ int bpm_oci_get_file(struct bpm_oci_client *c, const char *url,
return rc;
}
-/* A request helper for OCI uploads. Unlike the download helpers above, it
+/*
+ * A request helper for OCI uploads. Unlike the download helpers above, it
* preserves the response headers (notably Location) and supports a request
- * body while still retrying once after a registry authentication challenge. */
+ * body while still retrying once after a registry authentication challenge.
+ */
int bpm_oci_request(struct bpm_oci_client *c, const char *method,
const char *url, const char *accept, const char *content_type,
const void *body, size_t body_len, struct bpm_http_response *r)
diff --git a/util/bpm_package.c b/util/bpm_package.c
index 674d0d4f..b2229886 100644
--- a/util/bpm_package.c
+++ b/util/bpm_package.c
@@ -264,10 +264,12 @@ static X509 *read_x509_memory(const unsigned char *body, size_t len)
return x;
}
-/* Hash the exact DER SubjectPublicKeyInfo representation used by Go's
+/*
+ * Hash the exact DER SubjectPublicKeyInfo representation used by Go's
* x509.MarshalPKIXPublicKey. Keep this explicit instead of relying on
* X509_pubkey_digest(), whose meaning is easy to confuse with a digest of
- * the key material itself when diagnosing package signer mismatches. */
+ * the key material itself when diagnosing package signer mismatches.
+ */
static int x509_spki_sha256(const X509 *cert, unsigned char digest[32])
{
X509_PUBKEY *spki;
diff --git a/util/bpm_tree.c b/util/bpm_tree.c
index eaf70bc0..5182ae92 100644
--- a/util/bpm_tree.c
+++ b/util/bpm_tree.c
@@ -15,9 +15,11 @@
#include "macros.h"
#include "malloc.h"
-/* The tree payload is deliberately parsed here instead of through the
+/*
+ * The tree payload is deliberately parsed here instead of through the
* schema parser: selectors contain maps whose keys are not known ahead of
- * time. The parser is still bounded and ignores unknown fields. */
+ * time. The parser is still bounded and ignores unknown fields.
+ */
struct tree_parser {
const char *p;
const char *end;
diff --git a/util/bpm_tree.h b/util/bpm_tree.h
index 653c4eb3..490f29f3 100644
--- a/util/bpm_tree.h
+++ b/util/bpm_tree.h
@@ -100,8 +100,10 @@ int shirudo_tree_operation_digest(const struct shirudo_tree_operation *op,
int shirudo_tree_emit_publication(const struct shirudo_tree_publication *pub,
char **out, size_t *out_len);
-/* Evaluate a publication selector against the running node. An empty
- * selector is an unconstrained wildcard and matches every node. */
+/*
+ * Evaluate a publication selector against the running node. An empty
+ * selector is an unconstrained wildcard and matches every node.
+ */
int shirudo_tree_selector_matches(const struct shirudo_tree_selector *selector);
/* Persistent tree state and selected-operation eventlog. */
diff --git a/util/bpm_tree_state.c b/util/bpm_tree_state.c
index d41523a0..680db410 100644
--- a/util/bpm_tree_state.c
+++ b/util/bpm_tree_state.c
@@ -138,10 +138,12 @@ static int read_config_file(const char *path, struct shirudo_tree_kv *out,
return rc;
}
-/* The kernel config can contain thousands of entries. Index only the
+/*
+ * The kernel config can contain thousands of entries. Index only the
* selector keys, then scan the complete config once and retain matching
* values. This avoids both an arbitrary config-entry cap and an O(N*M)
- * lookup for N config entries and M selector keys. */
+ * lookup for N config entries and M selector keys.
+ */
#define SHIRUDO_TREE_SELECTOR_HASH_SIZE 128
static unsigned int selector_hash(const char *key)
@@ -303,9 +305,11 @@ int shirudo_tree_selector_matches(const struct shirudo_tree_selector *s)
char path[PATH_MAX];
bool matched, config_any;
- /* An empty selector is the tree's explicit wildcard. Evaluate this
+ /*
+ * An empty selector is the tree's explicit wildcard. Evaluate this
* before consulting node metadata so an unconstrained operation is
- * still applicable if uname(2) is unavailable. */
+ * still applicable if uname(2) is unavailable.
+ */
if (!s)
return 0;
if (!s->n_kernel_release_prefix && !s->n_kernel_build_id && !s->n_architecture &&
@@ -327,8 +331,10 @@ int shirudo_tree_selector_matches(const struct shirudo_tree_selector *s)
if (s->n_kernel_build_id) {
char build_id[SHIRUDO_KERNEL_BUILD_ID_STRING_MAX];
- /* A selector carrying a build ID is deliberately fail-closed when
- * the running kernel does not publish a GNU build ID. */
+ /*
+ * A selector carrying a build ID is deliberately fail-closed
+ * when the running kernel does not publish a GNU build ID.
+ */
if (shirudo_kernel_build_id_read(build_id))
return 0;
matched = false;
diff --git a/util/kmodules.c b/util/kmodules.c
index 6d3a0533..70ad5a73 100644
--- a/util/kmodules.c
+++ b/util/kmodules.c
@@ -221,9 +221,11 @@ int shirudo_kmodules_read(struct shirudo_kmod_set *set)
/* qsort scrambled indices; rebuild raws[].mod_idx by lookup. */
for (size_t i = 0; i < n_raw; i++) {
- /* The original raws[i].mod_idx is invalid post-sort. We
+ /*
+ * The original raws[i].mod_idx is invalid post-sort. We
* stored the *raw* name slice but lost which module it
- * belonged to. Re-discover by reparsing. */
+ * belonged to. Re-discover by reparsing.
+ */
(void)0;
}
/*
diff --git a/util/paths.h b/util/paths.h
index cbc4f3fa..9740e453 100644
--- a/util/paths.h
+++ b/util/paths.h
@@ -116,7 +116,8 @@ int shirudo_key_paths(const char *keys_dir,
char *cert_path, size_t cert_sz);
const char *shirudo_keys_dir_resolve(const char *keys_dir_arg);
-/* Convert a userspace upatch name to a bpffs path component. bpffs
+/*
+ * Convert a userspace upatch name to a bpffs path component. bpffs
* reserves dots in path components, while the userspace/persisted name
* format permits them (for example, kernel-version-qualified patches).
* The returned component is intentionally only a path representation; the
diff --git a/util/upatch_decode.c b/util/upatch_decode.c
index 770a2b03..5e6db05c 100644
--- a/util/upatch_decode.c
+++ b/util/upatch_decode.c
@@ -1065,8 +1065,10 @@ static void lua_push_map_input(lua_State *L, const struct shirudo_map_view *v)
lua_setfield(L, -2, "upatch");
lua_pushstring(L, v->name);
lua_setfield(L, -2, "map");
- /* Metric decoders need valid OTLP wall-clock timestamps. Keep these
- * as decimal strings because Lua numbers cannot represent uint64_ns. */
+ /*
+ * Metric decoders need valid OTLP wall-clock timestamps. Keep these
+ * as decimal strings because Lua numbers cannot represent uint64_ns.
+ */
lua_push_u64_string(L, start_ns);
lua_setfield(L, -2, "startTimeUnixNano");
lua_push_u64_string(L, now_ns);