eBPF-based security platform
bpf/lib: drop the shirudo_ and SHIRUDO_ prefixes
Daniel Borkmannf3a76642f4f5
diff --git a/Documentation/concepts/background/luajit.rst b/Documentation/concepts/background/luajit.rstindex c2ad6f70..0b9da1a8 100644--- a/Documentation/concepts/background/luajit.rst+++ b/Documentation/concepts/background/luajit.rst@@ -66,7 +66,7 @@ How a decoder reaches the targetThe BPF source declares each decoder in ``.rodata`` with a``struct shirudo_decoder_manifest`` from-``bpf/lib/shirudo_decoder.h``. The manifest starts with the magic+``bpf/lib/decoder.h``. The manifest starts with the magic``DECD`` and names the language (``1``, Lua), the host API version, theinput format (``1``), the signal to export (``1`` for a log, ``2`` for ametric), the upatch and map it decodes, the Lua source file relative todiff --git a/Documentation/contribute/code/develop-locally.rst b/Documentation/contribute/code/develop-locally.rstindex 1614933b..2e8d44b2 100644--- a/Documentation/contribute/code/develop-locally.rst+++ b/Documentation/contribute/code/develop-locally.rst@@ -249,7 +249,7 @@ way a real upatch's data reaches a collector.``shirudo-build`` compiles in the package directory. It takes thelibbpf headers and ``vmlinux.h`` from ``vendor/`` and- ``shirudo_decoder.h`` from ``bpf/lib/``. An installed operator+ ``decoder.h`` from ``bpf/lib/``. An installed operatorpackage brings its own copies and needs no links.2. Write ``build/dev/exec-count/exec-count.bpf.c``:diff --git a/Documentation/contribute/code/develop-locally/exec-count.bpf.c b/Documentation/contribute/code/develop-locally/exec-count.bpf.cindex 0b74c3a4..9d441125 100644--- a/Documentation/contribute/code/develop-locally/exec-count.bpf.c+++ b/Documentation/contribute/code/develop-locally/exec-count.bpf.c@@ -2,7 +2,7 @@#include "vmlinux.h"#include <bpf/bpf_helpers.h>#include <bpf/bpf_tracing.h>-#include "shirudo_decoder.h"+#include "decoder.h"char _license[] SEC("license") = "Dual BSD/GPL";@@ -14,12 +14,12 @@ struct {} execs SEC(".maps");const struct shirudo_decoder_manifest execs_decoder SEC(".rodata") = {- .magic = SHIRUDO_DECODER_MANIFEST_MAGIC,- .version = SHIRUDO_UPATCH_DECODER_VERSION,- .language = SHIRUDO_UPATCH_DECODER_LANG_LUA,+ .magic = DECODER_MANIFEST_MAGIC,+ .version = UPATCH_DECODER_VERSION,+ .language = UPATCH_DECODER_LANG_LUA,.api_version = 1,- .input_format = SHIRUDO_UPATCH_DECODER_INPUT_MAP_V1,- .export_signal = SHIRUDO_UPATCH_DECODER_EXPORT_LOG,+ .input_format = UPATCH_DECODER_INPUT_MAP_V1,+ .export_signal = UPATCH_DECODER_EXPORT_LOG,.upatch = "exec-count",.map = "execs",.source = "decoders/execs.lua",diff --git a/Documentation/reference/formats/upatch-format.rst b/Documentation/reference/formats/upatch-format.rstindex 357f6a2c..1b5e5463 100644--- a/Documentation/reference/formats/upatch-format.rst+++ b/Documentation/reference/formats/upatch-format.rst@@ -566,7 +566,7 @@ Each decoder entry:- Length of the source, non-zero.The writer takes each entry from a ``struct shirudo_decoder_manifest`` that-the BPF program declares in ``.rodata`` (``bpf/lib/shirudo_decoder.h``,+the BPF program declares in ``.rodata`` (``bpf/lib/decoder.h``,192 bytes, magic ``0x44434544``, the bytes ``DECD``, ``u16`` fields``version``, ``language``, ``api_version``, ``input_format``,``export_signal`` and ``reserved``, then the same four strings). It scansdiff --git a/Documentation/upatches/write/decoders.rst b/Documentation/upatches/write/decoders.rstindex 626af4f2..bc588fc1 100644--- a/Documentation/upatches/write/decoders.rst+++ b/Documentation/upatches/write/decoders.rst@@ -32,22 +32,22 @@ Declare the decoderbody of one log record per snapshot. A metric decoder returns OTLPmetrics with names, units and data points of its choosing.-2. Include ``shirudo_decoder.h`` after ``vmlinux.h`` and declare a+2. Include ``decoder.h`` after ``vmlinux.h`` and declare amanifest in ``.rodata``. ``kernel-obs`` declares this one, through amacro, for ``watch_stat``, a per-CPU array whose one value holds two``__u64`` counters, ``checked`` and ``matched``:.. code-block:: c- #include "shirudo_decoder.h"+ #include "decoder.h"const struct shirudo_decoder_manifest watch_stat_decoder SEC(".rodata") = {- .magic = SHIRUDO_DECODER_MANIFEST_MAGIC,- .version = SHIRUDO_UPATCH_DECODER_VERSION,- .language = SHIRUDO_UPATCH_DECODER_LANG_LUA,+ .magic = DECODER_MANIFEST_MAGIC,+ .version = UPATCH_DECODER_VERSION,+ .language = UPATCH_DECODER_LANG_LUA,.api_version = 1,- .input_format = SHIRUDO_UPATCH_DECODER_INPUT_MAP_V1,- .export_signal = SHIRUDO_UPATCH_DECODER_EXPORT_METRIC,+ .input_format = UPATCH_DECODER_INPUT_MAP_V1,+ .export_signal = UPATCH_DECODER_EXPORT_METRIC,.upatch = "kernel-obs",.map = "watch_stat",.source = "decoders/watch_stat.lua",@@ -73,8 +73,8 @@ Declare the decoder- The constants shown. Any other value fails the build with``unsupported decoder ABI for '<upatch>/<map>'``.* - ``export_signal``- - ``SHIRUDO_UPATCH_DECODER_EXPORT_LOG`` or- ``SHIRUDO_UPATCH_DECODER_EXPORT_METRIC``.+ - ``UPATCH_DECODER_EXPORT_LOG`` or+ ``UPATCH_DECODER_EXPORT_METRIC``.* - ``upatch``- The upatch name, at most 63 characters. In a package that is thesource's base name.diff --git a/Documentation/upatches/write/maps-arenas-serializers.rst b/Documentation/upatches/write/maps-arenas-serializers.rstindex dbb96b1d..2c85467d 100644--- a/Documentation/upatches/write/maps-arenas-serializers.rst+++ b/Documentation/upatches/write/maps-arenas-serializers.rst@@ -108,7 +108,7 @@ Serializer interfaceA serializer is a ``SEC("syscall")`` program named``shirudo_serialize__<map>``. It writes into ``shirudo_ser``, an array mapwith a ``__u32`` key and ``struct shirudo_serial_chunk`` values that the-upatch defines with 1 to 256 entries. ``bpf/lib/shirudo_serializer.h``+upatch defines with 1 to 256 entries. ``bpf/lib/serializer.h``holds the definitions. The builder refuses a serializer that is not in``SEC("syscall")``, targets a map that does not exist or is``shirudo_ser`` itself, or duplicates another one, and refuses an upatch@@ -124,9 +124,9 @@ once per page:* - Context field- Meaning* - ``magic``, ``version``- - ``SHIRUDO_SERIAL_MAGIC`` and ``SHIRUDO_SERIAL_VERSION``, 1+ - ``SERIAL_MAGIC`` and ``SERIAL_VERSION``, 1* - ``flags``- - ``SHIRUDO_SERIAL_CTX_F_PEEK`` when the reader asks for a peek+ - ``SERIAL_CTX_F_PEEK`` when the reader asks for a peek* - ``max_chunks``- the number of entries of ``shirudo_ser``* - ``chunk_payload_size``@@ -143,7 +143,7 @@ chunks 0 to ``total_chunks - 1``, each a 64-byte header and 4032 bytes ofpayload. Every chunk carries its own ``chunk_index`` and repeats thepage's ``total_chunks``, ``page_index``, ``cursor``, ``next_cursor``,``invocation_id`` and ``bytes_total``. On the last page, chunk 0 has-``SHIRUDO_SERIAL_F_DONE`` in ``flags``. A negative return or a non-zero+``SERIAL_F_DONE`` in ``flags``. A negative return or a non-zero``status`` in a chunk fails the read. shirudo checks themagic, the version, the invocation id, the page index and cursor, thechunk count and the byte counts, concatenates the chunks' payloads into a@@ -160,7 +160,7 @@ Draining and peeking--------------------Whether a read consumes the data is the serializer's decision. shirudo-passes one flag, ``SHIRUDO_SERIAL_CTX_F_PEEK``, and nothing else. The+passes one flag, ``SERIAL_CTX_F_PEEK``, and nothing else. Theconvention every shipped serializer follows: without the flag, the readdrains. It hands over the interval collected since the previous exportand resets it, as ``obs_table.h`` does with its swap and clear. With thediff --git a/Makefile.shirudo b/Makefile.shirudoindex cf34739e..739a9784 100644--- a/Makefile.shirudo+++ b/Makefile.shirudo@@ -254,9 +254,9 @@ BPF_VENDOR_HEADERS := bpf_helpers bpf_helper_defs bpf_tracing \bpf_core_read bpf_endianBPF_LIBBPF_HEADERS := $(addprefix $(LIBBPF_DIR)/,\$(addsuffix .h,$(BPF_VENDOR_HEADERS)))-BPF_LIB_HEADERS := bpf/lib/shirudo_misc.h \- bpf/lib/shirudo_serializer.h \- bpf/lib/shirudo_decoder.h+BPF_LIB_HEADERS := bpf/lib/misc.h \+ bpf/lib/serializer.h \+ bpf/lib/decoder.h# bpf/*.bpf.c sources compiled with clang -target bpf and embedded via# .incbin into util/loader.o. bpf/lib/ is include-only.diff --git a/bpf/lib/shirudo_decoder.h b/bpf/lib/decoder.hsimilarity index 52%rename from bpf/lib/shirudo_decoder.hrename to bpf/lib/decoder.hindex 20937698..cadea9c1 100644--- a/bpf/lib/shirudo_decoder.h+++ b/bpf/lib/decoder.h@@ -8,19 +8,19 @@#ifndef SHIRUDO_DECODER_H#define SHIRUDO_DECODER_H-#define SHIRUDO_DECODER_MANIFEST_MAGIC 0x44434544u /* "DECD" le */-#define SHIRUDO_UPATCH_DECODER_VERSION 1u-#define SHIRUDO_UPATCH_DECODER_LANG_LUA 1u-#define SHIRUDO_UPATCH_DECODER_INPUT_MAP_V1 1u-#define SHIRUDO_UPATCH_DECODER_EXPORT_LOG 1u-#define SHIRUDO_UPATCH_DECODER_EXPORT_METRIC 2u+#define DECODER_MANIFEST_MAGIC 0x44434544u /* "DECD" le */+#define UPATCH_DECODER_VERSION 1u+#define UPATCH_DECODER_LANG_LUA 1u+#define UPATCH_DECODER_INPUT_MAP_V1 1u+#define UPATCH_DECODER_EXPORT_LOG 1u+#define UPATCH_DECODER_EXPORT_METRIC 2ustruct shirudo_decoder_manifest {- __u32 magic; /* SHIRUDO_DECODER_MANIFEST_MAGIC */- __u16 version; /* SHIRUDO_UPATCH_DECODER_VERSION */+ __u32 magic; /* DECODER_MANIFEST_MAGIC */+ __u16 version; /* UPATCH_DECODER_VERSION */__u16 language; /* SHIRUDO_UPATCH_DECODER_LANG_* */__u16 api_version;- __u16 input_format; /* SHIRUDO_UPATCH_DECODER_INPUT_MAP_V1 */+ __u16 input_format; /* UPATCH_DECODER_INPUT_MAP_V1 */__u16 export_signal; /* SHIRUDO_UPATCH_DECODER_EXPORT_* */__u16 reserved;char upatch[64];diff --git a/bpf/lib/shirudo_identity.h b/bpf/lib/identity.hsimilarity index 100%rename from bpf/lib/shirudo_identity.hrename to bpf/lib/identity.hdiff --git a/bpf/lib/shirudo_misc.h b/bpf/lib/misc.hsimilarity index 100%rename from bpf/lib/shirudo_misc.hrename to bpf/lib/misc.hdiff --git a/bpf/lib/shirudo_serializer.h b/bpf/lib/serializer.hsimilarity index 70%rename from bpf/lib/shirudo_serializer.hrename to bpf/lib/serializer.hindex e1ccfc04..1060917f 100644--- a/bpf/lib/shirudo_serializer.h+++ b/bpf/lib/serializer.h@@ -9,30 +9,30 @@#ifndef SHIRUDO_SERIALIZER_H#define SHIRUDO_SERIALIZER_H-#include "shirudo_misc.h"+#include "misc.h"-#define SHIRUDO_SERIAL_MAP_NAME "shirudo_ser"-#define SHIRUDO_SERIAL_MAGIC 0x5a4c5253u /* "SRLZ" le */-#define SHIRUDO_SERIAL_VERSION 1u-#define SHIRUDO_SERIAL_MAP_NAME_MAX 16u-#define SHIRUDO_SERIAL_MAX_CHUNKS 256u-#define SHIRUDO_SERIAL_MAX_PAGES 256u-#define SHIRUDO_SERIAL_F_DONE (1u << 0)+#define SERIAL_MAP_NAME "shirudo_ser"+#define SERIAL_MAGIC 0x5a4c5253u /* "SRLZ" le */+#define SERIAL_VERSION 1u+#define SERIAL_MAP_NAME_MAX 16u+#define SERIAL_MAX_CHUNKS 256u+#define SERIAL_MAX_PAGES 256u+#define SERIAL_F_DONE (1u << 0)/* ctx->flags: read the live state without draining it. */-#define SHIRUDO_SERIAL_CTX_F_PEEK (1u << 0)+#define SERIAL_CTX_F_PEEK (1u << 0)/** Keep the syscall test-run context within the older five-u64 argument* limit. Page result metadata lives in struct shirudo_serial_chunk.*/-#define SHIRUDO_SERIAL_CTX_MAX_BYTES 40u+#define SERIAL_CTX_MAX_BYTES 40u/** Keep the chunk value at exactly 4096 bytes: a 64-byte header plus* payload. This is friendly to map value allocation and easy to inspect.*/-#define SHIRUDO_SERIAL_CHUNK_PAYLOAD 4032u+#define SERIAL_CHUNK_PAYLOAD 4032ustruct shirudo_serialize_ctx {__u32 magic;@@ -59,11 +59,11 @@ struct shirudo_serial_chunk {__u64 cursor;__u64 next_cursor;__u64 invocation_id;- __u8 data[SHIRUDO_SERIAL_CHUNK_PAYLOAD];+ __u8 data[SERIAL_CHUNK_PAYLOAD];};BUILD_BUG_ON(sizeof(struct shirudo_serialize_ctx) !=- SHIRUDO_SERIAL_CTX_MAX_BYTES);+ SERIAL_CTX_MAX_BYTES);BUILD_BUG_ON(sizeof(struct shirudo_serial_chunk) != 4096);#endif /* SHIRUDO_SERIALIZER_H */diff --git a/bpf/lib/shirudo_tamper.h b/bpf/lib/tamper.hsimilarity index 100%rename from bpf/lib/shirudo_tamper.hrename to bpf/lib/tamper.hdiff --git a/bpf/lsm.h b/bpf/lsm.hindex fa08f643..ad890b9a 100644--- a/bpf/lsm.h+++ b/bpf/lsm.h@@ -37,8 +37,8 @@#include <shirudo/enforcement.h>-#include "lib/shirudo_identity.h"-#include "shirudo_tamper.h"+#include "lib/identity.h"+#include "tamper.h"#define TASK_TRUSTED 1#define TASK_BOOTSTRAP 2diff --git a/builtin-upatch.c b/builtin-upatch.cindex 5f272ee9..0d763e4d 100644--- a/builtin-upatch.c+++ b/builtin-upatch.c@@ -116,19 +116,19 @@ static const char *flag_str(const struct shirudo_upatch *u)static const char *decoder_language_str(__u32 language){- return language == SHIRUDO_UPATCH_DECODER_LANG_LUA ? "lua" : "unknown";+ return language == UPATCH_DECODER_LANG_LUA ? "lua" : "unknown";}static const char *decoder_input_str(__u32 input_format){- return input_format == SHIRUDO_UPATCH_DECODER_INPUT_MAP_V1 ?+ return input_format == UPATCH_DECODER_INPUT_MAP_V1 ?"shirudo.map.v1" : "unknown";}static const char *decoder_signal_str(__u32 signal){- return signal == SHIRUDO_UPATCH_DECODER_EXPORT_LOG ? "log" :- signal == SHIRUDO_UPATCH_DECODER_EXPORT_METRIC ? "metric" :+ return signal == UPATCH_DECODER_EXPORT_LOG ? "log" :+ signal == UPATCH_DECODER_EXPORT_METRIC ? "metric" :"unknown";}diff --git a/include/shirudo/upatch.h b/include/shirudo/upatch.hindex 50324947..dc01aa7d 100644--- a/include/shirudo/upatch.h+++ b/include/shirudo/upatch.h@@ -103,15 +103,15 @@ struct shirudo_upatch_signed_trailer {* programs declare a shirudo_decoder_manifest in .rodata; shirudo-build* resolves and embeds the decoder source before signing.*/-#define SHIRUDO_DECODER_MANIFEST_MAGIC 0x44434544u /* "DECD" le */+#define DECODER_MANIFEST_MAGIC 0x44434544u /* "DECD" le */#define UPATCH_DECODER_MAGIC 0x42444344u /* "DCDB" le */-#define SHIRUDO_UPATCH_DECODER_VERSION 1u-#define SHIRUDO_UPATCH_DECODER_LANG_LUA 1u-#define SHIRUDO_UPATCH_DECODER_INPUT_MAP_V1 1u+#define UPATCH_DECODER_VERSION 1u+#define UPATCH_DECODER_LANG_LUA 1u+#define UPATCH_DECODER_INPUT_MAP_V1 1uenum shirudo_upatch_decoder_export_signal {- SHIRUDO_UPATCH_DECODER_EXPORT_LOG = 1,- SHIRUDO_UPATCH_DECODER_EXPORT_METRIC = 2,+ UPATCH_DECODER_EXPORT_LOG = 1,+ UPATCH_DECODER_EXPORT_METRIC = 2,};struct shirudo_decoder_manifest {@@ -119,7 +119,7 @@ struct shirudo_decoder_manifest {__u16 version;__u16 language;__u16 api_version;- __u16 input_format; /* SHIRUDO_UPATCH_DECODER_INPUT_MAP_V1 */+ __u16 input_format; /* UPATCH_DECODER_INPUT_MAP_V1 */__u16 export_signal;__u16 reserved;char upatch[64];diff --git a/testing/fixtures/arena-tree-serializer.bpf.c b/testing/fixtures/arena-tree-serializer.bpf.cindex 0262a6f8..d57bff0f 100644--- a/testing/fixtures/arena-tree-serializer.bpf.c+++ b/testing/fixtures/arena-tree-serializer.bpf.c@@ -11,7 +11,7 @@#define BPF_NO_KFUNC_PROTOTYPES#include "vmlinux.h"#include <bpf/bpf_helpers.h>-#include "shirudo_serializer.h"+#include "serializer.h"#define E2BIG 7#define EINVAL 22@@ -74,12 +74,12 @@ enum {TREE_RECORD_SIZE = sizeof(struct tree_record),TREE_SERIAL_BYTES = TREE_NODES * TREE_RECORD_SIZE,TREE_RECORDS_PER_CHUNK =- SHIRUDO_SERIAL_CHUNK_PAYLOAD / TREE_RECORD_SIZE,+ SERIAL_CHUNK_PAYLOAD / TREE_RECORD_SIZE,TREE_RECORDS_PER_PAGE = 64,TREE_PAGE_BYTES = TREE_RECORDS_PER_PAGE * TREE_RECORD_SIZE,TREE_PAGE_CHUNKS =- (TREE_PAGE_BYTES + SHIRUDO_SERIAL_CHUNK_PAYLOAD - 1) /- SHIRUDO_SERIAL_CHUNK_PAYLOAD,+ (TREE_PAGE_BYTES + SERIAL_CHUNK_PAYLOAD - 1) /+ SERIAL_CHUNK_PAYLOAD,TREE_ARENA_PAGES =(sizeof(struct arena_tree_state) + 4095) / 4096,};@@ -101,9 +101,9 @@ static __always_inline void set_error(struct shirudo_serialize_ctx *ctx,chunk = bpf_map_lookup_elem(&shirudo_ser, &key);if (!chunk)return;- chunk->magic = SHIRUDO_SERIAL_MAGIC;- chunk->version = SHIRUDO_SERIAL_VERSION;- chunk->flags = SHIRUDO_SERIAL_F_DONE;+ chunk->magic = SERIAL_MAGIC;+ chunk->version = SERIAL_VERSION;+ chunk->flags = SERIAL_F_DONE;chunk->status = status;chunk->chunk_index = 0;chunk->total_chunks = 1;@@ -125,8 +125,8 @@ static __always_inline int init_page_chunks(__u32 records, __u32 flags,__u32 total_chunks;__u32 i;- total_chunks = (page_bytes + SHIRUDO_SERIAL_CHUNK_PAYLOAD - 1) /- SHIRUDO_SERIAL_CHUNK_PAYLOAD;+ total_chunks = (page_bytes + SERIAL_CHUNK_PAYLOAD - 1) /+ SERIAL_CHUNK_PAYLOAD;if (total_chunks == 0)total_chunks = 1;@@ -134,15 +134,15 @@ static __always_inline int init_page_chunks(__u32 records, __u32 flags,struct shirudo_serial_chunk *chunk;__u32 key = i;__u32 used = page_bytes -- i * SHIRUDO_SERIAL_CHUNK_PAYLOAD;+ i * SERIAL_CHUNK_PAYLOAD;chunk = bpf_map_lookup_elem(&shirudo_ser, &key);if (!chunk)return -ENOSPC;- if (used > SHIRUDO_SERIAL_CHUNK_PAYLOAD)- used = SHIRUDO_SERIAL_CHUNK_PAYLOAD;- chunk->magic = SHIRUDO_SERIAL_MAGIC;- chunk->version = SHIRUDO_SERIAL_VERSION;+ if (used > SERIAL_CHUNK_PAYLOAD)+ used = SERIAL_CHUNK_PAYLOAD;+ chunk->magic = SERIAL_MAGIC;+ chunk->version = SERIAL_VERSION;chunk->flags = flags;chunk->status = 0;chunk->chunk_index = i;@@ -217,9 +217,9 @@ int shirudo_serialize__tree_arena(struct shirudo_serialize_ctx *ctx)__u64 next_cursor;int rc;- if (!ctx || ctx->magic != SHIRUDO_SERIAL_MAGIC ||- ctx->version != SHIRUDO_SERIAL_VERSION ||- ctx->chunk_payload_size != SHIRUDO_SERIAL_CHUNK_PAYLOAD ||+ if (!ctx || ctx->magic != SERIAL_MAGIC ||+ ctx->version != SERIAL_VERSION ||+ ctx->chunk_payload_size != SERIAL_CHUNK_PAYLOAD ||ctx->invocation_id == 0)return -EINVAL;if (ctx->max_chunks < TREE_PAGE_CHUNKS) {@@ -244,7 +244,7 @@ int shirudo_serialize__tree_arena(struct shirudo_serialize_ctx *ctx)next_cursor = start + records;if (next_cursor >= TREE_NODES)- flags = SHIRUDO_SERIAL_F_DONE;+ flags = SERIAL_F_DONE;rc = init_page_chunks(records, flags, ctx->page_index, ctx->cursor,next_cursor, ctx->invocation_id);diff --git a/testing/fixtures/map-export.bpf.c b/testing/fixtures/map-export.bpf.cindex c52b8927..866a1e91 100644--- a/testing/fixtures/map-export.bpf.c+++ b/testing/fixtures/map-export.bpf.c@@ -2,7 +2,7 @@#include "vmlinux.h"#include <bpf/bpf_helpers.h>#include <bpf/bpf_tracing.h>-#include "shirudo_decoder.h"+#include "decoder.h"char _license[] SEC("license") = "Dual BSD/GPL";@@ -21,12 +21,12 @@ struct {} second SEC(".maps");const struct shirudo_decoder_manifest first_decoder SEC(".rodata") = {- .magic = SHIRUDO_DECODER_MANIFEST_MAGIC,- .version = SHIRUDO_UPATCH_DECODER_VERSION,- .language = SHIRUDO_UPATCH_DECODER_LANG_LUA,+ .magic = DECODER_MANIFEST_MAGIC,+ .version = UPATCH_DECODER_VERSION,+ .language = UPATCH_DECODER_LANG_LUA,.api_version = 1,- .input_format = SHIRUDO_UPATCH_DECODER_INPUT_MAP_V1,- .export_signal = SHIRUDO_UPATCH_DECODER_EXPORT_LOG,+ .input_format = UPATCH_DECODER_INPUT_MAP_V1,+ .export_signal = UPATCH_DECODER_EXPORT_LOG,.upatch = "shirudo-test-map-export",.map = "first",.source = "decoders/first.lua",@@ -34,12 +34,12 @@ const struct shirudo_decoder_manifest first_decoder SEC(".rodata") = {};const struct shirudo_decoder_manifest second_decoder SEC(".rodata") = {- .magic = SHIRUDO_DECODER_MANIFEST_MAGIC,- .version = SHIRUDO_UPATCH_DECODER_VERSION,- .language = SHIRUDO_UPATCH_DECODER_LANG_LUA,+ .magic = DECODER_MANIFEST_MAGIC,+ .version = UPATCH_DECODER_VERSION,+ .language = UPATCH_DECODER_LANG_LUA,.api_version = 1,- .input_format = SHIRUDO_UPATCH_DECODER_INPUT_MAP_V1,- .export_signal = SHIRUDO_UPATCH_DECODER_EXPORT_METRIC,+ .input_format = UPATCH_DECODER_INPUT_MAP_V1,+ .export_signal = UPATCH_DECODER_EXPORT_METRIC,.upatch = "shirudo-test-map-export",.map = "second",.source = "decoders/second.lua",diff --git a/testing/fixtures/otel-backend.bpf.c b/testing/fixtures/otel-backend.bpf.cindex 9191bf6f..a7df7540 100644--- a/testing/fixtures/otel-backend.bpf.c+++ b/testing/fixtures/otel-backend.bpf.c@@ -2,7 +2,7 @@#include "vmlinux.h"#include <bpf/bpf_helpers.h>#include <bpf/bpf_tracing.h>-#include "shirudo_decoder.h"+#include "decoder.h"char _license[] SEC("license") = "Dual BSD/GPL";@@ -21,12 +21,12 @@ struct {} backend_metric SEC(".maps");const struct shirudo_decoder_manifest log_decoder SEC(".rodata") = {- .magic = SHIRUDO_DECODER_MANIFEST_MAGIC,- .version = SHIRUDO_UPATCH_DECODER_VERSION,- .language = SHIRUDO_UPATCH_DECODER_LANG_LUA,+ .magic = DECODER_MANIFEST_MAGIC,+ .version = UPATCH_DECODER_VERSION,+ .language = UPATCH_DECODER_LANG_LUA,.api_version = 1,- .input_format = SHIRUDO_UPATCH_DECODER_INPUT_MAP_V1,- .export_signal = SHIRUDO_UPATCH_DECODER_EXPORT_LOG,+ .input_format = UPATCH_DECODER_INPUT_MAP_V1,+ .export_signal = UPATCH_DECODER_EXPORT_LOG,.upatch = "shirudo-test-otel-backend",.map = "backend_log",.source = "decoders/log.lua",@@ -34,12 +34,12 @@ const struct shirudo_decoder_manifest log_decoder SEC(".rodata") = {};const struct shirudo_decoder_manifest metric_decoder SEC(".rodata") = {- .magic = SHIRUDO_DECODER_MANIFEST_MAGIC,- .version = SHIRUDO_UPATCH_DECODER_VERSION,- .language = SHIRUDO_UPATCH_DECODER_LANG_LUA,+ .magic = DECODER_MANIFEST_MAGIC,+ .version = UPATCH_DECODER_VERSION,+ .language = UPATCH_DECODER_LANG_LUA,.api_version = 1,- .input_format = SHIRUDO_UPATCH_DECODER_INPUT_MAP_V1,- .export_signal = SHIRUDO_UPATCH_DECODER_EXPORT_METRIC,+ .input_format = UPATCH_DECODER_INPUT_MAP_V1,+ .export_signal = UPATCH_DECODER_EXPORT_METRIC,.upatch = "shirudo-test-otel-backend",.map = "backend_metric",.source = "decoders/metric.lua",diff --git a/testing/fixtures/serialized-metric.bpf.c b/testing/fixtures/serialized-metric.bpf.cindex 60eae0b6..cb2bf51a 100644--- a/testing/fixtures/serialized-metric.bpf.c+++ b/testing/fixtures/serialized-metric.bpf.c@@ -1,8 +1,8 @@// SPDX-License-Identifier: GPL-2.0 OR BSD-2-Clause#include "vmlinux.h"#include <bpf/bpf_helpers.h>-#include "shirudo_decoder.h"-#include "shirudo_serializer.h"+#include "decoder.h"+#include "serializer.h"#define EINVAL 22@@ -38,12 +38,12 @@ struct {} counter_state SEC(".maps");const struct shirudo_decoder_manifest counters_decoder SEC(".rodata") = {- .magic = SHIRUDO_DECODER_MANIFEST_MAGIC,- .version = SHIRUDO_UPATCH_DECODER_VERSION,- .language = SHIRUDO_UPATCH_DECODER_LANG_LUA,+ .magic = DECODER_MANIFEST_MAGIC,+ .version = UPATCH_DECODER_VERSION,+ .language = UPATCH_DECODER_LANG_LUA,.api_version = 1,- .input_format = SHIRUDO_UPATCH_DECODER_INPUT_MAP_V1,- .export_signal = SHIRUDO_UPATCH_DECODER_EXPORT_METRIC,+ .input_format = UPATCH_DECODER_INPUT_MAP_V1,+ .export_signal = UPATCH_DECODER_EXPORT_METRIC,.upatch = "shirudo-test-serialized-metric",.map = "counters",.source = "decoders/counters.lua",@@ -60,9 +60,9 @@ int shirudo_serialize__counters(struct shirudo_serialize_ctx *ctx)__u32 state_key = 0;__u32 key;- if (!ctx || ctx->magic != SHIRUDO_SERIAL_MAGIC ||- ctx->version != SHIRUDO_SERIAL_VERSION || ctx->max_chunks < 1 ||- ctx->chunk_payload_size != SHIRUDO_SERIAL_CHUNK_PAYLOAD ||+ if (!ctx || ctx->magic != SERIAL_MAGIC ||+ ctx->version != SERIAL_VERSION || ctx->max_chunks < 1 ||+ ctx->chunk_payload_size != SERIAL_CHUNK_PAYLOAD ||ctx->page_index > 1 || ctx->cursor != ctx->page_index ||ctx->invocation_id == 0)return -EINVAL;@@ -93,13 +93,13 @@ int shirudo_serialize__counters(struct shirudo_serialize_ctx *ctx)record.packets = value->packets;record.bytes = value->bytes;__builtin_memcpy(&chunk->data[0], &record, sizeof(record));- if (!(ctx->flags & SHIRUDO_SERIAL_CTX_F_PEEK)) {+ if (!(ctx->flags & SERIAL_CTX_F_PEEK)) {value->packets = 0;value->bytes = 0;}- chunk->magic = SHIRUDO_SERIAL_MAGIC;- chunk->version = SHIRUDO_SERIAL_VERSION;- chunk->flags = ctx->page_index == 1 ? SHIRUDO_SERIAL_F_DONE : 0;+ chunk->magic = SERIAL_MAGIC;+ chunk->version = SERIAL_VERSION;+ chunk->flags = ctx->page_index == 1 ? SERIAL_F_DONE : 0;chunk->status = 0;chunk->chunk_index = 0;chunk->total_chunks = 1;diff --git a/testing/functional/tamperproof/t6003-tamper-points.sh b/testing/functional/tamperproof/t6003-tamper-points.shindex f710df26..bbe4cbda 100755--- a/testing/functional/tamperproof/t6003-tamper-points.sh+++ b/testing/functional/tamperproof/t6003-tamper-points.sh@@ -3,7 +3,7 @@# Copyright (c) 2026 Authors of shirudo## t6003 -- the tamper points are the one enum the LSM counts with and-# status names them from (bpf/lib/shirudo_tamper.h), and a counter is+# status names them from (bpf/lib/tamper.h), and a counter is# only as good as its name; this keeps every member in the table of# names and meanings util/tamper.c holds. Also checks that status# reports the counters as absent, not as an error, where init has not@@ -18,7 +18,7 @@ trap 'rm -rf "$W"' EXITtest_expect_success 'every point has a name and a meaning' 'sed -n "s/^\tSHIRUDO_TAMPER_\([A-Z_]*\),$/\1/p" \- ../bpf/lib/shirudo_tamper.h >"$W/points" &&+ ../bpf/lib/tamper.h >"$W/points" &&sed -n "s/^\t\[SHIRUDO_TAMPER_\([A-Z_]*\)\] = { \"[A-Za-z]*\",$/\1/p" \../util/tamper.c >"$W/table" &&[ -s "$W/points" ] &&diff --git a/testing/functional/upatch/t3002-upatch-decoders.sh b/testing/functional/upatch/t3002-upatch-decoders.shindex 49faa514..bb28c8ba 100755--- a/testing/functional/upatch/t3002-upatch-decoders.sh+++ b/testing/functional/upatch/t3002-upatch-decoders.sh@@ -55,7 +55,7 @@ cat > "$WORK/t.bpf.c" <<'EOF'#include "vmlinux.h"#include <bpf/bpf_helpers.h>#include <bpf/bpf_tracing.h>-#include "shirudo_decoder.h"+#include "decoder.h"char _license[] SEC("license") = "Dual BSD/GPL";@@ -67,12 +67,12 @@ struct {} t0005_map SEC(".maps");const struct shirudo_decoder_manifest t0005_decoder SEC(".rodata") = {- .magic = SHIRUDO_DECODER_MANIFEST_MAGIC,- .version = SHIRUDO_UPATCH_DECODER_VERSION,- .language = SHIRUDO_UPATCH_DECODER_LANG_LUA,+ .magic = DECODER_MANIFEST_MAGIC,+ .version = UPATCH_DECODER_VERSION,+ .language = UPATCH_DECODER_LANG_LUA,.api_version = 1,- .input_format = SHIRUDO_UPATCH_DECODER_INPUT_MAP_V1,- .export_signal = SHIRUDO_UPATCH_DECODER_EXPORT_LOG,+ .input_format = UPATCH_DECODER_INPUT_MAP_V1,+ .export_signal = UPATCH_DECODER_EXPORT_LOG,.upatch = "t3002",.map = "t0005_map",.source = "decoders/t3002.lua",diff --git a/testing/functional/upatch/t3004-upatch-serializer-metadata.sh b/testing/functional/upatch/t3004-upatch-serializer-metadata.shindex 446512d0..facc4f3f 100644--- a/testing/functional/upatch/t3004-upatch-serializer-metadata.sh+++ b/testing/functional/upatch/t3004-upatch-serializer-metadata.sh@@ -47,7 +47,7 @@ test_expect_success 'arena serializer upatch carries UPGM serializer metadata' 'cat >"$WORK/no-output.bpf.c" <<'EOF'#include "vmlinux.h"#include <bpf/bpf_helpers.h>-#include "shirudo_serializer.h"+#include "serializer.h"char _license[] SEC("license") = "Dual BSD/GPL";struct {__uint(type, BPF_MAP_TYPE_ARRAY);@@ -64,7 +64,7 @@ EOFcat >"$WORK/missing-target.bpf.c" <<'EOF'#include "vmlinux.h"#include <bpf/bpf_helpers.h>-#include "shirudo_serializer.h"+#include "serializer.h"char _license[] SEC("license") = "Dual BSD/GPL";struct {__uint(type, BPF_MAP_TYPE_ARRAY);@@ -81,7 +81,7 @@ EOFcat >"$WORK/reserved-target.bpf.c" <<'EOF'#include "vmlinux.h"#include <bpf/bpf_helpers.h>-#include "shirudo_serializer.h"+#include "serializer.h"char _license[] SEC("license") = "Dual BSD/GPL";struct {__uint(type, BPF_MAP_TYPE_ARRAY);diff --git a/testing/fuzz/fuzz-decoder.c b/testing/fuzz/fuzz-decoder.cindex 91ce4043..a06f5006 100644--- a/testing/fuzz/fuzz-decoder.c+++ b/testing/fuzz/fuzz-decoder.c@@ -88,7 +88,7 @@ int LLVMFuzzerTestOneInput(const __u8 *data, size_t size)return 0;memcpy(page.data, data, size);page.bytes = (__u32)size;- page.chunks = size ? (__u32)((size - 1) / SHIRUDO_SERIAL_CHUNK_PAYLOAD + 1) : 1;+ page.chunks = size ? (__u32)((size - 1) / SERIAL_CHUNK_PAYLOAD + 1) : 1;page.done = true;v.serial_pages = &page;v.serial_bytes_total = size;diff --git a/testing/helper/test-otel-map.c b/testing/helper/test-otel-map.cindex ab646423..6336ec66 100644--- a/testing/helper/test-otel-map.c+++ b/testing/helper/test-otel-map.c@@ -118,15 +118,15 @@ static int make_decoder(bool metric, bool counter, bool snapshot,/* The sections start at odd offsets: build them aligned, then copy. */blob.magic = htole32(UPATCH_DECODER_MAGIC);- blob.version = htole32(SHIRUDO_UPATCH_DECODER_VERSION);+ blob.version = htole32(UPATCH_DECODER_VERSION);blob.nr_decoders = htole32(1);memcpy(file + data_off, &blob, sizeof(blob));- entry.language = htole32(SHIRUDO_UPATCH_DECODER_LANG_LUA);+ entry.language = htole32(UPATCH_DECODER_LANG_LUA);entry.api_version = htole32(1);- entry.input_format = htole32(SHIRUDO_UPATCH_DECODER_INPUT_MAP_V1);+ entry.input_format = htole32(UPATCH_DECODER_INPUT_MAP_V1);entry.export_signal = htole32(metric ?- SHIRUDO_UPATCH_DECODER_EXPORT_METRIC :- SHIRUDO_UPATCH_DECODER_EXPORT_LOG);+ UPATCH_DECODER_EXPORT_METRIC :+ UPATCH_DECODER_EXPORT_LOG);strncpy(entry.upatch, "test-upatch", sizeof(entry.upatch) - 1);strncpy(entry.map, "hits_total", sizeof(entry.map) - 1);strncpy(entry.source, "test.lua", sizeof(entry.source) - 1);diff --git a/testing/helper/test-upatch-serializer-pages.c b/testing/helper/test-upatch-serializer-pages.cindex f906b561..f232bc6f 100644--- a/testing/helper/test-upatch-serializer-pages.c+++ b/testing/helper/test-upatch-serializer-pages.c@@ -16,7 +16,7 @@#include "json.h"#include "serializer.h"#include "upatch_maps.h"-#include "bpf/lib/shirudo_serializer.h"+#include "bpf/lib/serializer.h"static int fail(const char *msg){@@ -33,8 +33,8 @@ static int check_abi_and_nonce(void){__u64 generated = 0;struct shirudo_serial_chunk chunk = {- .magic = SHIRUDO_SERIAL_MAGIC,- .version = SHIRUDO_SERIAL_VERSION,+ .magic = SERIAL_MAGIC,+ .version = SERIAL_VERSION,.chunk_index = 1,.total_chunks = 2,.bytes_total = 1,@@ -45,10 +45,10 @@ static int check_abi_and_nonce(void).invocation_id = 0x12345678,};- if (SHIRUDO_SERIAL_VERSION != 1 ||+ if (SERIAL_VERSION != 1 ||sizeof(struct shirudo_serialize_ctx) != 40 ||sizeof(struct shirudo_serial_chunk) != 4096 ||- SHIRUDO_SERIAL_CHUNK_PAYLOAD != 4032)+ SERIAL_CHUNK_PAYLOAD != 4032)return fail("serializer v1 ABI layout mismatch");if (serial_chunk_validate(&chunk, 1, 2, 3, 10, 11, 0x12345678) != 0)return fail("valid serializer nonce rejected");@@ -126,7 +126,7 @@ int main(void).page_index = 1,.cursor = 128,.next_cursor = 129,- .flags = SHIRUDO_SERIAL_F_DONE,+ .flags = SERIAL_F_DONE,.chunks = 1,.bytes = sizeof(page1_data),.done = true,diff --git a/tools/shirudo-build/bpm-build.c b/tools/shirudo-build/bpm-build.cindex 25afbac5..ce6914db 100644--- a/tools/shirudo-build/bpm-build.c+++ b/tools/shirudo-build/bpm-build.c@@ -1091,7 +1091,7 @@ static const char *build_shirudo_bpf_include(char *out)if (!realpath("bpf/lib", out))return NULL;- if (strsprintf(header, sizeof(header), "%s/shirudo_serializer.h",+ if (strsprintf(header, sizeof(header), "%s/serializer.h",out) < 0 || access(header, R_OK))return NULL;return out;diff --git a/tools/shirudo-build/compile.c b/tools/shirudo-build/compile.cindex 350d3d5e..43078967 100644--- a/tools/shirudo-build/compile.c+++ b/tools/shirudo-build/compile.c@@ -59,9 +59,9 @@ static const char *locate_shirudo_bpf_headers(void)static const char installed[] = "-I" BPF_INCDIR;struct stat st;- if (stat("./bpf/lib/shirudo_serializer.h", &st) == 0)+ if (stat("./bpf/lib/serializer.h", &st) == 0)return in_tree;- if (stat(BPF_INCDIR "/shirudo_serializer.h", &st) == 0)+ if (stat(BPF_INCDIR "/serializer.h", &st) == 0)return installed;return NULL;}diff --git a/tools/shirudo-build/package.c b/tools/shirudo-build/package.cindex b9b2f8bb..7747c8be 100644--- a/tools/shirudo-build/package.c+++ b/tools/shirudo-build/package.c@@ -26,7 +26,7 @@#include <shirudo/string.h>#include <shirudo/upatch.h>-#include "bpf/lib/shirudo_serializer.h"+#include "bpf/lib/serializer.h"#include "bpm_package.h"#include "elf_target.h"#include "io.h"@@ -843,10 +843,10 @@ static bool parse_decoder_manifest(const __u8 *p, size_t n,if (n < sizeof(*m))return false;if (rd_le32(p + offsetof(struct shirudo_decoder_manifest, magic)) !=- SHIRUDO_DECODER_MANIFEST_MAGIC)+ DECODER_MANIFEST_MAGIC)return false;if (rd_le16(p + offsetof(struct shirudo_decoder_manifest, version)) !=- SHIRUDO_UPATCH_DECODER_VERSION)+ UPATCH_DECODER_VERSION)return false;if (!fixed_cstr_nonempty(m->upatch, sizeof(m->upatch)) ||!fixed_cstr_nonempty(m->map, sizeof(m->map)) ||@@ -955,11 +955,11 @@ static int collect_decoder_manifests(struct bpf_object *obj,if (!parse_decoder_manifest(data + off, data_sz - off,&manifest))continue;- if (manifest.language != SHIRUDO_UPATCH_DECODER_LANG_LUA ||+ if (manifest.language != UPATCH_DECODER_LANG_LUA ||manifest.api_version != 1 ||- manifest.input_format != SHIRUDO_UPATCH_DECODER_INPUT_MAP_V1 ||- (manifest.export_signal != SHIRUDO_UPATCH_DECODER_EXPORT_LOG &&- manifest.export_signal != SHIRUDO_UPATCH_DECODER_EXPORT_METRIC)) {+ manifest.input_format != UPATCH_DECODER_INPUT_MAP_V1 ||+ (manifest.export_signal != UPATCH_DECODER_EXPORT_LOG &&+ manifest.export_signal != UPATCH_DECODER_EXPORT_METRIC)) {pr_err("unsupported decoder ABI for '%s/%s'",manifest.upatch, manifest.map);err = -EOPNOTSUPP;@@ -1024,7 +1024,7 @@ static int build_decoder_blob(const struct decoder_set *set,if (!blob)return -ENOMEM;blob->magic = htole32(UPATCH_DECODER_MAGIC);- blob->version = htole32(SHIRUDO_UPATCH_DECODER_VERSION);+ blob->version = htole32(UPATCH_DECODER_VERSION);blob->nr_decoders = htole32(set->nr_items);blob->reserved = 0;@@ -1127,35 +1127,35 @@ static int validate_serializer_output_map(struct bpf_object *obj)bpf_object__for_each_map(m, obj) {const char *name = bpf_map__name(m);- if (!name || strcmp(name, SHIRUDO_SERIAL_MAP_NAME) != 0)+ if (!name || strcmp(name, SERIAL_MAP_NAME) != 0)continue;if (bpf_map__type(m) != BPF_MAP_TYPE_ARRAY) {pr_err("%s must be BPF_MAP_TYPE_ARRAY",- SHIRUDO_SERIAL_MAP_NAME);+ SERIAL_MAP_NAME);return -EINVAL;}if (bpf_map__key_size(m) != sizeof(__u32)) {pr_err("%s must use a u32 key",- SHIRUDO_SERIAL_MAP_NAME);+ SERIAL_MAP_NAME);return -EINVAL;}if (bpf_map__value_size(m) !=sizeof(struct shirudo_serial_chunk)) {pr_err("%s value must be struct shirudo_serial_chunk",- SHIRUDO_SERIAL_MAP_NAME);+ SERIAL_MAP_NAME);return -EINVAL;}if (bpf_map__max_entries(m) == 0 ||- bpf_map__max_entries(m) > SHIRUDO_SERIAL_MAX_CHUNKS) {+ bpf_map__max_entries(m) > SERIAL_MAX_CHUNKS) {pr_err("%s max_entries must be 1..%u",- SHIRUDO_SERIAL_MAP_NAME,- SHIRUDO_SERIAL_MAX_CHUNKS);+ SERIAL_MAP_NAME,+ SERIAL_MAX_CHUNKS);return -EINVAL;}return 0;}pr_err("serializer upatch requires %s output map",- SHIRUDO_SERIAL_MAP_NAME);+ SERIAL_MAP_NAME);return -EINVAL;}@@ -1237,9 +1237,9 @@ static int build_prog_metadata(struct bpf_object *obj, __u32 nr_progs,err = -EINVAL;goto err_free;}- if (strcmp(ser_map, SHIRUDO_SERIAL_MAP_NAME) == 0) {+ if (strcmp(ser_map, SERIAL_MAP_NAME) == 0) {pr_err("serializer cannot target reserved map %s",- SHIRUDO_SERIAL_MAP_NAME);+ SERIAL_MAP_NAME);err = -EINVAL;goto err_free;}diff --git a/upatches/kernel-obs/kernel-obs.bpf.c b/upatches/kernel-obs/kernel-obs.bpf.cindex aad80dff..e8166610 100644--- a/upatches/kernel-obs/kernel-obs.bpf.c+++ b/upatches/kernel-obs/kernel-obs.bpf.c@@ -12,8 +12,8 @@#include "vmlinux.h"#include <bpf/bpf_helpers.h>#include <bpf/bpf_tracing.h>-#include "shirudo_decoder.h"-#include "shirudo_serializer.h"+#include "decoder.h"+#include "serializer.h"#include "obs_common.h"char _license[] SEC("license") = "Dual BSD/GPL";@@ -42,11 +42,11 @@ OBS_VIEW(file);#define OBS_DECODER(sym, map_name, src, signal) \const struct shirudo_decoder_manifest sym SEC(".rodata") = { \- .magic = SHIRUDO_DECODER_MANIFEST_MAGIC, \- .version = SHIRUDO_UPATCH_DECODER_VERSION, \- .language = SHIRUDO_UPATCH_DECODER_LANG_LUA, \+ .magic = DECODER_MANIFEST_MAGIC, \+ .version = UPATCH_DECODER_VERSION, \+ .language = UPATCH_DECODER_LANG_LUA, \.api_version = 1, \- .input_format = SHIRUDO_UPATCH_DECODER_INPUT_MAP_V1, \+ .input_format = UPATCH_DECODER_INPUT_MAP_V1, \.export_signal = signal, \.upatch = "kernel-obs", \.map = map_name, \@@ -55,23 +55,23 @@ OBS_VIEW(file);}OBS_DECODER(exec_decoder, "exec", "decoders/exec.lua",- SHIRUDO_UPATCH_DECODER_EXPORT_LOG);+ UPATCH_DECODER_EXPORT_LOG);OBS_DECODER(net_decoder, "net", "decoders/net.lua",- SHIRUDO_UPATCH_DECODER_EXPORT_LOG);+ UPATCH_DECODER_EXPORT_LOG);OBS_DECODER(socket_decoder, "socket", "decoders/socket.lua",- SHIRUDO_UPATCH_DECODER_EXPORT_LOG);+ UPATCH_DECODER_EXPORT_LOG);OBS_DECODER(listen_decoder, "listen", "decoders/listen.lua",- SHIRUDO_UPATCH_DECODER_EXPORT_LOG);+ UPATCH_DECODER_EXPORT_LOG);OBS_DECODER(watch_decoder, "watch", "decoders/watch.lua",- SHIRUDO_UPATCH_DECODER_EXPORT_LOG);+ UPATCH_DECODER_EXPORT_LOG);OBS_DECODER(dns_decoder, "dns", "decoders/dns.lua",- SHIRUDO_UPATCH_DECODER_EXPORT_LOG);+ UPATCH_DECODER_EXPORT_LOG);OBS_DECODER(priv_decoder, "priv", "decoders/priv.lua",- SHIRUDO_UPATCH_DECODER_EXPORT_LOG);+ UPATCH_DECODER_EXPORT_LOG);OBS_DECODER(file_decoder, "file", "decoders/file.lua",- SHIRUDO_UPATCH_DECODER_EXPORT_LOG);+ UPATCH_DECODER_EXPORT_LOG);OBS_DECODER(watch_stat_decoder, "watch_stat", "decoders/watch_stat.lua",- SHIRUDO_UPATCH_DECODER_EXPORT_METRIC);+ UPATCH_DECODER_EXPORT_METRIC);#include "obs_priv.bpf.c"#include "obs_exec.bpf.c"diff --git a/upatches/kernel-obs/obs_common.h b/upatches/kernel-obs/obs_common.hindex c12026d1..522ded2d 100644--- a/upatches/kernel-obs/obs_common.h+++ b/upatches/kernel-obs/obs_common.h@@ -5,7 +5,7 @@#include <bpf/bpf_core_read.h>#include <bpf/bpf_endian.h>-#include "shirudo_misc.h"+#include "misc.h"#if !defined(__BPF_FEATURE_ADDR_SPACE_CAST)#error "BPF arena access requires clang address-space cast support"@@ -40,7 +40,7 @@#define OBS_REC_F_PRESENT (1u << 0)/* ctx->flags bit the exporter sets to read without draining. */-#define OBS_CTX_F_PEEK SHIRUDO_SERIAL_CTX_F_PEEK+#define OBS_CTX_F_PEEK SERIAL_CTX_F_PEEKenum obs_touch_status {OBS_TOUCH_HIT = 0,@@ -369,9 +369,9 @@ static __always_inline void obs_serial_error(struct shirudo_serialize_ctx *ctx,chunk = bpf_map_lookup_elem(&shirudo_ser, &key);if (!chunk)return;- chunk->magic = SHIRUDO_SERIAL_MAGIC;- chunk->version = SHIRUDO_SERIAL_VERSION;- chunk->flags = SHIRUDO_SERIAL_F_DONE;+ chunk->magic = SERIAL_MAGIC;+ chunk->version = SERIAL_VERSION;+ chunk->flags = SERIAL_F_DONE;chunk->status = status;chunk->chunk_index = 0;chunk->total_chunks = 1;@@ -400,9 +400,9 @@ static __always_inline void obs_emit_bytes(struct shirudo_serial_chunk *chunk,static __always_inline boolobs_serial_ctx_valid(const struct shirudo_serialize_ctx *ctx){- return ctx && ctx->magic == SHIRUDO_SERIAL_MAGIC &&- ctx->version == SHIRUDO_SERIAL_VERSION &&- ctx->chunk_payload_size == SHIRUDO_SERIAL_CHUNK_PAYLOAD;+ return ctx && ctx->magic == SERIAL_MAGIC &&+ ctx->version == SERIAL_VERSION &&+ ctx->chunk_payload_size == SERIAL_CHUNK_PAYLOAD;}#endif /* KERNEL_OBS_COMMON_H */diff --git a/upatches/kernel-obs/obs_dns.bpf.c b/upatches/kernel-obs/obs_dns.bpf.cindex 3283c097..87038b3a 100644--- a/upatches/kernel-obs/obs_dns.bpf.c+++ b/upatches/kernel-obs/obs_dns.bpf.c@@ -187,7 +187,7 @@ obs_dns_emit_name(struct shirudo_serial_chunk *chunk, __u32 base,int i;if (!chunk || !stat ||- base > SHIRUDO_SERIAL_CHUNK_PAYLOAD - sizeof(struct dns_name))+ base > SERIAL_CHUNK_PAYLOAD - sizeof(struct dns_name))return;barrier_var(base);*(__u64 *)&chunk->data[base] = stat->seen;diff --git a/upatches/kernel-obs/obs_table.h b/upatches/kernel-obs/obs_table.hindex 0a47180e..de4fe95e 100644--- a/upatches/kernel-obs/obs_table.h+++ b/upatches/kernel-obs/obs_table.h@@ -20,7 +20,7 @@#define OBS_T_KEY_WORDS (sizeof(OBS_T_KEY) / 8)#define OBS_T_VAL_WORDS (sizeof(OBS_T_VAL) / 8)-#define OBS_T_PER_CHUNK (SHIRUDO_SERIAL_CHUNK_PAYLOAD / OBS_T_RECORD)+#define OBS_T_PER_CHUNK (SERIAL_CHUNK_PAYLOAD / OBS_T_RECORD)#define OBS_T_PER_PAGE (OBS_T_PER_CHUNK * OBS_SERIAL_PAGE_CHUNKS)BUILD_BUG_ON(sizeof(OBS_T_KEY) % 8);@@ -188,7 +188,7 @@ OBS_FN(slot)(__u32 page_slot, __u32 *off_out)return 0;off = slot * OBS_T_RECORD;barrier_var(off);- if (off > SHIRUDO_SERIAL_CHUNK_PAYLOAD - OBS_T_RECORD)+ if (off > SERIAL_CHUNK_PAYLOAD - OBS_T_RECORD)return 0;chunk = bpf_map_lookup_elem(&shirudo_ser, &key);if (!chunk)@@ -208,14 +208,14 @@ static __always_inline int OBS_FN(chunk_meta)(__u32 key, __u32 flags,if (key >= total_chunks)return 0;- used = page_bytes - key * SHIRUDO_SERIAL_CHUNK_PAYLOAD;- if (used > SHIRUDO_SERIAL_CHUNK_PAYLOAD)- used = SHIRUDO_SERIAL_CHUNK_PAYLOAD;+ used = page_bytes - key * SERIAL_CHUNK_PAYLOAD;+ if (used > SERIAL_CHUNK_PAYLOAD)+ used = SERIAL_CHUNK_PAYLOAD;chunk = bpf_map_lookup_elem(&shirudo_ser, &key);if (!chunk)return -ENOSPC;- chunk->magic = SHIRUDO_SERIAL_MAGIC;- chunk->version = SHIRUDO_SERIAL_VERSION;+ chunk->magic = SERIAL_MAGIC;+ chunk->version = SERIAL_VERSION;chunk->flags = flags;chunk->status = 0;chunk->chunk_index = key;@@ -349,7 +349,7 @@ int OBS_CAT(shirudo_serialize__, OBS_T_MAP)(struct shirudo_serialize_ctx *ctx)for (i = 0; i < OBS_SERIAL_PAGE_CHUNKS; i++) {rc = OBS_FN(chunk_meta)(i, 0, OBS_SERIAL_PAGE_CHUNKS,OBS_SERIAL_PAGE_CHUNKS *- SHIRUDO_SERIAL_CHUNK_PAYLOAD,+ SERIAL_CHUNK_PAYLOAD,ctx, ctx->cursor);if (rc) {obs_serial_error(ctx, rc);@@ -385,7 +385,7 @@ int OBS_CAT(shirudo_serialize__, OBS_T_MAP)(struct shirudo_serialize_ctx *ctx)}if (emit.next >= emit.used) {- flags = SHIRUDO_SERIAL_F_DONE;+ flags = SERIAL_F_DONE;if (!peek) {OBS_FN(clear)(state);OBS_FN(lost) = 0;@@ -395,7 +395,7 @@ int OBS_CAT(shirudo_serialize__, OBS_T_MAP)(struct shirudo_serialize_ctx *ctx)OBS_T_PER_CHUNK;if (total_chunks == 0)total_chunks = 1;- page_bytes = (total_chunks - 1) * SHIRUDO_SERIAL_CHUNK_PAYLOAD ++ page_bytes = (total_chunks - 1) * SERIAL_CHUNK_PAYLOAD +(emit.output_slots - (total_chunks - 1) *OBS_T_PER_CHUNK) * OBS_T_RECORD;#pragma clang loop unroll(full)diff --git a/util/identity.h b/util/identity.hindex 4ae87e48..1de8b093 100644--- a/util/identity.h+++ b/util/identity.h@@ -17,7 +17,7 @@/* The most keys the anchor keyring holds; util/keys.h bounds the set. */#define IDENTITY_KEYS_MAX 16-/* The frozen ABI shared with bpf/lib/shirudo_identity.h. */+/* The frozen ABI shared with bpf/lib/identity.h. */struct shirudo_identity {__u32 sb_dev;__u32 run_dev;diff --git a/util/serializer.c b/util/serializer.cindex ba90f2a5..915708d9 100644--- a/util/serializer.c+++ b/util/serializer.c@@ -106,12 +106,12 @@ int serial_chunk_validate(const struct shirudo_serial_chunk *c,{if (!c || invocation_id == 0)return -EINVAL;- if (c->magic != SHIRUDO_SERIAL_MAGIC ||- c->version != SHIRUDO_SERIAL_VERSION)+ if (c->magic != SERIAL_MAGIC ||+ c->version != SERIAL_VERSION)return -EBADMSG;if (c->chunk_index != want_index || c->total_chunks != total_chunks)return -EBADMSG;- if (c->bytes_in_chunk > SHIRUDO_SERIAL_CHUNK_PAYLOAD)+ if (c->bytes_in_chunk > SERIAL_CHUNK_PAYLOAD)return -EBADMSG;if (c->page_index != page_index || c->cursor != cursor ||c->next_cursor != next_cursor ||diff --git a/util/serializer.h b/util/serializer.hindex fc7a64b0..2815481d 100644--- a/util/serializer.h+++ b/util/serializer.h@@ -6,7 +6,7 @@#include <shirudo/misc.h>-#include "bpf/lib/shirudo_serializer.h"+#include "bpf/lib/serializer.h"int serializer_lock_acquire(__u32 map_id);int serializer_lock_acquire_at(const char *dir, __u32 map_id);diff --git a/util/tamper.h b/util/tamper.hindex e13fef38..0ce7311e 100644--- a/util/tamper.h+++ b/util/tamper.h@@ -9,7 +9,7 @@#include <shirudo/misc.h>-#include "bpf/lib/shirudo_tamper.h"+#include "bpf/lib/tamper.h"struct shirudo_tamper_counts {__u64 count[SHIRUDO_TAMPER_MAX];diff --git a/util/upatch.c b/util/upatch.cindex 304d400b..2a738819 100644--- a/util/upatch.c+++ b/util/upatch.c@@ -130,7 +130,7 @@ static bool parse_decoders(struct shirudo_upatch *u, const __u8 *bp,if (decoder_len < sizeof(struct shirudo_upatch_decoder_blob))return false;if (rd_le32(bp) != UPATCH_DECODER_MAGIC ||- rd_le32(bp + 4) != SHIRUDO_UPATCH_DECODER_VERSION)+ rd_le32(bp + 4) != UPATCH_DECODER_VERSION)return false;nr_decoders = rd_le32(bp + 8);diff --git a/util/upatch_decode.c b/util/upatch_decode.cindex a96515d6..70687099 100644--- a/util/upatch_decode.c+++ b/util/upatch_decode.c@@ -92,7 +92,7 @@ int upatch_decode_map_file_otel(const char *path,#include "upatch.h"#include "upatch_decode.h"#include "upatch_maps.h"-#include "bpf/lib/shirudo_serializer.h"+#include "bpf/lib/serializer.h"#define LUA_INSN_LIMIT 1000000#define LUA_HOOK_COUNT 10000@@ -775,10 +775,10 @@ static void lua_split_page_slots(lua_State *L, int slots_idx,__u64 cursor, __u64 chunks,size_t slot_size){- size_t slots_per_chunk = SHIRUDO_SERIAL_CHUNK_PAYLOAD / slot_size;+ size_t slots_per_chunk = SERIAL_CHUNK_PAYLOAD / slot_size;if (chunks > 1 && slots_per_chunk > 0 &&- SHIRUDO_SERIAL_CHUNK_PAYLOAD % slot_size != 0) {+ SERIAL_CHUNK_PAYLOAD % slot_size != 0) {size_t off = 0;__u64 chunk;@@ -786,8 +786,8 @@ static void lua_split_page_slots(lua_State *L, int slots_idx,size_t chunk_bytes = len - off;size_t local_slots, i;- if (chunk_bytes > SHIRUDO_SERIAL_CHUNK_PAYLOAD)- chunk_bytes = SHIRUDO_SERIAL_CHUNK_PAYLOAD;+ if (chunk_bytes > SERIAL_CHUNK_PAYLOAD)+ chunk_bytes = SERIAL_CHUNK_PAYLOAD;local_slots = chunk_bytes / slot_size;if (local_slots > slots_per_chunk)local_slots = slots_per_chunk;@@ -822,7 +822,7 @@ static int lua_shirudo_page_slots(lua_State *L)luaL_checktype(L, 1, LUA_TTABLE);slot_size = lua_check_c_int(L, 2);- if (slot_size <= 0 || slot_size > (int)SHIRUDO_SERIAL_CHUNK_PAYLOAD)+ if (slot_size <= 0 || slot_size > (int)SERIAL_CHUNK_PAYLOAD)return luaL_error(L, "invalid slot size");chunks = lua_page_u64(L, 1, "chunks");lua_getfield(L, 1, "data_hex");@@ -835,13 +835,13 @@ static int lua_shirudo_page_slots(lua_State *L)rc = hex_decode_push(L, hex, hex_len, &data, &data_len);if (rc)return luaL_error(L, "invalid page data_hex");- per_chunk = SHIRUDO_SERIAL_CHUNK_PAYLOAD / (size_t)slot_size;+ per_chunk = SERIAL_CHUNK_PAYLOAD / (size_t)slot_size;lua_newtable(L);while (off < data_len) {size_t chunk_bytes = data_len - off, local_slots, i;- if (chunks > 1 && chunk_bytes > SHIRUDO_SERIAL_CHUNK_PAYLOAD)- chunk_bytes = SHIRUDO_SERIAL_CHUNK_PAYLOAD;+ if (chunks > 1 && chunk_bytes > SERIAL_CHUNK_PAYLOAD)+ chunk_bytes = SERIAL_CHUNK_PAYLOAD;local_slots = chunk_bytes / (size_t)slot_size;if (chunks > 1 && local_slots > per_chunk)local_slots = per_chunk;@@ -1280,11 +1280,11 @@ out_close:static int decoder_matches(const struct upatch_decoder_view *d,const struct shirudo_map_view *v){- if (d->language != SHIRUDO_UPATCH_DECODER_LANG_LUA ||+ if (d->language != UPATCH_DECODER_LANG_LUA ||d->api_version != 1 ||- d->input_format != SHIRUDO_UPATCH_DECODER_INPUT_MAP_V1 ||- (d->export_signal != SHIRUDO_UPATCH_DECODER_EXPORT_LOG &&- d->export_signal != SHIRUDO_UPATCH_DECODER_EXPORT_METRIC))+ d->input_format != UPATCH_DECODER_INPUT_MAP_V1 ||+ (d->export_signal != UPATCH_DECODER_EXPORT_LOG &&+ d->export_signal != UPATCH_DECODER_EXPORT_METRIC))return 0;if (strcmp(d->upatch, v->upatch) != 0)return 0;diff --git a/util/upatch_maps.c b/util/upatch_maps.cindex 01a14525..374ec7e9 100644--- a/util/upatch_maps.c+++ b/util/upatch_maps.c@@ -34,7 +34,7 @@#include "upatch_map_types.h"#include "upatch_maps.h"#include "upatch_resolve.h"-#include "bpf/lib/shirudo_serializer.h"+#include "bpf/lib/serializer.h"/** Per-call recursion bound for the BTF value renderer. Real-world map@@ -60,9 +60,9 @@ static void resolve_map_location(struct shirudo_map_view *v)}#define SERIAL_MAX_BYTES \- (SHIRUDO_SERIAL_MAX_CHUNKS * SHIRUDO_SERIAL_CHUNK_PAYLOAD)+ (SERIAL_MAX_CHUNKS * SERIAL_CHUNK_PAYLOAD)#define SERIAL_MAX_TOTAL_BYTES \- ((__u64)SHIRUDO_SERIAL_MAX_PAGES * SERIAL_MAX_BYTES)+ ((__u64)SERIAL_MAX_PAGES * SERIAL_MAX_BYTES)bool upatch_map_is_percpu(__u32 type){@@ -797,7 +797,7 @@ static int validate_serial_map(const struct bpf_map_info *info)if (info->value_size != sizeof(struct shirudo_serial_chunk))return -EINVAL;if (info->max_entries == 0 ||- info->max_entries > SHIRUDO_SERIAL_MAX_CHUNKS)+ info->max_entries > SERIAL_MAX_CHUNKS)return -E2BIG;return 0;}@@ -858,8 +858,8 @@ static int read_serial_page(int serial_fd,rc = -errno;goto out_chunk;}- if (chunk->magic != SHIRUDO_SERIAL_MAGIC ||- chunk->version != SHIRUDO_SERIAL_VERSION ||+ if (chunk->magic != SERIAL_MAGIC ||+ chunk->version != SERIAL_VERSION ||chunk->invocation_id != invocation_id) {rc = -EBADMSG;goto out_chunk;@@ -875,9 +875,9 @@ static int read_serial_page(int serial_fd,next_cursor = chunk->next_cursor;flags = chunk->flags;if (total_chunks == 0 || total_chunks > serial_info->max_entries ||- total_chunks > SHIRUDO_SERIAL_MAX_CHUNKS ||+ total_chunks > SERIAL_MAX_CHUNKS ||bytes_total > SERIAL_MAX_BYTES ||- bytes_total > total_chunks * SHIRUDO_SERIAL_CHUNK_PAYLOAD) {+ bytes_total > total_chunks * SERIAL_CHUNK_PAYLOAD) {rc = -EBADMSG;goto out_chunk;}@@ -928,7 +928,7 @@ static int read_serial_page(int serial_fd,page->flags = flags;page->chunks = total_chunks;page->bytes = bytes_total;- page->done = (page->flags & SHIRUDO_SERIAL_F_DONE) != 0;+ page->done = (page->flags & SERIAL_F_DONE) != 0;page->data = data;xfree(chunk, sizeof(*chunk));return 0;@@ -948,7 +948,7 @@ static int try_read_serialized(const char *upatch, const char *map,__u32 page_index;int prog_fd = -1, serial_fd = -1, lock_fd = -1, rc;- if (strcmp(map, SHIRUDO_SERIAL_MAP_NAME) == 0)+ if (strcmp(map, SERIAL_MAP_NAME) == 0)return 0;prog_fd = open_serializer_pin(upatch, map);if (prog_fd < 0) {@@ -956,7 +956,7 @@ static int try_read_serialized(const char *upatch, const char *map,return 0;return prog_fd;}- rc = open_map_pin(upatch, SHIRUDO_SERIAL_MAP_NAME,+ rc = open_map_pin(upatch, SERIAL_MAP_NAME,&serial_fd, &serial_info);if (rc)goto out;@@ -978,7 +978,7 @@ static int try_read_serialized(const char *upatch, const char *map,if (rc)goto out;- for (page_index = 0; page_index < SHIRUDO_SERIAL_MAX_PAGES;+ for (page_index = 0; page_index < SERIAL_MAX_PAGES;page_index++) {struct shirudo_serialize_ctx ctx = {};struct shirudo_serial_page page = {};@@ -988,12 +988,12 @@ static int try_read_serialized(const char *upatch, const char *map,if (rc)goto out;- ctx.magic = SHIRUDO_SERIAL_MAGIC;- ctx.version = SHIRUDO_SERIAL_VERSION;+ ctx.magic = SERIAL_MAGIC;+ ctx.version = SERIAL_VERSION;ctx.flags = (flags & MAP_READ_PEEK) ?- SHIRUDO_SERIAL_CTX_F_PEEK : 0;+ SERIAL_CTX_F_PEEK : 0;ctx.max_chunks = serial_info.max_entries;- ctx.chunk_payload_size = SHIRUDO_SERIAL_CHUNK_PAYLOAD;+ ctx.chunk_payload_size = SERIAL_CHUNK_PAYLOAD;ctx.page_index = page_index;ctx.cursor = cursor;ctx.invocation_id = invocation_id;@@ -1005,8 +1005,8 @@ static int try_read_serialized(const char *upatch, const char *map,rc = (__s32)retval;goto out;}- if (ctx.magic != SHIRUDO_SERIAL_MAGIC ||- ctx.version != SHIRUDO_SERIAL_VERSION ||+ if (ctx.magic != SERIAL_MAGIC ||+ ctx.version != SERIAL_VERSION ||ctx.page_index != page_index ||ctx.cursor != cursor ||ctx.invocation_id != invocation_id) {@@ -1354,7 +1354,7 @@ static void scan_upatch_maps(const char *upatch,if (e->d_name[0] == '.')continue;- if (strcmp(e->d_name, SHIRUDO_SERIAL_MAP_NAME) == 0)+ if (strcmp(e->d_name, SERIAL_MAP_NAME) == 0)continue;rc = open_map_pin(upatch, e->d_name, &fd, &info);if (rc)