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
1039 BPF_NETFILTER,1039 BPF_NETFILTER,
1040 BPF_TCX_INGRESS,1040 BPF_TCX_INGRESS,
1041 BPF_TCX_EGRESS,1041 BPF_TCX_EGRESS,
1042 BPF_TRACE_UPROBE_MULTI,
1042 __MAX_BPF_ATTACH_TYPE1043 __MAX_BPF_ATTACH_TYPE
1043};1044};
1044 1045
@@ -1057,6 +1058,7 @@ enum bpf_link_type { · 12 unmodified lines
1057 BPF_LINK_TYPE_STRUCT_OPS = 9,1058 BPF_LINK_TYPE_STRUCT_OPS = 9,
1058 BPF_LINK_TYPE_NETFILTER = 10,1059 BPF_LINK_TYPE_NETFILTER = 10,
1059 BPF_LINK_TYPE_TCX = 11,1060 BPF_LINK_TYPE_TCX = 11,
1061 BPF_LINK_TYPE_UPROBE_MULTI = 12,
1060 MAX_BPF_LINK_TYPE,1062 MAX_BPF_LINK_TYPE,
1061};1063};
1062 1064
@@ -1190,6 +1192,13 @@ enum { · 127 unmodified lines
1190 BPF_F_KPROBE_MULTI_RETURN = (1U << 0)1192 BPF_F_KPROBE_MULTI_RETURN = (1U << 0)
1191};1193};
1192 1194
1195/* link_create.uprobe_multi.flags used in LINK_CREATE command for
1196 * BPF_TRACE_UPROBE_MULTI attach type to create return probe.
1197 */
1198enum {
1199 BPF_F_UPROBE_MULTI_RETURN = (1U << 0)
1200};
1201
1193/* link_create.netfilter.flags used in LINK_CREATE command for1202/* link_create.netfilter.flags used in LINK_CREATE command for
1194 * BPF_PROG_TYPE_NETFILTER to enable IP packet defragmentation.1203 * BPF_PROG_TYPE_NETFILTER to enable IP packet defragmentation.
1195 */1204 */
@@ -1626,6 +1635,13 @@ union bpf_attr { · 430 unmodified lines
1626 };1635 };
1627 __u64 expected_revision;1636 __u64 expected_revision;
1628 } tcx;1637 } 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;
1629 };1645 };
1630 } link_create;1646 } link_create;
1631 1647

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