eBPF-based security platform
Documentation: add docs for sleepable uprobe.multi attachment
Jiri Olsaf185623bf1cb
diff --git a/Documentation/contribute/testing/test-coverage.rst b/Documentation/contribute/testing/test-coverage.rstindex 49ed4ff4..1e6b2cf7 100644--- a/Documentation/contribute/testing/test-coverage.rst+++ b/Documentation/contribute/testing/test-coverage.rst@@ -161,8 +161,9 @@ signed config image.* - ``t3006-cgroup-skb-metadata``- ``cgroup_skb`` ingress and egress attach metadata* - ``t3007-uprobe-multi-metadata``- - ``uprobe.multi`` and ``uretprobe.multi`` globs to file offsets and- the target's build ID, and the uretprobe forms the builder refuses+ - ``uprobe.multi`` and ``uretprobe.multi`` globs, sleepable ``.s``+ forms included, to file offsets and the target's build ID, and the+ uprobe forms the builder refuses* - ``t3008-override-metadata``- kprobe override and ``fmod_ret`` attach metadata* - ``t3009-netfilter-metadata``@@ -189,8 +190,9 @@ signed config image.* - ``t3106-upatch-get``- ``upatch get`` source lines and JSON* - ``t3107-uprobe-multi``- - A live ``uprobe.multi`` load, refusal after a build ID change, and- a live ``uretprobe.multi`` load that runs and unloads+ - A live ``uprobe.multi`` load, refusal after a build ID change, a+ live ``uretprobe.multi`` load that runs and unloads, and a live+ sleepable ``uprobe.multi.s`` load that reads user memory* - ``t3108-status-many``- ``status --json`` with eighty loaded upatches lists all of them* - ``t3109-policy-labels``@@ -662,7 +664,8 @@ Coverage by area- Offline metadata: ``t3006``, ``t3007``, ``t3008``, ``t3009``,``t3010``. Loaded on a target: fentry (fixtures), ``lsm``(``t9101``), ``cgroup_skb`` and netfilter (``t6116``),- ``uprobe.multi`` and ``uretprobe.multi`` (``t3107``)+ ``uprobe.multi``, ``uretprobe.multi`` and ``uprobe.multi.s``+ (``t3107``)* - bpffs pins and mounts- ``t4101``, ``t6105``, ``t6106``, ``t6108``, ``t6120``,``t6121``diff --git a/Documentation/internals/kernel-interfaces.rst b/Documentation/internals/kernel-interfaces.rstindex d7925578..f0a320c8 100644--- a/Documentation/internals/kernel-interfaces.rst+++ b/Documentation/internals/kernel-interfaces.rst@@ -204,7 +204,9 @@ where the caller is the loader.Kind 6, netfilter: ``attach_type`` ``BPF_NETFILTER``, ``pf`` 10(``NFPROTO_IPV6``), ``hooknum`` 0 (``NF_INET_PRE_ROUTING``),``priority`` -450 (``NF_IP6_PRI_RAW_BEFORE_DEFRAG``), ``flags`` 0.- Kinds 7 and 9, ``uprobe.multi`` and ``uretprobe.multi``:+ Kinds 7 and 9, ``uprobe.multi`` and ``uretprobe.multi`` and their+ sleepable ``.s`` forms, whose ``BPF_F_SLEEPABLE`` the signed loader+ sets at load:``attach_type`` ``BPF_TRACE_UPROBE_MULTI``, ``offsets``, ``cnt``,``flags`` ``BPF_F_UPROBE_MULTI_PATH_FD``, with``BPF_F_UPROBE_MULTI_RETURN`` for kind 9, ``path_fd`` a descriptordiff --git a/Documentation/reference/formats/upatch-format.rst b/Documentation/reference/formats/upatch-format.rstindex b1454011..3f6cc64c 100644--- a/Documentation/reference/formats/upatch-format.rst+++ b/Documentation/reference/formats/upatch-format.rst@@ -426,13 +426,15 @@ Each program entry is 160 bytes:- ``netfilter``* - 7- uprobe.multi- - ``uprobe.multi/<absolute-path>:<function-glob>``+ - ``uprobe.multi/<absolute-path>:<function-glob>``,+ ``uprobe.multi.s/<absolute-path>:<function-glob>``* - 8- native XDP device classes- ``xdp/<decimal-mask>``* - 9- uretprobe.multi- - ``uretprobe.multi/<absolute-path>:<function-glob>``+ - ``uretprobe.multi/<absolute-path>:<function-glob>``,+ ``uretprobe.multi.s/<absolute-path>:<function-glob>``:doc:`/upatches/write/attach-kinds` describes how the target attaches each kind.XDP retains the 160-byte entry and UPGM version 1; readers that do notdiff --git a/Documentation/upatches/test/testing.rst b/Documentation/upatches/test/testing.rstindex 6634082a..49af8ca9 100644--- a/Documentation/upatches/test/testing.rst+++ b/Documentation/upatches/test/testing.rst@@ -193,6 +193,10 @@ one.* - ``shirudo-test-uretprobe-multi``- ``uretprobe.multi`` on the same binary and functions, counting inthe map ``hits``+ * - ``shirudo-test-uprobe-multi-sleepable``+ - sleepable ``uprobe.multi.s`` on the same binary and functions,+ counting in ``hits`` each call whose ``bpf_copy_from_user()`` of the+ task's arguments succeeds* - ``shirudo-test-scope-cgroup``, ``shirudo-test-scope-netfilter``,``shirudo-test-scope-kprobe``- ``cgroup_skb``, ``netfilter`` and ``kprobe`` attachments and thediff --git a/Documentation/upatches/write/attach-kinds.rst b/Documentation/upatches/write/attach-kinds.rstindex 4e820791..3c4f6959 100644--- a/Documentation/upatches/write/attach-kinds.rst+++ b/Documentation/upatches/write/attach-kinds.rst@@ -52,12 +52,13 @@ the link against the metadata and pins it.- kprobe- as ``kprobe``, with the return-probe bit set- ``CONFIG_KPROBES``, ``CONFIG_KPROBE_EVENTS``- * - ``uprobe.multi/<path>:<glob>``+ * - ``uprobe.multi/<path>:<glob>``, ``uprobe.multi.s/<path>:<glob>``- kprobe- ``BPF_LINK_CREATE``, ``BPF_TRACE_UPROBE_MULTI``,``BPF_F_UPROBE_MULTI_PATH_FD``- ``CONFIG_UPROBE_EVENTS``- * - ``uretprobe.multi/<path>:<glob>``+ * - ``uretprobe.multi/<path>:<glob>``,+ ``uretprobe.multi.s/<path>:<glob>``- kprobe- as ``uprobe.multi``, with ``BPF_F_UPROBE_MULTI_RETURN``- ``CONFIG_UPROBE_EVENTS``@@ -209,6 +210,12 @@ any BPF is loaded. shirudo keeps that descriptor open and attaches with``uretprobe.multi``, so the probes land in the inode it checked, not inwhatever the path names later. There is no path fallback.+``uprobe.multi.s`` and ``uretprobe.multi.s`` declare sleepable programs,+which may call ``bpf_copy_from_user()`` and fault in the user memory they+read. They take the same attach kinds, 7 and 9: ``BPF_F_SLEEPABLE`` is a+load flag the signed loader sets, so the signature covers it, and the+target attaches them as it does the others.+.. list-table:::header-rows: 1:widths: 40 60@@ -602,11 +609,11 @@ it generates a loader.- ``unsupported kprobe section '<section>'; use kprobe/<symbol> orkretprobe/<symbol>``* - ``uprobe``, ``uprobe/*``, ``uretprobe``, ``uretprobe/*``, other- ``uprobe.*`` and ``uretprobe.*`` forms, the sleepable- ``uprobe.multi.s`` and ``uretprobe.multi.s`` among them+ ``uprobe.*`` and ``uretprobe.*`` forms, ``uprobe.session`` and+ ``uprobe.session.s`` among them- ``unsupported uprobe section '<section>'; use- uprobe.multi//absolute/path:function_glob or- uretprobe.multi//absolute/path:function_glob``+ uprobe.multi[.s]//absolute/path:function_glob or+ uretprobe.multi[.s]//absolute/path:function_glob``* - ``sk_skb``, ``sk_skb/*``- ``unsupported sk_skb section '<section>'; supported network packetsections are cgroup_skb/ingress, cgroup_skb/egress, and netfilter``@@ -622,8 +629,8 @@ it generates a loader.* - every other section, ``tp/``, ``raw_tp/``, ``xdp`` and ``tc`` amongthem- ``unsupported section '<section>'; supported are fentry, fexit,- fmod_ret, lsm, tp_btf, kprobe, kretprobe, uprobe.multi,- uretprobe.multi, cgroup_skb, netfilter and xdp/<mask>``+ fmod_ret, lsm, tp_btf, kprobe, kretprobe, uprobe.multi[.s],+ uretprobe.multi[.s], cgroup_skb, netfilter and xdp/<mask>``* - ``syscall`` with another program name- ``SEC("syscall") program '<name>' must be named shirudo_test__<id>``