Skip to content

eBPF-based security platform

upatches/kernel-obs: give kernel-obs a tree entry

John Fastabendc26e19f321c5
diff --git a/Documentation/reference/formats/beefile.rst b/Documentation/reference/formats/beefile.rst
index 9cc2a271..9a288adc 100644
--- a/Documentation/reference/formats/beefile.rst
+++ b/Documentation/reference/formats/beefile.rst
@@ -641,7 +641,9 @@ Generated data
:src:`upatches/kernel-obs/Beefile` declares two upatches, one with two
generated ``.rodata`` variables, and ships the generators and their
-input beside them. It has no tree entry: it is installed with ``bpm
+input beside them. The tree entry of the first has no selector, so
+every node that follows a tree it is appended to loads ``kernel-obs``;
+``userns-unshare-counter`` has none and is installed with ``bpm
install``.
.. literalinclude:: ../../../upatches/kernel-obs/Beefile
diff --git a/testing/end2end/operator.sh b/testing/end2end/operator.sh
index 0c456eec..95d07f4c 100755
--- a/testing/end2end/operator.sh
+++ b/testing/end2end/operator.sh
@@ -123,10 +123,7 @@ publish() {
rm -rf "$W"
mkdir -p "$W/pkg"
cp -R "$REPO/upatches/kernel-obs" "$W/pkg/kernel-obs"
- sed -i '/^source = "kernel-obs.bpf.c"$/a\
-\
-[upatches.tree]\
-id = "kernel-obs"\
+ sed -i '/^id = "kernel-obs"$/a\
\
[upatches.tree.selector.labels]\
role = ["edge"]' "$W/pkg/kernel-obs/Beefile"
diff --git a/upatches/kernel-obs/Beefile b/upatches/kernel-obs/Beefile
index b50827b7..11e78426 100644
--- a/upatches/kernel-obs/Beefile
+++ b/upatches/kernel-obs/Beefile
@@ -19,6 +19,9 @@ input = "watch.list"
generator = ["python3", "gen_watch_rodata.py"]
update = ["python3", "gen_watch_rodata.py"]
+[upatches.tree]
+id = "kernel-obs"
+
[[upatches]]
source = "userns-unshare-counter.bpf.c"
diff --git a/upatches/kernel-obs/README.md b/upatches/kernel-obs/README.md
index e4797535..42416562 100644
--- a/upatches/kernel-obs/README.md
+++ b/upatches/kernel-obs/README.md
@@ -47,6 +47,15 @@ sudo shirudo upatch list
`shirudo bpm info "$PACKAGE"` prints this document without installing.
+The Beefile has a tree entry for `kernel-obs`, without a selector, so
+a signed upatch tree can take it and every node that syncs the tree
+loads it. `userns-unshare-counter` has none and reaches a node with
+`bpm install` alone:
+
+```sh
+shirudo bpm tree append kernel-obs-<version>.bee oci://<registry>/<tree> --keys-dir <keys>
+```
+
## Tables
To inspect the unshare counter, use `shirudo upatch map