History

bpf: Add multi uprobe link

Adding new multi uprobe link that allows to attach bpf program to multiple uprobes. Uprobes to attach are specified via new link_create uprobe_multi union: struct { __aligned_u64 path; __aligned_u64 offsets; __aligned_u64 ref_ctr_offsets; __u32 cnt; __u32 flags; } uprobe_multi; Uprobes are defined for single binary specified in path and multiple calling sites specified in offsets array with optional reference counters specified in ref_ctr_offsets array. All specified arrays have length of 'cnt'. The 'flags' supports single bit for now that marks the uprobe as return probe.

Jiri Olsa committed 3 years ago

Commit 89ae89f1 parent 3505cb95 files · +282 −3Browse files

Showing the changes to include/uapi (1 of 5 files). Show all

Unified · Split

include/uapi/linux/bpf.h+16−0
@@ -1039,6 +1039,7 @@ enum bpf_attach_type { · 1038 unmodified lines
10391039 BPF_NETFILTER,
10401040 BPF_TCX_INGRESS,
10411041 BPF_TCX_EGRESS,
1042+ BPF_TRACE_UPROBE_MULTI,
10421043 __MAX_BPF_ATTACH_TYPE
10431044 };
10441045
@@ -1057,6 +1058,7 @@ enum bpf_link_type { · 12 unmodified lines
10571058 BPF_LINK_TYPE_STRUCT_OPS = 9,
10581059 BPF_LINK_TYPE_NETFILTER = 10,
10591060 BPF_LINK_TYPE_TCX = 11,
1061+ BPF_LINK_TYPE_UPROBE_MULTI = 12,
10601062 MAX_BPF_LINK_TYPE,
10611063 };
10621064
@@ -1190,6 +1192,13 @@ enum { · 127 unmodified lines
11901192 BPF_F_KPROBE_MULTI_RETURN = (1U << 0)
11911193 };
11921194
1195+/* link_create.uprobe_multi.flags used in LINK_CREATE command for
1196+ * BPF_TRACE_UPROBE_MULTI attach type to create return probe.
1197+ */
1198+enum {
1199+ BPF_F_UPROBE_MULTI_RETURN = (1U << 0)
1200+};
1201+
11931202 /* link_create.netfilter.flags used in LINK_CREATE command for
11941203 * BPF_PROG_TYPE_NETFILTER to enable IP packet defragmentation.
11951204 */
@@ -1626,6 +1635,13 @@ union bpf_attr { · 430 unmodified lines
16261635 };
16271636 __u64 expected_revision;
16281637 } tcx;
1638+ struct {
1639+ __aligned_u64 path;
1640+ __aligned_u64 offsets;
1641+ __aligned_u64 ref_ctr_offsets;
1642+ __u32 cnt;
1643+ __u32 flags;
1644+ } uprobe_multi;
16291645 };
16301646 } link_create;
16311647

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t