Re: [PATCH bpf-next v1 3/8] bpf: Introduce help function to validate ksym's type.

2020-08-22 Thread Hao Luo
Ah, I see bpf_core_types_are_compat() after sync'ing my local repo. It seems the perfect fit for my use case. I only found the btf_equal_xxx() defined in btf.c when posting these patches. I can test and use bpf_core_types_are_compat() in v2. Thanks for pointing it out and explaining the public APIs

Re: [PATCH bpf-next v1 3/8] bpf: Introduce help function to validate ksym's type.

2020-08-21 Thread Andrii Nakryiko
On Fri, Aug 21, 2020 at 5:43 PM Hao Luo wrote: > > On Fri, Aug 21, 2020 at 2:50 PM Andrii Nakryiko > wrote: > > > > On Thu, Aug 20, 2020 at 10:22 AM Yonghong Song wrote: > > > > > > > > > > > > On 8/19/20 3:40 PM, Hao Luo wrote: > > > > For a ksym to be safely dereferenced and accessed, its type

Re: [PATCH bpf-next v1 3/8] bpf: Introduce help function to validate ksym's type.

2020-08-21 Thread Hao Luo
On Fri, Aug 21, 2020 at 2:50 PM Andrii Nakryiko wrote: > > On Thu, Aug 20, 2020 at 10:22 AM Yonghong Song wrote: > > > > > > > > On 8/19/20 3:40 PM, Hao Luo wrote: > > > For a ksym to be safely dereferenced and accessed, its type defined in > > > bpf program should basically match its type define

Re: [PATCH bpf-next v1 3/8] bpf: Introduce help function to validate ksym's type.

2020-08-21 Thread Andrii Nakryiko
On Thu, Aug 20, 2020 at 10:22 AM Yonghong Song wrote: > > > > On 8/19/20 3:40 PM, Hao Luo wrote: > > For a ksym to be safely dereferenced and accessed, its type defined in > > bpf program should basically match its type defined in kernel. Implement > > a help function for a quick matching, which i

Re: [PATCH bpf-next v1 3/8] bpf: Introduce help function to validate ksym's type.

2020-08-20 Thread Yonghong Song
On 8/19/20 3:40 PM, Hao Luo wrote: For a ksym to be safely dereferenced and accessed, its type defined in bpf program should basically match its type defined in kernel. Implement a help function for a quick matching, which is used by libbpf when resolving the kernel btf_id of a ksym. Signed-o

[PATCH bpf-next v1 3/8] bpf: Introduce help function to validate ksym's type.

2020-08-19 Thread Hao Luo
For a ksym to be safely dereferenced and accessed, its type defined in bpf program should basically match its type defined in kernel. Implement a help function for a quick matching, which is used by libbpf when resolving the kernel btf_id of a ksym. Signed-off-by: Hao Luo --- tools/lib/bpf/btf.c