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/linux (1 of 4 files). Show all

Unified · Split

include/linux/bpf.h+1−0
@@ -375,6 +375,7 @@ struct bpf_prog_aux { · 374 unmodified lines
375 u32 id;375 u32 id;
376 u32 func_cnt; /* used by non-func prog as the number of func progs */376 u32 func_cnt; /* used by non-func prog as the number of func progs */
377 u32 func_idx; /* 0 for non-func prog, the index in func array for func prog */377 u32 func_idx; /* 0 for non-func prog, the index in func array for func prog */
378 u32 attach_btf_id; /* in-kernel BTF type id to attach to */
378 bool verifier_zext; /* Zero extensions has been inserted by verifier. */379 bool verifier_zext; /* Zero extensions has been inserted by verifier. */
379 bool offload_requested;380 bool offload_requested;
380 struct bpf_prog **func;381 struct bpf_prog **func;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t