On Tue, Oct 3, 2017 at 10:39 AM, Daniel Borkmann <dan...@iogearbox.net> wrote: > 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.
Split vote? I'm happy to try to make this work with varying sizes, but I agree the usefulness seems low. It would imply building map sections with different definition structures and we would then need a way to differentiate them. If the goal is to allow for different map definition structures, I don't think size alone is a sufficient differentiator.