public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: Daniel Borkmann <daniel@iogearbox•net>
To: Alexei Starovoitov <ast@fb•com>,
	Craig Gallek <kraigatgoog@gmail•com>,
	Jesper Dangaard Brouer <brouer@redhat•com>,
	"David S . Miller" <davem@davemloft•net>
Cc: Chonggang Li <chonggangli@google•com>, netdev@vger•kernel.org
Subject: Re: [PATCH net-next v2 1/2] libbpf: parse maps sections of varying size
Date: Tue, 03 Oct 2017 16:39:39 +0200	[thread overview]
Message-ID: <59D3A12B.7010101@iogearbox.net> (raw)
In-Reply-To: <5082193f-0b59-bc40-290f-4ef3709a1d26@fb.com>

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.

  reply	other threads:[~2017-10-03 14:39 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-02 16:41 [PATCH net-next v2 0/2] libbpf: support more map options Craig Gallek
2017-10-02 16:41 ` [PATCH net-next v2 1/2] libbpf: parse maps sections of varying size Craig Gallek
2017-10-02 23:07   ` Alexei Starovoitov
2017-10-03 14:39     ` Daniel Borkmann [this message]
2017-10-04 13:59       ` Craig Gallek
2017-10-04 19:27         ` Daniel Borkmann
2017-10-04 19:54           ` Alexei Starovoitov
2017-10-03 14:03   ` Jesper Dangaard Brouer
2017-10-04 13:58     ` Craig Gallek
2017-10-04 14:12       ` David Laight
2017-10-03 14:11   ` Jesper Dangaard Brouer
2017-10-04 13:58     ` Craig Gallek
2017-10-04 13:58     ` Craig Gallek
2017-10-02 16:41 ` [PATCH net-next v2 2/2] libbpf: use map_flags when creating maps Craig Gallek
2017-10-04  4:26 ` [PATCH net-next v2 0/2] libbpf: support more map options David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=59D3A12B.7010101@iogearbox.net \
    --to=daniel@iogearbox$(echo .)net \
    --cc=ast@fb$(echo .)com \
    --cc=brouer@redhat$(echo .)com \
    --cc=chonggangli@google$(echo .)com \
    --cc=davem@davemloft$(echo .)net \
    --cc=kraigatgoog@gmail$(echo .)com \
    --cc=netdev@vger$(echo .)kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox