Skip to content

Commit d79427c

Browse files
guidosarducciKernel Patches Daemon
authored and
Kernel Patches Daemon
committed
libbpf: Fix inheritance of BTF pointer size
Update btf_new_empty() to copy the pointer size from a provided base BTF. This ensures split BTF works properly and fixes test failures seen on 32-bit targets: root@qemu-armhf:/usr/libexec/kselftests-bpf# ./test_progs -a btf_split __test_btf_split:PASS:empty_main_btf 0 nsec __test_btf_split:PASS:main_ptr_sz 0 nsec __test_btf_split:PASS:empty_split_btf 0 nsec __test_btf_split:FAIL:inherit_ptr_sz unexpected inherit_ptr_sz: actual 4 != expected 8 [...] #41/1 btf_split/single_split:FAIL Fixes: ba45136 ("libbpf: Implement basic split BTF support") Signed-off-by: Tony Ambardar <[email protected]> Reviewed-by: Alan Maguire <[email protected]>
1 parent 6c5a4cd commit d79427c

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

tools/lib/bpf/btf.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1010,6 +1010,7 @@ static struct btf *btf_new_empty(struct btf *base_btf)
10101010

10111011
if (base_btf) {
10121012
btf->base_btf = base_btf;
1013+
btf->ptr_sz = base_btf->ptr_sz;
10131014
btf->start_id = btf__type_cnt(base_btf);
10141015
btf->start_str_off = base_btf->hdr->str_len + base_btf->start_str_off;
10151016
btf->swapped_endian = base_btf->swapped_endian;

0 commit comments

Comments
 (0)