diff options
author | Andrii Nakryiko <andrii@kernel.org> | 2023-08-24 02:00:16 +0200 |
---|---|---|
committer | Martin KaFai Lau <martin.lau@kernel.org> | 2023-08-24 06:13:48 +0200 |
commit | f3bdb54f09ab4cdbca48bf7befa8997cadd8d6a1 (patch) | |
tree | 36b33878f81635dd1ed43b253f7778258eed8e04 /tools/lib | |
parent | selftests/bpf: add uprobe_multi test binary to .gitignore (diff) | |
download | linux-f3bdb54f09ab4cdbca48bf7befa8997cadd8d6a1.tar.xz linux-f3bdb54f09ab4cdbca48bf7befa8997cadd8d6a1.zip |
libbpf: fix signedness determination in CO-RE relo handling logic
Extracting btf_int_encoding() is only meaningful for BTF_KIND_INT, so we
need to check that first before inferring signedness.
Closes: https://github.com/libbpf/libbpf/issues/704
Reported-by: Lorenz Bauer <lmb@isovalent.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Acked-by: Yonghong Song <yonghong.song@linux.dev>
Link: https://lore.kernel.org/r/20230824000016.2658017-2-andrii@kernel.org
Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org>
Diffstat (limited to 'tools/lib')
-rw-r--r-- | tools/lib/bpf/relo_core.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/lib/bpf/relo_core.c b/tools/lib/bpf/relo_core.c index a26b2f5fa0fc..63a4d5ad12d1 100644 --- a/tools/lib/bpf/relo_core.c +++ b/tools/lib/bpf/relo_core.c @@ -776,7 +776,7 @@ static int bpf_core_calc_field_relo(const char *prog_name, break; case BPF_CORE_FIELD_SIGNED: *val = (btf_is_any_enum(mt) && BTF_INFO_KFLAG(mt->info)) || - (btf_int_encoding(mt) & BTF_INT_SIGNED); + (btf_is_int(mt) && (btf_int_encoding(mt) & BTF_INT_SIGNED)); if (validate) *validate = true; /* signedness is never ambiguous */ break; |