Sync kernel header bpf.h to tools/include/uapi/linux/bpf.h and implement bpf_task_fd_query() in libbpf. The test programs in samples/bpf and tools/testing/selftests/bpf, and later bpftool will use this libbpf function to query kernel.
Showing the changes to tools/include/uapi/linux (1 of 3 files). Show all
Unified · Split
| @@ -97,6 +97,7 @@ enum bpf_cmd { · 96 unmodified lines | ||
| 97 | 97 | BPF_RAW_TRACEPOINT_OPEN, |
| 98 | 98 | BPF_BTF_LOAD, |
| 99 | 99 | BPF_BTF_GET_FD_BY_ID, |
| 100 | + BPF_TASK_FD_QUERY, | |
| 100 | 101 | }; |
| 101 | 102 | |
| 102 | 103 | enum bpf_map_type { |
| @@ -380,6 +381,22 @@ union bpf_attr { · 277 unmodified lines | ||
| 380 | 381 | __u32 btf_log_size; |
| 381 | 382 | __u32 btf_log_level; |
| 382 | 383 | }; |
| 384 | + | |
| 385 | + struct { | |
| 386 | + __u32 pid; /* input: pid */ | |
| 387 | + __u32 fd; /* input: fd */ | |
| 388 | + __u32 flags; /* input: flags */ | |
| 389 | + __u32 buf_len; /* input/output: buf len */ | |
| 390 | + __aligned_u64 buf; /* input/output: | |
| 391 | + * tp_name for tracepoint | |
| 392 | + * symbol for kprobe | |
| 393 | + * filename for uprobe | |
| 394 | + */ | |
| 395 | + __u32 prog_id; /* output: prod_id */ | |
| 396 | + __u32 fd_type; /* output: BPF_FD_TYPE_* */ | |
| 397 | + __u64 probe_offset; /* output: probe_offset */ | |
| 398 | + __u64 probe_addr; /* output: probe_addr */ | |
| 399 | + } task_fd_query; | |
| 383 | 400 | } __attribute__((aligned(8))); |
| 384 | 401 | |
| 385 | 402 | /* The description below is an attempt at providing documentation to eBPF |
| @@ -2557,4 +2574,13 @@ struct bpf_fib_lookup { · 2171 unmodified lines | ||
| 2557 | 2574 | __u8 dmac[6]; /* ETH_ALEN */ |
| 2558 | 2575 | }; |
| 2559 | 2576 | |
| 2577 | +enum bpf_task_fd_type { | |
| 2578 | + BPF_FD_TYPE_RAW_TRACEPOINT, /* tp name */ | |
| 2579 | + BPF_FD_TYPE_TRACEPOINT, /* tp name */ | |
| 2580 | + BPF_FD_TYPE_KPROBE, /* (symbol + offset) or addr */ | |
| 2581 | + BPF_FD_TYPE_KRETPROBE, /* (symbol + offset) or addr */ | |
| 2582 | + BPF_FD_TYPE_UPROBE, /* filename + offset */ | |
| 2583 | + BPF_FD_TYPE_URETPROBE, /* filename + offset */ | |
| 2584 | +}; | |
| 2585 | + | |
| 2560 | 2586 | #endif /* _UAPI__LINUX_BPF_H__ */ |