lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <55667758.1070206@huawei.com>
Date:	Thu, 28 May 2015 10:03:04 +0800
From:	"Wangnan (F)" <wangnan0@...wei.com>
To:	Alexei Starovoitov <alexei.starovoitov@...il.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 10/29] bpf tools: Collect map definitions from
 'maps' section



On 2015/5/28 9:53, Alexei Starovoitov wrote:
> On Wed, May 27, 2015 at 05:19:45AM +0000, Wang Nan wrote:
>> If maps are used by eBPF programs, corresponding object file(s) should
>> contain a section named 'map'. Which contains map definitions. This
>> patch copies the data of the whole section. Map data parsing should be
>> acted just before map loading.
>>
>> Signed-off-by: Wang Nan <wangnan0@...wei.com>
>> ---
> ...
>> +static int
>> +bpf_object__init_maps(struct bpf_object *obj, void *data,
>> +		      size_t size)
>> +{
>> +	if (size == 0) {
>> +		pr_debug("%s doesn't need map definition\n",
>> +			 obj->path);
>> +		return 0;
>> +	}
>> +
>> +	obj->maps_buf = malloc(size);
>> +	if (!obj->maps_buf) {
>> +		pr_warning("malloc maps failed: %s\n", obj->path);
>> +		return -ENOMEM;
>> +	}
>> +
>> +	obj->maps_buf_sz = size;
>> +	memcpy(obj->maps_buf, data, size);
> why copy it? To create maps and apply fixups to instructions
> relo sections are needed anyway, so elf has to be open while
> this section is being processed. So why copy?
>

When creating maps, ELF file has been closed.

I divide libelf info two phases: opening and loading. ELF file is closed
at the end of opening phase. I think some caller need 'opening' phase only.
For example, checking metadata in an eBPF object file. In this case, we 
don't
need create map file descriptors.

Sorry for not cc you.


--
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

Powered by Openwall GNU/*/Linux Powered by OpenVZ