From 7c97d670c44edd6eee772ec47d77847d85f8a7a7 Mon Sep 17 00:00:00 2001 From: Paul Chaignon Date: Wed, 6 Sep 2023 15:40:33 +0200 Subject: sys/linux: cover multi-uprobes for BPF_LINK_CREATE Upstream, commit [1] added support for multi-uprobe links, to speed up the attachment of uprobes BPF programs by attaching in batches. This commit covers the same in syzkaller. Field path is a path to the binary, offsets are the offsets to attach to in the binary, and cnt is the number of uprobes to attach to. Field ref_ctr_offsets is a bit trickier as it can point to an array of reference counters; I limited those to 0--5 as they are not expected to be large. 1 - https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=89ae89f53d2011435 Signed-off-by: Paul Chaignon --- sys/linux/bpf.txt | 12 ++++++++++++ sys/linux/bpf.txt.const | 1 + 2 files changed, 13 insertions(+) (limited to 'sys') diff --git a/sys/linux/bpf.txt b/sys/linux/bpf.txt index 514e614d1..637759c70 100644 --- a/sys/linux/bpf.txt +++ b/sys/linux/bpf.txt @@ -236,6 +236,16 @@ link_create_tcx { exp_revision bpf_revision } +link_create_uprobe_multi { + path ptr64[in, filename] + offsets ptr64[in, array[int64]] + ref_ctr_offsets ptr64[in, array[int64[0:5]], opt] + cookies int64 + cnt len[offsets, int32] + flags flags[bpf_link_create_uprobe_multi_flags, int32] + pid pid +} + link_create_arg_extra [ target_btf_id bpf_btf_id iter link_create_iter @@ -244,6 +254,7 @@ link_create_arg_extra [ tracing link_create_tracing netfilter link_create_netfilter tcx link_create_tcx + uprobe_multi link_create_uprobe_multi ] type bpf_link_create_arg_t[PROG_FD, TARGET_FD, ATTACH_TYPE, FLAGS] { @@ -1047,3 +1058,4 @@ bpf_cgroup_iter_order = BPF_CGROUP_ITER_SELF_ONLY, BPF_CGROUP_ITER_DESCENDANTS_P bpf_link_create_kprobe_multi_flags = BPF_F_KPROBE_MULTI_RETURN nf_dev_hooks = NF_NETDEV_INGRESS, NF_NETDEV_EGRESS bpf_link_create_netfilter_flags = BPF_F_NETFILTER_IP_DEFRAG +bpf_link_create_uprobe_multi_flags = BPF_F_UPROBE_MULTI_RETURN diff --git a/sys/linux/bpf.txt.const b/sys/linux/bpf.txt.const index 12526dadc..2b0eb6e54 100644 --- a/sys/linux/bpf.txt.const +++ b/sys/linux/bpf.txt.const @@ -90,6 +90,7 @@ BPF_F_TEST_RND_HI32 = 4 BPF_F_TEST_RUN_ON_CPU = 1 BPF_F_TEST_STATE_FREQ = 8 BPF_F_TEST_XDP_LIVE_FRAMES = 2 +BPF_F_UPROBE_MULTI_RETURN = 1 BPF_F_WRONLY = 16 BPF_F_WRONLY_PROG = 256 BPF_F_XDP_DEV_BOUND_ONLY = 64 -- cgit mrf-deployment