Skip to content

eBPF-based security platform

include: move shirudo_enforcement.h to include/shirudo/enforcement.h

Daniel Borkmanna6ed69083196
diff --git a/Documentation/contribute/code/developer-guide.rst b/Documentation/contribute/code/developer-guide.rst
index 3d192a0a..90414eb1 100644
--- a/Documentation/contribute/code/developer-guide.rst
+++ b/Documentation/contribute/code/developer-guide.rst
@@ -349,7 +349,7 @@ Project layout
* - ``bpf/lib/``
- Headers shared with upatches: decoders, identity, serializers,
tamper counters and common helpers.
- * - ``include/shirudo/``, ``include/shirudo_enforcement.h``
+ * - ``include/shirudo/``
- Integer types, string and number helpers, the ``.upatch``
container layout, TPM types and the enforcement definitions
shared between userspace and BPF.
diff --git a/Makefile.shirudo b/Makefile.shirudo
index 82934e10..e097e195 100644
--- a/Makefile.shirudo
+++ b/Makefile.shirudo
@@ -365,7 +365,8 @@ build/target/%.o: %.c Makefile.shirudo $(CONFIG_MK_DEP)
# and UAPI kernel headers from vendor/libbpf, and shirudo's own BPF
# library headers from bpf/lib.
bpf/%.bpf.o: bpf/%.c $(VMLINUX_H) $(BPF_LIBBPF_HEADERS) \
- $(wildcard bpf/*.h bpf/lib/*.h) include/shirudo/tpm.h
+ $(wildcard bpf/*.h bpf/lib/*.h) include/shirudo/tpm.h \
+ include/shirudo/enforcement.h
@printf ' CLANG $@\n'
$(Q)$(CLANG_BPF) -Iinclude -Ibpf/lib -I$(dir $(VMLINUX_H)) -I$(LIBBPF_VENDOR) \
-I$(BPF_UAPI_INCLUDE) \
diff --git a/bpf/lsm.h b/bpf/lsm.h
index 21ecfab1..e7dca924 100644
--- a/bpf/lsm.h
+++ b/bpf/lsm.h
@@ -35,8 +35,9 @@
#define PR_SET_MM_EXE_FILE 13
#define PR_SET_MM_MAP 14
+#include <shirudo/enforcement.h>
+
#include "lib/shirudo_identity.h"
-#include "../include/shirudo_enforcement.h"
#include "shirudo_tamper.h"
#define SHIRUDO_TASK_TRUSTED 1
diff --git a/include/shirudo_enforcement.h b/include/shirudo/enforcement.h
similarity index 100%
rename from include/shirudo_enforcement.h
rename to include/shirudo/enforcement.h
diff --git a/testing/Makefile b/testing/Makefile
index 2830f48f..f0fdaa86 100644
--- a/testing/Makefile
+++ b/testing/Makefile
@@ -117,7 +117,7 @@ KERNEL_BUILD_STAMP := $(KERNEL_BUILD_ARTIFACT_DIR)/$(VM_KERNEL_IMAGE_NAME).sha25
TEST_VM_BUNDLE_STAMP := $(TEST_VM_BUNDLE_DIR)/.stamp
TEST_VM_BUNDLE_SOURCES := $(sort $(wildcard \
- $(ROOT)/*.c $(ROOT)/*.h $(ROOT)/include/*.h $(ROOT)/include/shirudo/*.h \
+ $(ROOT)/*.c $(ROOT)/*.h $(ROOT)/include/shirudo/*.h \
$(ROOT)/util/*.c $(ROOT)/util/*.h \
$(ROOT)/bpf/*.c $(ROOT)/bpf/*.h $(ROOT)/bpf/lib/*.h \
$(ROOT)/tools/shirudo-build/*.c $(ROOT)/tools/shirudo-build/*.h \
diff --git a/util/identity.c b/util/identity.c
index ba6863ce..fc0c7b4e 100644
--- a/util/identity.c
+++ b/util/identity.c
@@ -14,10 +14,10 @@
#include <bpf/bpf.h>
+#include <shirudo/enforcement.h>
#include <shirudo/misc.h>
#include "identity.h"
-#include "shirudo_enforcement.h"
#include "paths.h"
int shirudo_enforcement_active(void)
diff --git a/util/image_guards.c b/util/image_guards.c
index e134a35a..27b79869 100644
--- a/util/image_guards.c
+++ b/util/image_guards.c
@@ -15,6 +15,7 @@
#include <bpf/btf.h>
#include <bpf/libbpf.h>
+#include <shirudo/enforcement.h>
#include <shirudo/misc.h>
#include <shirudo/string.h>
@@ -23,7 +24,6 @@
#include "log.h"
#include "macros.h"
#include "paths.h"
-#include "shirudo_enforcement.h"
#include "tamper.h"
_Static_assert(SHIRUDO_PERF_EVENT_IOC_SET_BPF == PERF_EVENT_IOC_SET_BPF,
diff --git a/util/image_runtime.c b/util/image_runtime.c
index 44f5a1ae..37c0b0e3 100644
--- a/util/image_runtime.c
+++ b/util/image_runtime.c
@@ -20,6 +20,7 @@
#include <bpf/bpf.h>
+#include <shirudo/enforcement.h>
#include <shirudo/misc.h>
#include <shirudo/string.h>
@@ -45,7 +46,6 @@
#include "macros.h"
#include "paths.h"
#include "seal.h"
-#include "shirudo_enforcement.h"
#include "tpm.h"
struct image_context {