History

bpf: BPF token support for BPF_BTF_GET_FD_BY_ID

Currently BPF_BTF_GET_FD_BY_ID requires CAP_SYS_ADMIN, which does not allow running it from user namespace. This creates a problem when freplace program running from user namespace needs to query target program BTF. This patch relaxes capable check from CAP_SYS_ADMIN to CAP_BPF and adds support for BPF token that can be passed in attributes to syscall.

Mykyta Yatsenko committed 1 year ago

Commit 0de445d1 parent 812f7703 files · +23 −2Browse files

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

Unified · Split

tools/include/uapi/linux/bpf.h+1−0
@@ -1652,6 +1652,7 @@ union bpf_attr { · 1651 unmodified lines
16521652 };
16531653 __u32 next_id;
16541654 __u32 open_flags;
1655+ __s32 fd_by_id_token_fd;
16551656 };
16561657
16571658 struct { /* anonymous struct used by BPF_OBJ_GET_INFO_BY_FD */