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
9595 BPF_OBJ_GET_INFO_BY_FD,
9696 BPF_PROG_QUERY,
9797 BPF_RAW_TRACEPOINT_OPEN,
98+ BPF_BTF_LOAD,
9899 };
99100
100101 enum bpf_map_type {
@@ -363,6 +364,14 @@ union bpf_attr { · 262 unmodified lines
363364 __u64 name;
364365 __u32 prog_fd;
365366 } 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+ };
366375 } __attribute__((aligned(8)));
367376
368377 /* BPF helper function descriptions: