[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAEf4BzYmS8i-O6fV=no0h6ej-5mC3_87CAUFny_Dbad4HL7PgQ@mail.gmail.com>
Date: Tue, 1 Oct 2024 10:18:11 -0700
From: Andrii Nakryiko <andrii.nakryiko@...il.com>
To: i@...k3r.moe
Cc: bpf@...r.kernel.org, Andrii Nakryiko <andrii@...nel.org>,
Alexei Starovoitov <ast@...nel.org>, netdev@...r.kernel.org
Subject: Re: [PATCH bpf-next v3 1/2] libbpf: do not resolve size on duplicate FUNCs
On Mon, Sep 30, 2024 at 8:55 PM Eric Long via B4 Relay
<devnull+i.hack3r.moe@...nel.org> wrote:
>
> From: Eric Long <i@...k3r.moe>
>
> FUNCs do not have sizes, thus currently btf__resolve_size will fail
> with -EINVAL. Add conditions so that we only update size when the BTF
> object is not function or function prototype.
>
> Signed-off-by: Eric Long <i@...k3r.moe>
> ---
> tools/lib/bpf/linker.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/tools/lib/bpf/linker.c b/tools/lib/bpf/linker.c
> index 81dbbdd79a7c65a4b048b85e1dba99cb5f7cb56b..ff249ba0ab067526e82d91481d21ec88a2732b4f 100644
> --- a/tools/lib/bpf/linker.c
> +++ b/tools/lib/bpf/linker.c
> @@ -2451,6 +2451,10 @@ static int linker_append_btf(struct bpf_linker *linker, struct src_obj *obj)
> if (glob_sym && glob_sym->var_idx >= 0) {
> __s64 sz;
>
> + /* FUNCs don't have size, nothing to update */
> + if (btf_is_func(t) || btf_is_func_proto(t))
no, it should be *just* btf_is_func(), because that's what extern ksym
is producing. FUNC then points to FUNC_PROTO. So this is still a
sloppy check.
pw-bot: cr
> + continue;
> +
> dst_var = &dst_sec->sec_vars[glob_sym->var_idx];
> /* Because underlying BTF type might have
> * changed, so might its size have changed, so
>
> --
> 2.46.2
>
>
Powered by blists - more mailing lists