mirror of
https://github.com/netdata/libbpf.git
synced 2026-04-07 00:59:07 +08:00
libbpf: Wire up token_fd into feature probing logic
Adjust feature probing callbacks to take into account optional token_fd. In unprivileged contexts, some feature detectors would fail to detect kernel support just because BPF program, BPF map, or BTF object can't be loaded due to privileged nature of those operations. So when BPF object is loaded with BPF token, this token should be used for feature probing. This patch is setting support for this scenario, but we don't yet pass non-zero token FD. This will be added in the next patch. We also switched BPF cookie detector from using kprobe program to tracepoint one, as tracepoint is somewhat less dangerous BPF program type and has higher likelihood of being allowed through BPF token in the future. This change has no effect on detection behavior. Signed-off-by: Andrii Nakryiko <andrii@kernel.org> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Acked-by: John Fastabend <john.fastabend@gmail.com> Link: https://lore.kernel.org/bpf/20240124022127.2379740-25-andrii@kernel.org
This commit is contained in:
committed by
Andrii Nakryiko
parent
d42f0b8943
commit
a3b317a9c0
@@ -6440,7 +6440,7 @@ static int probe_kern_arg_ctx_tag(void)
|
||||
if (cached_result >= 0)
|
||||
return cached_result;
|
||||
|
||||
btf_fd = libbpf__load_raw_btf((char *)types, sizeof(types), strs, sizeof(strs));
|
||||
btf_fd = libbpf__load_raw_btf((char *)types, sizeof(types), strs, sizeof(strs), 0);
|
||||
if (btf_fd < 0)
|
||||
return 0;
|
||||
|
||||
@@ -10606,7 +10606,7 @@ static const char *arch_specific_syscall_pfx(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
int probe_kern_syscall_wrapper(void)
|
||||
int probe_kern_syscall_wrapper(int token_fd)
|
||||
{
|
||||
char syscall_name[64];
|
||||
const char *ksys_pfx;
|
||||
|
||||
Reference in New Issue
Block a user