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, 17 Oct 2022 15:52:15 -0700
From:   Namhyung Kim <namhyung@...nel.org>
To:     SeongJae Park <sj@...nel.org>
Cc:     Sumanth Korikkar <sumanthk@...ux.ibm.com>, olsajiri@...il.com,
        bpf@...r.kernel.org, gor@...ux.ibm.com, hca@...ux.ibm.com,
        iii@...ux.ibm.com, linux-kernel@...r.kernel.org,
        linux-tip-commits@...r.kernel.org, peterz@...radead.org,
        svens@...ux.ibm.com, tip-bot2@...utronix.de, tmricht@...ux.ibm.com,
        x86@...nel.org
Subject: Re: [PATCH] bpf: fix sample_flags for bpf_perf_event_output

Hi SeongJae,

On Mon, Oct 17, 2022 at 12:27 PM SeongJae Park <sj@...nel.org> wrote:
>
> Hello,
>
>
> The commit that this patch is fixing[1] also causes yet another segfault for
> 'perf-script' of tracepoint records.  For example:
>
>     $ sudo timeout 3 perf record -e exceptions:page_fault_user
>     [ perf record: Woken up 1 times to write data ]
>     [ perf record: Captured and wrote 0.228 MB perf.data (74 samples) ]
>     $ sudo perf script
>     Segmentation fault
>
> Reverting this patch and the original bug commit[1] fixes the issue.  I haven't
> deep dive yet because I'm not familiar with this area.  Anybody has any idea
> about this?
>
> [1] 838d9bb62d13 ("perf: Use sample_flags for raw_data")

Sorry for the trouble.  I think you also need to apply the below:

https://lore.kernel.org/r/20221012143857.48198-1-james.clark@arm.com

Thanks,
Namhyung

>
> On Fri, 7 Oct 2022 10:13:27 +0200 Sumanth Korikkar <sumanthk@...ux.ibm.com> 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@...nel.org>
> > Signed-off-by: Sumanth Korikkar <sumanthk@...ux.ibm.com>
> > ---
> >  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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ