netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: bpf: btf: Change how section is supported in btf_header
@ 2018-09-11 16:40 Dmitry Vyukov
  2018-09-11 18:10 ` Martin KaFai Lau
  0 siblings, 1 reply; 3+ messages in thread
From: Dmitry Vyukov @ 2018-09-11 16:40 UTC (permalink / raw)
  To: Martin KaFai Lau, Daniel Borkmann, Alexei Starovoitov; +Cc: netdev

Hi Martin,

I am looking at the subj commit:

 static int btf_add_type(struct btf_verifier_env *env, struct btf_type *t)
@@ -1754,9 +1756,9 @@ static int btf_check_all_metas(struct
btf_verifier_env *env)
        struct btf_header *hdr;
        void *cur, *end;

-       hdr = btf->hdr;
+       hdr = &btf->hdr;
        cur = btf->nohdr_data + hdr->type_off;
-       end = btf->nohdr_data + hdr->str_off;
+       end = btf->nohdr_data + hdr->type_len;

Shouldn't this be:

+       end = cur + hdr->type_len;

? Or otherwise I am having trouble understanding meaning of fields.

On a related note, what's between header and type_off? Is type_off
supposed to be 0 always?

Thanks

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: bpf: btf: Change how section is supported in btf_header
  2018-09-11 16:40 bpf: btf: Change how section is supported in btf_header Dmitry Vyukov
@ 2018-09-11 18:10 ` Martin KaFai Lau
  2018-09-12  8:10   ` Dmitry Vyukov
  0 siblings, 1 reply; 3+ messages in thread
From: Martin KaFai Lau @ 2018-09-11 18:10 UTC (permalink / raw)
  To: Dmitry Vyukov; +Cc: Daniel Borkmann, Alexei Starovoitov, netdev

On Tue, Sep 11, 2018 at 06:40:05PM +0200, Dmitry Vyukov wrote:
> Hi Martin,
> 
> I am looking at the subj commit:
> 
>  static int btf_add_type(struct btf_verifier_env *env, struct btf_type *t)
> @@ -1754,9 +1756,9 @@ static int btf_check_all_metas(struct
> btf_verifier_env *env)
>         struct btf_header *hdr;
>         void *cur, *end;
> 
> -       hdr = btf->hdr;
> +       hdr = &btf->hdr;
>         cur = btf->nohdr_data + hdr->type_off;
> -       end = btf->nohdr_data + hdr->str_off;
> +       end = btf->nohdr_data + hdr->type_len;
> 
> Shouldn't this be:
> 
> +       end = cur + hdr->type_len;
> 
> ? Or otherwise I am having trouble understanding meaning of fields.
You are correct.  Thanks for pointing this out.
Do you want to post an offical patch for the bpf branch?

> 
> On a related note, what's between header and type_off? Is type_off
> supposed to be 0 always?
type section is always the first section for now (i.e. immediately after
the header).  Some other sections could be introduced later and it could
be located before the type section such that the type_off will not be 0.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: bpf: btf: Change how section is supported in btf_header
  2018-09-11 18:10 ` Martin KaFai Lau
@ 2018-09-12  8:10   ` Dmitry Vyukov
  0 siblings, 0 replies; 3+ messages in thread
From: Dmitry Vyukov @ 2018-09-12  8:10 UTC (permalink / raw)
  To: Martin KaFai Lau; +Cc: Daniel Borkmann, Alexei Starovoitov, netdev

On Tue, Sep 11, 2018 at 8:10 PM, Martin KaFai Lau <kafai@fb.com> wrote:
> On Tue, Sep 11, 2018 at 06:40:05PM +0200, Dmitry Vyukov wrote:
>> Hi Martin,
>>
>> I am looking at the subj commit:
>>
>>  static int btf_add_type(struct btf_verifier_env *env, struct btf_type *t)
>> @@ -1754,9 +1756,9 @@ static int btf_check_all_metas(struct
>> btf_verifier_env *env)
>>         struct btf_header *hdr;
>>         void *cur, *end;
>>
>> -       hdr = btf->hdr;
>> +       hdr = &btf->hdr;
>>         cur = btf->nohdr_data + hdr->type_off;
>> -       end = btf->nohdr_data + hdr->str_off;
>> +       end = btf->nohdr_data + hdr->type_len;
>>
>> Shouldn't this be:
>>
>> +       end = cur + hdr->type_len;
>>
>> ? Or otherwise I am having trouble understanding meaning of fields.
> You are correct.  Thanks for pointing this out.
> Do you want to post an offical patch for the bpf branch?

no :)

Only if you want to send a syzkaller patch with btf descriptions ;)

>> On a related note, what's between header and type_off? Is type_off
>> supposed to be 0 always?
> type section is always the first section for now (i.e. immediately after
> the header).  Some other sections could be introduced later and it could
> be located before the type section such that the type_off will not be 0.

I see. Thanks.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-09-12 13:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-11 16:40 bpf: btf: Change how section is supported in btf_header Dmitry Vyukov
2018-09-11 18:10 ` Martin KaFai Lau
2018-09-12  8:10   ` Dmitry Vyukov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).