From: Stanislav Fomichev sdf@google.com
mainline inclusion from mainline-5.14-rc1 commit f9bceaa59c5c47a8a08f48e19cbe887e500a1978 category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I5EUVD CVE: NA
Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?i...
-------------------------------------------------
I'm getting the following error when running 'gen skeleton -L' as regular user:
libbpf: Error in bpf_object__probe_loading():Operation not permitted(1). Couldn't load trivial BPF program. Make sure your kernel supports BPF (CONFIG_BPF_SYSCALL=y) and/or that RLIMIT_MEMLOCK is set to big enough value.
Fixes: 67234743736a ("libbpf: Generate loader program out of BPF ELF file.") Signed-off-by: Stanislav Fomichev sdf@google.com Signed-off-by: Andrii Nakryiko andrii@kernel.org Link: https://lore.kernel.org/bpf/20210521030653.2626513-1-sdf@google.com (cherry picked from commit f9bceaa59c5c47a8a08f48e19cbe887e500a1978) Signed-off-by: Wang Yufen wangyufen@huawei.com --- tools/lib/bpf/libbpf.c | 3 +++ 1 file changed, 3 insertions(+)
diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c index dbc51f4af43d..2b01e60f4fc5 100644 --- a/tools/lib/bpf/libbpf.c +++ b/tools/lib/bpf/libbpf.c @@ -4013,6 +4013,9 @@ bpf_object__probe_loading(struct bpf_object *obj) }; int ret;
+ if (obj->gen_loader) + return 0; + /* make sure basic loading works */
memset(&attr, 0, sizeof(attr));