Skip to content

eBPF-based security platform

docs: say what an XDP load does with no device, and where it pins

Daniel Borkmann23467cc598ea
diff --git a/Documentation/internals/kernel-interfaces.rst b/Documentation/internals/kernel-interfaces.rst
index c2bfe124..ffba798f 100644
--- a/Documentation/internals/kernel-interfaces.rst
+++ b/Documentation/internals/kernel-interfaces.rst
@@ -228,12 +228,14 @@ where the caller is the loader.
0. Uprobe multi: offset count and the return flag. ``fmod_ret``:
``BPF_MODIFY_RETURN``.
XDP: ``BPF_LINK_TYPE_XDP`` and ``xdp.ifindex`` matching the selected
- device; the initial namespace, device class and peer scope are
- rechecked around attachment.
+ device; the device class and peer scope are rechecked around
+ attachment, and the initial network namespace once before the
+ devices are read.
* - ``BPF_OBJ_PIN``
- Links at ``upatches/<name>/link`` or ``link_<n>``, serializer
programs at ``serializers/<map>``, the test-run program at
- ``test``, maps at ``maps/<map>``, under ``/run/shirudo/bpffs``.
+ ``test``, each XDP program at ``xdp_prog_<n>``, maps at
+ ``maps/<map>``, under ``/run/shirudo/bpffs``.
A kprobe link's perf event comes from ``perf_event_open(2)`` with
``type`` read from ``/sys/bus/event_source/devices/kprobe/type``,
diff --git a/Documentation/internals/signed-loader.rst b/Documentation/internals/signed-loader.rst
index cced5850..35410fe9 100644
--- a/Documentation/internals/signed-loader.rst
+++ b/Documentation/internals/signed-loader.rst
@@ -156,15 +156,19 @@ buffer, and the command attaches and pins them. Links are created in
userspace because gen_loader emits no link creation and
``bpf_sys_bpf()`` has no ``BPF_OBJ_PIN``. Each link is pinned at
``/run/shirudo/bpffs/upatches/<name>/link``, or ``link_<n>`` for several,
-serializers under ``serializers/`` and maps under ``maps/`` beside it. A
-dot in the name is written as ``~d`` there. The directory carries the
+serializers under ``serializers/``, maps under ``maps/`` and the test-run
+program at ``test`` beside it. A dot in the name is written as ``~d``
+there. The directory carries the
``security.bpf.shirudo.payload`` extended attribute with the payload
digest, which only a task with runtime authority can set.
:doc:`kernel-interfaces` lists the attributes each call sets.
Artifacts containing XDP always use ``link_<n>`` pins, including when only
-one link is created. Every XDP program must attach somewhere; unsupported
-native-XDP devices are skipped, and any other attachment failure removes
-all links the load created.
+one link is created, and pin each XDP program at ``xdp_prog_<n>``, which
+keeps it loaded while no device matches its class mask. A load that finds
+no matching device succeeds and attaches nothing until ``upatch
+reconcile`` finds one. Devices without native XDP, and devices that
+vanish or change during the attach, are skipped; any other attachment
+failure removes all links the load created.
Telling the loader apart from root
----------------------------------