Skip to content

eBPF-based security platform

bpf/lib: drop the shirudo_ prefix from the policy map header

Daniel Borkmannf712387ac4a9
diff --git a/Documentation/upatches/publish/beefile.rst b/Documentation/upatches/publish/beefile.rst
index e97e2412..4aeb3abe 100644
--- a/Documentation/upatches/publish/beefile.rst
+++ b/Documentation/upatches/publish/beefile.rst
@@ -212,8 +212,8 @@ embeds the entries in the signed ``SHPL`` section. Its presence opts the
upatch into shirudo's shared task ``policy_map`` and socket
``socket_policy_map``. The generated loader reuses both pinned maps
rather than creating private copies. The BPF source must declare the map
-ABI, normally by including ``shirudo_policy_map.h`` after ``vmlinux.h``
-and the libbpf headers.
+ABI, normally by including ``policy.h`` after ``vmlinux.h`` and the
+libbpf headers.
.. code-block:: toml
@@ -227,13 +227,13 @@ other upatches extends that policy; an ID cannot change masks, and two
different IDs cannot use the same mask in one package. Paths may name
non-executable files.
-For an upatch with at least one policy table, include
-``shirudo_policy_map.h`` in its BPF source so it declares both shared maps
-with the required ABI. The header is installed beside the shirudo BPF
-headers. The signed ``SHPL`` section opts the upatch into these bindings;
-declaring the maps without policy tables leaves them as ordinary
-upatch-owned maps. Signed BPF programs can write the maps, so enforcement
-programs must treat them as read-only by contract.
+For an upatch with at least one policy table, include ``policy.h`` in
+its BPF source so it declares both shared maps with the required ABI.
+The header is installed beside the shirudo BPF headers. The signed
+``SHPL`` section opts the upatch into these bindings; declaring the maps
+without policy tables leaves them as ordinary upatch-owned maps. Signed
+BPF programs can write the maps, so enforcement programs must treat them
+as read-only by contract.
The generator and the updater run on the operator host with the
operator's rights. The target receives only the signed result. Without
diff --git a/Makefile.shirudo b/Makefile.shirudo
index 557704dd..835bfad7 100644
--- a/Makefile.shirudo
+++ b/Makefile.shirudo
@@ -304,7 +304,7 @@ BPF_LIBBPF_HEADERS := $(addprefix $(LIBBPF_DIR)/,\
$(addsuffix .h,$(BPF_VENDOR_HEADERS)))
BPF_LIB_HEADERS := bpf/lib/misc.h \
bpf/lib/serializer.h \
- bpf/lib/shirudo_policy_map.h \
+ bpf/lib/policy.h \
bpf/lib/decoder.h
# bpf/*.bpf.c sources compiled with clang -target bpf and embedded via
diff --git a/bpf/lib/lsm.h b/bpf/lib/lsm.h
index f0b7acb0..6679621d 100644
--- a/bpf/lib/lsm.h
+++ b/bpf/lib/lsm.h
@@ -28,7 +28,7 @@
#include <shirudo/enforcement.h>
#include "identity.h"
-#include "shirudo_policy_map.h"
+#include "policy.h"
#include "tamper.h"
#define TASK_TRUSTED 1
diff --git a/bpf/lib/shirudo_policy_map.h b/bpf/lib/policy.h
similarity index 69%
rename from bpf/lib/shirudo_policy_map.h
rename to bpf/lib/policy.h
index 6e61a431..36b8c1f5 100644
--- a/bpf/lib/shirudo_policy_map.h
+++ b/bpf/lib/policy.h
@@ -1,6 +1,12 @@
/* SPDX-License-Identifier: GPL-2.0 OR BSD-2-Clause */
-#ifndef SHIRUDO_POLICY_MAP_H
-#define SHIRUDO_POLICY_MAP_H
+/*
+ * Copyright (c) 2026 Authors of shirudo
+ *
+ * The task and socket policy maps that policy-label upatches share.
+ */
+
+#ifndef SHIRUDO_BPF_POLICY_H
+#define SHIRUDO_BPF_POLICY_H
struct shirudo_task_policy {
__u64 active;
@@ -21,4 +27,4 @@ struct {
__type(value, __u64);
} socket_policy_map SEC(".maps");
-#endif
+#endif /* SHIRUDO_BPF_POLICY_H */
diff --git a/testing/fixtures/policy-exec-graph/policy-exec-graph.bpf.c b/testing/fixtures/policy-exec-graph/policy-exec-graph.bpf.c
index 9cfb9d10..049d98ec 100644
--- a/testing/fixtures/policy-exec-graph/policy-exec-graph.bpf.c
+++ b/testing/fixtures/policy-exec-graph/policy-exec-graph.bpf.c
@@ -3,7 +3,7 @@
#include <bpf/bpf_endian.h>
#include <bpf/bpf_helpers.h>
#include <bpf/bpf_tracing.h>
-#include "shirudo_policy_map.h"
+#include "policy.h"
char _license[] SEC("license") = "Dual BSD/GPL";
diff --git a/testing/fixtures/policy-labels/policy-labels.bpf.c b/testing/fixtures/policy-labels/policy-labels.bpf.c
index a707369e..065ef3a5 100644
--- a/testing/fixtures/policy-labels/policy-labels.bpf.c
+++ b/testing/fixtures/policy-labels/policy-labels.bpf.c
@@ -2,7 +2,7 @@
#include "vmlinux.h"
#include <bpf/bpf_helpers.h>
#include <bpf/bpf_tracing.h>
-#include "shirudo_policy_map.h"
+#include "policy.h"
char _license[] SEC("license") = "Dual BSD/GPL";