On 4/22/21 5:26 PM, Alexei Starovoitov wrote:
From: Alexei Starovoitov <ast@xxxxxxxxxx> v1->v2: Addressed comments from Al, Yonghong and Andrii. - documented sys_close fdget/fdput requirement and non-recursion check. - reduced internal api leaks between libbpf and bpftool. Now bpf_object__gen_loader() is the only new libbf api with minimal fields. - fixed light skeleton __destroy() method to munmap and close maps and progs. - refactored bpf_btf_find_by_name_kind to return btf_id | (btf_obj_fd << 32). - refactored use of bpf_btf_find_by_name_kind from loader prog. - moved auto-gen like code into skel_internal.h that is used by *.lskel.h It has minimal static inline bpf_load_and_run() method used by lskel. - added lksel.h example in patch 15. - replaced union bpf_map_prog_desc with struct bpf_map_desc and struct bpf_prog_desc. - removed mark_feat_supported and added a patch to pass 'obj' into kernel_supports. - added proper tracking of temporary FDs in loader prog and their cleanup via bpf_sys_close. - rename gen_trace.c into gen_loader.c to better align the naming throughout. - expanded number of available helpers in new prog type. - added support for raw_tp attaching in lskel. lskel supports tracing and raw_tp progs now. It correctly loads all networking prog types too, but __attach() method is tbd. - converted progs/test_ksyms_module.c to lskel. - minor feedback fixes all over. One thing that was not addressed from feedback is the name of new program type. Currently it's still: BPF_PROG_TYPE_SYSCALL, /* a program that can execute syscalls */
Do you have plan for other non-bpf syscalls? Maybe use the name BPF_PROG_TYPE_BPF_SYSCALL? It will be really clear this is the program type you can execute bpf syscalls.
The concern raised was that it sounds like a program that should be attached to a syscall. Like BPF_PROG_TYPE_KPROBE is used to process kprobes. I've considered and rejected: BPF_PROG_TYPE_USER - too generic BPF_PROG_TYPE_USERCTX - ambiguous with uprobes
USERCTX probably not a good choice. People can write a program without context and put the ctx into a map and use it.
BPF_PROG_TYPE_LOADER - ok-ish, but imo TYPE_SYSCALL is cleaner.
User can write a program to do more than loading although I am not sure how useful it is compared to implementation in user space.
Other suggestions? The description of V1 set is still valid: ----
[...]