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.
Showing the changes to tools/include/uapi/linux (1 of 5 files). Show all
Unified · Split
| @@ -1039,6 +1039,7 @@ enum bpf_attach_type { · 1038 unmodified lines | ||
| 1039 | 1039 | BPF_NETFILTER, |
| 1040 | 1040 | BPF_TCX_INGRESS, |
| 1041 | 1041 | BPF_TCX_EGRESS, |
| 1042 | + BPF_TRACE_UPROBE_MULTI, | |
| 1042 | 1043 | __MAX_BPF_ATTACH_TYPE |
| 1043 | 1044 | }; |
| 1044 | 1045 | |
| @@ -1057,6 +1058,7 @@ enum bpf_link_type { · 12 unmodified lines | ||
| 1057 | 1058 | BPF_LINK_TYPE_STRUCT_OPS = 9, |
| 1058 | 1059 | BPF_LINK_TYPE_NETFILTER = 10, |
| 1059 | 1060 | BPF_LINK_TYPE_TCX = 11, |
| 1061 | + BPF_LINK_TYPE_UPROBE_MULTI = 12, | |
| 1060 | 1062 | MAX_BPF_LINK_TYPE, |
| 1061 | 1063 | }; |
| 1062 | 1064 | |
| @@ -1190,6 +1192,13 @@ enum { · 127 unmodified lines | ||
| 1190 | 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 | + */ | |
| 1198 | +enum { | |
| 1199 | + BPF_F_UPROBE_MULTI_RETURN = (1U << 0) | |
| 1200 | +}; | |
| 1201 | + | |
| 1193 | 1202 | /* link_create.netfilter.flags used in LINK_CREATE command for |
| 1194 | 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 | 1636 | __u64 expected_revision; |
| 1628 | 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 | 1646 | } link_create; |
| 1631 | 1647 | |