mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-27 12:57:53 +00:00
libbpf: Enforce 64-bitness of BTF for BPF object files
BPF object files are always targeting 64-bit BPF target architecture, so enforce that at BTF level as well. Signed-off-by: Andrii Nakryiko <andriin@fb.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Link: https://lore.kernel.org/bpf/20200813204945.1020225-7-andriin@fb.com
This commit is contained in:
parent
eed7818adf
commit
4c01925f58
1 changed files with 4 additions and 0 deletions
|
@ -2434,6 +2434,8 @@ static int bpf_object__init_btf(struct bpf_object *obj,
|
|||
BTF_ELF_SEC, err);
|
||||
goto out;
|
||||
}
|
||||
/* enforce 8-byte pointers for BPF-targeted BTFs */
|
||||
btf__set_pointer_size(obj->btf, 8);
|
||||
err = 0;
|
||||
}
|
||||
if (btf_ext_data) {
|
||||
|
@ -2542,6 +2544,8 @@ static int bpf_object__sanitize_and_load_btf(struct bpf_object *obj)
|
|||
if (IS_ERR(kern_btf))
|
||||
return PTR_ERR(kern_btf);
|
||||
|
||||
/* enforce 8-byte pointers for BPF-targeted BTFs */
|
||||
btf__set_pointer_size(obj->btf, 8);
|
||||
bpf_object__sanitize_btf(obj, kern_btf);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue