This patch adds a BPF_BTF_LOAD command which 1) loads and verifies the BTF (implemented in earlier patches) 2) returns a BTF fd to userspace. In the next patch, the BTF fd can be specified during BPF_MAP_CREATE. It currently limits to CAP_SYS_ADMIN.
Showing the changes to include/uapi/linux (1 of 4 files). Show all
Unified · Split
| @@ -95,6 +95,7 @@ enum bpf_cmd { · 94 unmodified lines | ||
| 95 | 95 | BPF_OBJ_GET_INFO_BY_FD, |
| 96 | 96 | BPF_PROG_QUERY, |
| 97 | 97 | BPF_RAW_TRACEPOINT_OPEN, |
| 98 | + BPF_BTF_LOAD, | |
| 98 | 99 | }; |
| 99 | 100 | |
| 100 | 101 | enum bpf_map_type { |
| @@ -363,6 +364,14 @@ union bpf_attr { · 262 unmodified lines | ||
| 363 | 364 | __u64 name; |
| 364 | 365 | __u32 prog_fd; |
| 365 | 366 | } raw_tracepoint; |
| 367 | + | |
| 368 | + struct { /* anonymous struct for BPF_BTF_LOAD */ | |
| 369 | + __aligned_u64 btf; | |
| 370 | + __aligned_u64 btf_log_buf; | |
| 371 | + __u32 btf_size; | |
| 372 | + __u32 btf_log_size; | |
| 373 | + __u32 btf_log_level; | |
| 374 | + }; | |
| 366 | 375 | } __attribute__((aligned(8))); |
| 367 | 376 | |
| 368 | 377 | /* BPF helper function descriptions: |