History

bpf: Add attach_btf_id attribute to program load

Add attach_btf_id attribute to prog_load command. It's similar to existing expected_attach_type attribute which is used in several cgroup based program types. Unfortunately expected_attach_type is ignored for tracing programs and cannot be reused for new purpose. Hence introduce attach_btf_id to verify bpf programs against given in-kernel BTF type id at load time. It is strictly checked to be valid for raw_tp programs only. In a later patches it will become: btf_id == 0 semantics of existing raw_tp progs. btd_id > 0 raw_tp with BTF and additional type safety.

Alexei Starovoitov committed 7 years ago

Commit ccfe29e1 parent 8580ac94 files · +17 −4Browse files

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

Unified · Split

include/uapi/linux/bpf.h+1−0
@@ -420,6 +420,7 @@ union bpf_attr { · 419 unmodified lines
420 __u32 line_info_rec_size; /* userspace bpf_line_info size */420 __u32 line_info_rec_size; /* userspace bpf_line_info size */
421 __aligned_u64 line_info; /* line info */421 __aligned_u64 line_info; /* line info */
422 __u32 line_info_cnt; /* number of bpf_line_info records */422 __u32 line_info_cnt; /* number of bpf_line_info records */
423 __u32 attach_btf_id; /* in-kernel BTF type id to attach to */
423 };424 };
424 425
425 struct { /* anonymous struct used by BPF_OBJ_* commands */426 struct { /* anonymous struct used by BPF_OBJ_* commands */