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:   Thu, 24 Jan 2019 10:49:46 +0100
From:   Arnaldo Carvalho de Melo <acme@...nel.org>
To:     Song Liu <songliubraving@...com>
Cc:     linux-kernel@...r.kernel.org, peterz@...radead.org, ast@...nel.org,
        daniel@...earbox.net, kernel-team@...com,
        Arnaldo Carvalho de Melo <acme@...hat.com>
Subject: Re: [PATCH perf] perf tools: fix synthesized
 PERF_RECORD_KSYMBOL/BPF_EVENT

Em Tue, Jan 22, 2019 at 01:02:18PM -0800, Song Liu escreveu:
> Added missing machine->id_hdr_size to event->header.size. Also fixed size
> of PERF_RECORD_KSYMBOL by removing extra bytes for name.

Ok, noticed this now, thanks,

- Arnaldo
 
> Fixes: 7b612e291a5a ("perf tools: Synthesize PERF_RECORD_* for loaded BPF programs")
> Cc: Peter Zijlstra <peterz@...radead.org>
> Cc: Arnaldo Carvalho de Melo <acme@...hat.com>
> Suggested-by: Jiri Olsa <jolsa@...nel.org>
> Signed-off-by: Song Liu <songliubraving@...com>
> ---
>  tools/perf/util/bpf-event.c | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/tools/perf/util/bpf-event.c b/tools/perf/util/bpf-event.c
> index 01e1dc1bb7fb..f610872812ef 100644
> --- a/tools/perf/util/bpf-event.c
> +++ b/tools/perf/util/bpf-event.c
> @@ -7,6 +7,7 @@
>  #include "bpf-event.h"
>  #include "debug.h"
>  #include "symbol.h"
> +#include "machine.h"
>  
>  #define ptr_to_u64(ptr)    ((__u64)(unsigned long)(ptr))
>  
> @@ -149,7 +150,7 @@ static int perf_event__synthesize_one_bpf_prog(struct perf_tool *tool,
>  		*ksymbol_event = (struct ksymbol_event){
>  			.header = {
>  				.type = PERF_RECORD_KSYMBOL,
> -				.size = sizeof(struct ksymbol_event),
> +				.size = offsetof(struct ksymbol_event, name),
>  			},
>  			.addr = prog_addrs[i],
>  			.len = prog_lens[i],
> @@ -178,6 +179,9 @@ static int perf_event__synthesize_one_bpf_prog(struct perf_tool *tool,
>  
>  		ksymbol_event->header.size += PERF_ALIGN(name_len + 1,
>  							 sizeof(u64));
> +
> +		memset(event + event->header.size, 0, machine->id_hdr_size);
> +		event->header.size += machine->id_hdr_size;
>  		err = perf_tool__process_synth_event(tool, event,
>  						     machine, process);
>  	}
> @@ -194,6 +198,8 @@ static int perf_event__synthesize_one_bpf_prog(struct perf_tool *tool,
>  			.id = info.id,
>  		};
>  		memcpy(bpf_event->tag, prog_tags[i], BPF_TAG_SIZE);
> +		memset(event + event->header.size, 0, machine->id_hdr_size);
> +		event->header.size += machine->id_hdr_size;
>  		err = perf_tool__process_synth_event(tool, event,
>  						     machine, process);
>  	}
> -- 
> 2.17.1

-- 

- Arnaldo

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ