Re: [RFC PATCH v4 09/29] bpf tools: Collect version and license from ELF sections

2015-05-27 Thread Alexei Starovoitov
On Thu, May 28, 2015 at 11:34:37AM +0800, Wangnan (F) wrote: > >... > >>+static int > >>+bpf_object__init_kversion(struct bpf_object *obj, > >>+ void *data, size_t size) > >>+{ > >>+ u32 kver; > >>+ if (size < sizeof(kver)) { > >shouldn't it be '!=' ? > > Is it possible

Re: [RFC PATCH v4 09/29] bpf tools: Collect version and license from ELF sections

2015-05-27 Thread Wangnan (F)
On 2015/5/28 9:48, Alexei Starovoitov wrote: On Wed, May 27, 2015 at 05:19:44AM +, Wang Nan wrote: Expand bpf_obj_elf_collect() to collect license and kernel version information in eBPF object file. eBPF object file should have a section named 'license', which contains a string. It should

Re: [RFC PATCH v4 09/29] bpf tools: Collect version and license from ELF sections

2015-05-27 Thread Alexei Starovoitov
On Wed, May 27, 2015 at 05:19:44AM +, Wang Nan wrote: > Expand bpf_obj_elf_collect() to collect license and kernel version > information in eBPF object file. eBPF object file should have a section > named 'license', which contains a string. It should also have a section > named 'version',

Re: [RFC PATCH v4 09/29] bpf tools: Collect version and license from ELF sections

2015-05-27 Thread Wangnan (F)
On 2015/5/28 9:48, Alexei Starovoitov wrote: On Wed, May 27, 2015 at 05:19:44AM +, Wang Nan wrote: Expand bpf_obj_elf_collect() to collect license and kernel version information in eBPF object file. eBPF object file should have a section named 'license', which contains a string. It should

Re: [RFC PATCH v4 09/29] bpf tools: Collect version and license from ELF sections

2015-05-27 Thread Alexei Starovoitov
On Wed, May 27, 2015 at 05:19:44AM +, Wang Nan wrote: Expand bpf_obj_elf_collect() to collect license and kernel version information in eBPF object file. eBPF object file should have a section named 'license', which contains a string. It should also have a section named 'version', contains

Re: [RFC PATCH v4 09/29] bpf tools: Collect version and license from ELF sections

2015-05-27 Thread Alexei Starovoitov
On Thu, May 28, 2015 at 11:34:37AM +0800, Wangnan (F) wrote: ... +static int +bpf_object__init_kversion(struct bpf_object *obj, + void *data, size_t size) +{ + u32 kver; + if (size sizeof(kver)) { shouldn't it be '!=' ? Is it possible that LLVM pads 'version'

[RFC PATCH v4 09/29] bpf tools: Collect version and license from ELF sections

2015-05-26 Thread Wang Nan
Expand bpf_obj_elf_collect() to collect license and kernel version information in eBPF object file. eBPF object file should have a section named 'license', which contains a string. It should also have a section named 'version', contains a u32 LINUX_VERSION_CODE. bpf_obj_validate() is introduced

[RFC PATCH v4 09/29] bpf tools: Collect version and license from ELF sections

2015-05-26 Thread Wang Nan
Expand bpf_obj_elf_collect() to collect license and kernel version information in eBPF object file. eBPF object file should have a section named 'license', which contains a string. It should also have a section named 'version', contains a u32 LINUX_VERSION_CODE. bpf_obj_validate() is introduced