Re: [PATCH] bpf: fix sample_flags for bpf_perf_event_output

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Oct 07, 2022 at 10:13:27AM +0200, Sumanth Korikkar wrote:
> * Raw data is also filled by bpf_perf_event_output.
> * Add sample_flags to indicate raw data.
> * This eliminates the segfaults as shown below:
>   Run ./samples/bpf/trace_output
>   BUG pid 9 cookie 1001000000004 sized 4
>   BUG pid 9 cookie 1001000000004 sized 4
>   BUG pid 9 cookie 1001000000004 sized 4
>   Segmentation fault (core dumped)
> 
> Fixes: 838d9bb62d13 ("perf: Use sample_flags for raw_data")
> Acked-by: Namhyung Kim <namhyung@xxxxxxxxxx>
> Signed-off-by: Sumanth Korikkar <sumanthk@xxxxxxxxxxxxx>

Acked-by: Jiri Olsa <jolsa@xxxxxxxxxx>

Peter,
I think this should go through your tree again?
bpf-next/master does not have sample_flags merged yet

thanks,
jirka

> ---
>  kernel/trace/bpf_trace.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/kernel/trace/bpf_trace.c b/kernel/trace/bpf_trace.c
> index 49fb9ec8366d..1ed08967fb97 100644
> --- a/kernel/trace/bpf_trace.c
> +++ b/kernel/trace/bpf_trace.c
> @@ -687,6 +687,7 @@ BPF_CALL_5(bpf_perf_event_output, struct pt_regs *, regs, struct bpf_map *, map,
>  
>  	perf_sample_data_init(sd, 0, 0);
>  	sd->raw = &raw;
> +	sd->sample_flags |= PERF_SAMPLE_RAW;
>  
>  	err = __bpf_perf_event_output(regs, map, flags, sd);
>  
> @@ -745,6 +746,7 @@ u64 bpf_event_output(struct bpf_map *map, u64 flags, void *meta, u64 meta_size,
>  	perf_fetch_caller_regs(regs);
>  	perf_sample_data_init(sd, 0, 0);
>  	sd->raw = &raw;
> +	sd->sample_flags |= PERF_SAMPLE_RAW;
>  
>  	ret = __bpf_perf_event_output(regs, map, flags, sd);
>  out:
> -- 
> 2.36.1
> 



[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux