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.
Showing the changes to include/linux (1 of 4 files). Show all
Unified · Split
| @@ -375,6 +375,7 @@ struct bpf_prog_aux { · 374 unmodified lines | ||
| 375 | 375 | u32 id; |
| 376 | 376 | u32 func_cnt; /* used by non-func prog as the number of func progs */ |
| 377 | 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 | 379 | bool verifier_zext; /* Zero extensions has been inserted by verifier. */ |
| 379 | 380 | bool offload_requested; |
| 380 | 381 | struct bpf_prog **func; |