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]
Date:   Mon, 4 Mar 2019 19:43:50 +0000
From:   Song Liu <songliubraving@...com>
To:     Jiri Olsa <jolsa@...hat.com>
CC:     Networking <netdev@...r.kernel.org>,
        linux-kernel <linux-kernel@...r.kernel.org>,
        "ast@...nel.org" <ast@...nel.org>,
        "daniel@...earbox.net" <daniel@...earbox.net>,
        Kernel Team <Kernel-team@...com>,
        "peterz@...radead.org" <peterz@...radead.org>,
        "acme@...hat.com" <acme@...hat.com>,
        "jolsa@...nel.org" <jolsa@...nel.org>,
        "namhyung@...nel.org" <namhyung@...nel.org>
Subject: Re: [PATCH v5 perf,bpf 08/15] perf, bpf: save btf in a rbtree in
 perf_env



> On Mar 4, 2019, at 5:52 AM, Jiri Olsa <jolsa@...hat.com> wrote:
> 
> On Wed, Feb 27, 2019 at 09:06:36PM -0800, Song Liu wrote:
>> btf contains information necessary to annotate bpf programs. This patch
>> saves btf for bpf programs loaded in the system.
>> 
>> Signed-off-by: Song Liu <songliubraving@...com>
>> ---
>> tools/perf/util/bpf-event.c | 24 ++++++++++++++
>> tools/perf/util/bpf-event.h |  7 ++++
>> tools/perf/util/env.c       | 65 +++++++++++++++++++++++++++++++++++++
>> tools/perf/util/env.h       |  4 +++
>> 4 files changed, 100 insertions(+)
>> 
>> diff --git a/tools/perf/util/bpf-event.c b/tools/perf/util/bpf-event.c
>> index ce81b2c43a51..370b830f2433 100644
>> --- a/tools/perf/util/bpf-event.c
>> +++ b/tools/perf/util/bpf-event.c
>> @@ -34,6 +34,29 @@ int machine__process_bpf_event(struct machine *machine __maybe_unused,
>> 	return 0;
>> }
>> 
>> +static int perf_env__fetch_btf(struct perf_env *env,
>> +			       u32 btf_id,
>> +			       struct btf *btf)
>> +{
>> +	struct btf_node *node;
>> +	u32 data_size;
>> +	const void *data;
>> +
>> +	data = btf__get_raw_data(btf, &data_size);
>> +
>> +	node = malloc(data_size + sizeof(struct btf_node));
>> +
>> +	if (!node)
>> +		return -1;
>> +
>> +	node->id = btf_id;
>> +	node->data_size = data_size;
>> +	memcpy(node->data, data, data_size);
> 
> why don't we store just struct btf itself?
> 
> thanks,
> jirka

In current libbpf design, definition of "struct btf" is private 
to tools/lib/bpf/btf.c. So we cannot copy the struct itself. 

Thanks,
Song




Powered by blists - more mailing lists