Skip to content

Conversation

@kernel-patches-bot
Copy link

Pull request for series with
subject: tools/bpftool: Add/Fix support for modules btf dump
version: 1
url: https://patchwork.kernel.org/project/netdevbpf/list/?series=397287

@kernel-patches-bot
Copy link
Author

Master branch: 12c8a8c
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=397287
version: 1

Pull request is NOT updated. Failed to apply https://patchwork.kernel.org/project/netdevbpf/list/?series=397287
error message:

Cmd('git') failed due to: exit code(128) cmdline: git am -3 stdout: 'Applying: tools/bpftool: Add/Fix support for modules btf dump Using index info to reconstruct a base tree... M	tools/lib/bpf/btf.c M	tools/lib/bpf/btf.h M	tools/lib/bpf/libbpf.map Falling back to patching base and 3-way merge... Auto-merging tools/lib/bpf/libbpf.map CONFLICT (content): Merge conflict in tools/lib/bpf/libbpf.map Auto-merging tools/lib/bpf/btf.h Auto-merging tools/lib/bpf/btf.c CONFLICT (content): Merge conflict in tools/lib/bpf/btf.c Patch failed at 0001 tools/bpftool: Add/Fix support for modules btf dump When you have resolved this problem, run "git am --continue". If you prefer to skip this patch, run "git am --skip" instead. To restore the original branch and stop patching, run "git am --abort".' stderr: 'error: Failed to merge in the changes. hint: Use 'git am --show-current-patch' to see the failed patch' 

conflict:

diff --cc tools/lib/bpf/btf.c index 231b07203e3d,5900cccf82e2..000000000000 --- a/tools/lib/bpf/btf.c +++ b/tools/lib/bpf/btf.c @@@ -1277,17 -1370,38 +1277,29 @@@ int btf__get_from_id(__u32 id, struct b	goto exit_free;	} ++<<<<<<< HEAD +	*btf = btf__new((__u8 *)(long)btf_info.btf, btf_info.btf_size); +	if (IS_ERR(*btf)) { +	err = PTR_ERR(*btf); +	*btf = NULL; +	} ++======= +	/* force base_btf for kernel modules */ +	if (btf_info.kernel_btf && !base_btf) { +	int id = btf_get_kernel_id(); + +	/* Double check our btf is not the kernel BTF itself */ +	if (id != btf_info.id) +	btf__get_from_id(id, &base_btf); +	} +	btf = btf_new(ptr, btf_info.btf_size, base_btf); ++>>>>>>> tools/bpftool: Add/Fix support for modules btf dump exit_free: -	free(ptr); -	return btf; -} - -int btf__get_from_id(__u32 id, struct btf **btf) -{ -	struct btf *res; -	int btf_fd; - -	*btf = NULL; -	btf_fd = bpf_btf_get_fd_by_id(id); -	if (btf_fd < 0) -	return -errno; - -	res = btf_get_from_fd(btf_fd, NULL);	close(btf_fd); -	if (IS_ERR(res)) -	return PTR_ERR(res); +	free(ptr); -	*btf = res; -	return 0; +	return err; } int btf__get_map_kv_tids(const struct btf *btf, const char *map_name, diff --cc tools/lib/bpf/libbpf.map index 4ebfadf45b47,727daeb57f35..000000000000 --- a/tools/lib/bpf/libbpf.map +++ b/tools/lib/bpf/libbpf.map @@@ -337,3 -337,16 +337,19 @@@ LIBBPF_0.2.0	perf_buffer__consume_buffer;	xsk_socket__create_shared; } LIBBPF_0.1.0; ++<<<<<<< HEAD ++======= + + LIBBPF_0.3.0 { +	global: +	btf__base_btf; +	btf__parse_elf_split; +	btf__parse_raw_split; +	btf__parse_split; +	btf__new_empty_split; +	btf__new_split; +	xsk_setup_xdp_prog; +	xsk_socket__update_xskmap; +	btf_get_kernel_id + } LIBBPF_0.2.0; ++>>>>>>> tools/bpftool: Add/Fix support for modules btf dump 
@kernel-patches-bot
Copy link
Author

At least one diff in series https://patchwork.kernel.org/project/netdevbpf/list/?series=397287 expired. Closing PR.

@kernel-patches-bot kernel-patches-bot deleted the series/397287=>bpf branch December 11, 2020 00:01
kernel-patches-daemon-bpf bot pushed a commit that referenced this pull request Jan 26, 2024
Like commit 1cf3bfc ("bpf: Support 64-bit pointers to kfuncs") for s390x, add support for 64-bit pointers to kfuncs for LoongArch. Since the infrastructure is already implemented in BPF core, the only thing need to be done is to override bpf_jit_supports_far_kfunc_call(). Before this change, several test_verifier tests failed: # ./test_verifier | grep # | grep FAIL #119/p calls: invalid kfunc call: ptr_to_mem to struct with non-scalar FAIL #120/p calls: invalid kfunc call: ptr_to_mem to struct with nesting depth > 4 FAIL #121/p calls: invalid kfunc call: ptr_to_mem to struct with FAM FAIL #122/p calls: invalid kfunc call: reg->type != PTR_TO_CTX FAIL #123/p calls: invalid kfunc call: void * not allowed in func proto without mem size arg FAIL #124/p calls: trigger reg2btf_ids[reg->type] for reg->type > __BPF_REG_TYPE_MAX FAIL #125/p calls: invalid kfunc call: reg->off must be zero when passed to release kfunc FAIL #126/p calls: invalid kfunc call: don't match first member type when passed to release kfunc FAIL #127/p calls: invalid kfunc call: PTR_TO_BTF_ID with negative offset FAIL #128/p calls: invalid kfunc call: PTR_TO_BTF_ID with variable offset FAIL #129/p calls: invalid kfunc call: referenced arg needs refcounted PTR_TO_BTF_ID FAIL #130/p calls: valid kfunc call: referenced arg needs refcounted PTR_TO_BTF_ID FAIL #486/p map_kptr: ref: reference state created and released on xchg FAIL This is because the kfuncs in the loaded module are far away from __bpf_call_base: ffff800002009440 t bpf_kfunc_call_test_fail1 [bpf_testmod] 9000000002e128d8 T __bpf_call_base The offset relative to __bpf_call_base does NOT fit in s32, which breaks the assumption in BPF core. Enable bpf_jit_supports_far_kfunc_call() lifts this limit. Note that to reproduce the above result, tools/testing/selftests/bpf/config should be applied, and run the test with JIT enabled, unpriv BPF enabled. With this change, the test_verifier tests now all passed: # ./test_verifier ... Summary: 777 PASSED, 0 SKIPPED, 0 FAILED Tested-by: Tiezhu Yang <yangtiezhu@loongson.cn> Signed-off-by: Hengqi Chen <hengqi.chen@gmail.com> Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment