[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAEf4Bzbi1E_-yojgJQevM1rdhXF4EzU4dgPsGDT7F5uuDPOE7Q@mail.gmail.com>
Date: Sun, 3 Apr 2022 16:10:18 -0700
From: Andrii Nakryiko <andrii.nakryiko@...il.com>
To: Yuntao Wang <ytcoode@...il.com>
Cc: Andrii Nakryiko <andrii@...nel.org>,
Alexei Starovoitov <ast@...nel.org>, bpf <bpf@...r.kernel.org>,
Daniel Borkmann <daniel@...earbox.net>,
john fastabend <john.fastabend@...il.com>,
Martin Lau <kafai@...com>, KP Singh <kpsingh@...nel.org>,
open list <linux-kernel@...r.kernel.org>,
Networking <netdev@...r.kernel.org>,
Song Liu <songliubraving@...com>, Yonghong Song <yhs@...com>,
Toke Høiland-Jørgensen <toke@...hat.com>
Subject: Re: [PATCH bpf-next v2] libbpf: Don't return -EINVAL if hdr_len < offsetofend(core_relo_len)
On Wed, Mar 16, 2022 at 7:52 AM Yuntao Wang <ytcoode@...il.com> wrote:
>
> Since core relos is an optional part of the .BTF.ext ELF section, we should
> skip parsing it instead of returning -EINVAL if header size is less than
> offsetofend(struct btf_ext_header, core_relo_len).
>
> Fixes: e9fc3ce99b34 ("libbpf: Streamline error reporting for high-level APIs")
> Signed-off-by: Yuntao Wang <ytcoode@...il.com>
> ---
> v1 -> v2: skip core relos if hdr_len < offsetofend(core_relo_len)
>
Seems like this never made it to Patchworks. Can you please trim down
the CC list and resubmit?
> tools/lib/bpf/btf.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/tools/lib/bpf/btf.c b/tools/lib/bpf/btf.c
> index 1383e26c5d1f..9b7196b21498 100644
> --- a/tools/lib/bpf/btf.c
> +++ b/tools/lib/bpf/btf.c
> @@ -2826,10 +2826,8 @@ struct btf_ext *btf_ext__new(const __u8 *data, __u32 size)
> if (err)
> goto done;
>
> - if (btf_ext->hdr->hdr_len < offsetofend(struct btf_ext_header, core_relo_len)) {
> - err = -EINVAL;
> - goto done;
> - }
> + if (btf_ext->hdr->hdr_len < offsetofend(struct btf_ext_header, core_relo_len))
> + goto done; // skip core relos parsing
don't use C++-style comments, only /* */
>
> err = btf_ext_setup_core_relos(btf_ext);
> if (err)
> --
> 2.35.1
>
Powered by blists - more mailing lists