[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <59D3A12B.7010101@iogearbox.net>
Date: Tue, 03 Oct 2017 16:39:39 +0200
From: Daniel Borkmann <daniel@...earbox.net>
To: Alexei Starovoitov <ast@...com>,
Craig Gallek <kraigatgoog@...il.com>,
Jesper Dangaard Brouer <brouer@...hat.com>,
"David S . Miller" <davem@...emloft.net>
CC: Chonggang Li <chonggangli@...gle.com>, netdev@...r.kernel.org
Subject: Re: [PATCH net-next v2 1/2] libbpf: parse maps sections of varying
size
On 10/03/2017 01:07 AM, Alexei Starovoitov wrote:
> On 10/2/17 9:41 AM, Craig Gallek wrote:
>> + /* Assume equally sized map definitions */
>> + map_def_sz = data->d_size / nr_maps;
>> + if (!data->d_size || (data->d_size % nr_maps) != 0) {
>> + pr_warning("unable to determine map definition size "
>> + "section %s, %d maps in %zd bytes\n",
>> + obj->path, nr_maps, data->d_size);
>> + return -EINVAL;
>> + }
>
> this approach is not as flexible as done by samples/bpf/bpf_load.c
> where it looks at every map independently by walking symtab,
> but I guess it's ok.
Regarding different map spec structs in a single prog: unless
we have a good use case why we would need it (and I'm not aware
of anything in particular), I would just go with a fixed size.
I did kind of similar sanity checks in bpf_fetch_maps_end() in
iproute2 loader as well.
Powered by blists - more mailing lists