[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20150528014818.GD20764@Alexeis-MacBook-Pro.local>
Date: Wed, 27 May 2015 18:48:19 -0700
From: Alexei Starovoitov <alexei.starovoitov@...il.com>
To: Wang Nan <wangnan0@...wei.com>
Cc: paulus@...ba.org, a.p.zijlstra@...llo.nl, mingo@...hat.com,
acme@...nel.org, namhyung@...nel.org, jolsa@...nel.org,
dsahern@...il.com, daniel@...earbox.net, brendan.d.gregg@...il.com,
masami.hiramatsu.pt@...achi.com, lizefan@...wei.com,
linux-kernel@...r.kernel.org, pi3orama@....com
Subject: Re: [RFC PATCH v4 09/29] bpf tools: Collect version and license from
ELF sections
On Wed, May 27, 2015 at 05:19:44AM +0000, 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 a u32 LINUX_VERSION_CODE.
>
> bpf_obj_validate() is introduced to validate object file after loaded.
> Currently it only check existance of 'version' section.
>
> Signed-off-by: Wang Nan <wangnan0@...wei.com>
> ---
...
> +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 '!=' ?
> + pr_warning("invalid kver section in %s\n", obj->path);
> + return -EINVAL;
> + }
> + memcpy(&kver, data, sizeof(kver));
> + obj->kern_version = kver;
> + pr_debug("kernel version of %s is %x\n", obj->path,
> + obj->kern_version);
> + return 0;
> +}
> +
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists