[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAADnVQJYw=_arNNWc_PBHK=WL9KwgHZqZ-92sH6RPA0sgr_wKw@mail.gmail.com>
Date: Thu, 9 Jan 2020 21:21:24 -0800
From: Alexei Starovoitov <alexei.starovoitov@...il.com>
To: Andrii Nakryiko <andriin@...com>
Cc: bpf <bpf@...r.kernel.org>,
Network Development <netdev@...r.kernel.org>,
Alexei Starovoitov <ast@...com>,
Daniel Borkmann <daniel@...earbox.net>,
Martin KaFai Lau <kafai@...com>,
Andrii Nakryiko <andrii.nakryiko@...il.com>,
Kernel Team <kernel-team@...com>
Subject: Re: [PATCH bpf-next] libbpf: make bpf_map order and indices stable
On Thu, Jan 9, 2020 at 7:43 PM Andrii Nakryiko <andriin@...com> wrote:
>
> Currently, libbpf re-sorts bpf_map structs after all the maps are added and
> initialized, which might change their relative order and invalidate any
> bpf_map pointer or index taken before that. This is inconvenient and
> error-prone. For instance, it can cause .kconfig map index to point to a wrong
> map.
>
> Furthermore, libbpf itself doesn't rely on any specific ordering of bpf_maps,
> so it's just an unnecessary complication right now. This patch drops sorting
> of maps and makes their relative positions fixed. If efficient index is ever
> needed, it's better to have a separate array of pointers as a search index,
> instead of reordering bpf_map struct in-place. This will be less error-prone
> and will allow multiple independent orderings, if necessary (e.g., either by
> section index or by name).
>
> Fixes: 166750bc1dd2 ("libbpf: Support libbpf-provided extern variables")
> Reported-by: Martin KaFai Lau <kafai@...com>
> Signed-off-by: Andrii Nakryiko <andriin@...com>
Applied. Thanks
Powered by blists - more mailing lists