[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAPhsuW6fRNOOckuULrbkjPdZdZTCeWTu3zv5HJsm=0+=qD0eww@mail.gmail.com>
Date: Mon, 21 Feb 2022 17:48:36 -0800
From: Song Liu <song@...nel.org>
To: Quentin Monnet <quentin@...valent.com>
Cc: Mauricio Vásquez <mauricio@...volk.io>,
Networking <netdev@...r.kernel.org>, bpf <bpf@...r.kernel.org>,
Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
Andrii Nakryiko <andrii@...nel.org>
Subject: Re: [PATCH bpf-next v2] bpftool: Remove usage of reallocarray()
On Mon, Feb 21, 2022 at 7:48 AM Quentin Monnet <quentin@...valent.com> wrote:
>
> 2022-02-21 07:56 UTC-0500 ~ Mauricio Vásquez <mauricio@...volk.io>
> > This commit fixes a compilation error on systems with glibc < 2.26 [0]:
> >
> > ```
> > In file included from main.h:14:0,
> > from gen.c:24:
> > linux/tools/include/tools/libc_compat.h:11:21: error: attempt to use poisoned "reallocarray"
> > static inline void *reallocarray(void *ptr, size_t nmemb, size_t size)
> > ```
> >
> > This happens because gen.c pulls <bpf/libbpf_internal.h>, and then
> > <tools/libc_compat.h> (through main.h). When
> > COMPAT_NEED_REALLOCARRAY is set, libc_compat.h defines reallocarray()
> > which libbpf_internal.h poisons with a GCC pragma.
> >
> > This commit reuses libbpf_reallocarray() implemented in commit
> > 029258d7b228 ("libbpf: Remove any use of reallocarray() in libbpf").
> >
> > v1 -> v2:
> > - reuse libbpf_reallocarray() instead of reimplementing it
> >
> > Reported-by: Quentin Monnet <quentin@...valent.com>
> > Signed-off-by: Mauricio Vásquez <mauricio@...volk.io>
> >
> > [0]: https://lore.kernel.org/bpf/3bf2bd49-9f2d-a2df-5536-bc0dde70a83b@isovalent.com/
>
> Fixes: a9caaba399f9 ("bpftool: Implement "gen min_core_btf" logic")
> Reviewed-by: Quentin Monnet <quentin@...valent.com>
Acked-by: Song Liu <songliubraving@...com>
Powered by blists - more mailing lists