History

bpf: btf: Add BPF_BTF_LOAD command

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.

Martin KaFai Lau committed 8 years ago

Commit f56a6531 parent b00b8da4 files · +97 −0Browse files

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

Unified · Split

include/uapi/linux/bpf.h+9−0
@@ -95,6 +95,7 @@ enum bpf_cmd { · 94 unmodified lines
95 BPF_OBJ_GET_INFO_BY_FD,95 BPF_OBJ_GET_INFO_BY_FD,
96 BPF_PROG_QUERY,96 BPF_PROG_QUERY,
97 BPF_RAW_TRACEPOINT_OPEN,97 BPF_RAW_TRACEPOINT_OPEN,
98 BPF_BTF_LOAD,
98};99};
99 100
100enum bpf_map_type {101enum bpf_map_type {
@@ -363,6 +364,14 @@ union bpf_attr { · 262 unmodified lines
363 __u64 name;364 __u64 name;
364 __u32 prog_fd;365 __u32 prog_fd;
365 } raw_tracepoint;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} __attribute__((aligned(8)));375} __attribute__((aligned(8)));
367 376
368/* BPF helper function descriptions:377/* BPF helper function descriptions: