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] [day] [month] [year] [list]
Date:   Wed, 30 Oct 2019 08:50:04 -0300
From:   Arnaldo Carvalho de Melo <arnaldo.melo@...il.com>
To:     Ravi Bangoria <ravi.bangoria@...ux.ibm.com>
Cc:     Chandan Rajendra <chandanrlinux@...il.com>,
        linux-kernel@...r.kernel.org, peterz@...radead.org,
        mingo@...hat.com, mark.rutland@....com,
        alexander.shishkin@...ux.intel.com, jolsa@...hat.com,
        namhyung@...nel.org, rostedt@...dmis.org, tstoyanov@...are.com,
        gregkh@...uxfoundation.org, kstewart@...uxfoundation.org,
        tglx@...utronix.de, chandan@...ux.ibm.com
Subject: Re: [PATCH] perf script: Fix obtaining next event

Em Wed, Oct 30, 2019 at 03:16:10PM +0530, Ravi Bangoria escreveu:
> 
> 
> On 10/30/19 2:10 PM, Chandan Rajendra wrote:
> > The current code segfaults when perf.data file contains two or more
> > events. This happens due to incorrect pointer arithmetic being performed
> > in trace_find_next_event().
> > 
> > tep_handle->events is an array of pointers to 'struct tep_event'. The
> > pointer arithmetic interprets tep_handle->events as an array of 'struct
> > tep_event' elements.
> > 
> > This commit replaces the usage of pointer arithmetic with calls to
> > tep_get_event().
> > 
> > Fixes: bb3dd7e ("tools lib traceevent, perf tools: Move struct tep_handler definition in a local header file")
> > Signed-off-by: Chandan Rajendra <chandanrlinux@...il.com>
> 
>   $ sudo ./perf record -e sched:sched_switch -e syscalls:sys_enter_openat -- make
> 
> Without patch:
>   $ sudo ./perf script -g python
>   Segmentation fault
> 
> With patch:
>   $ sudo ./perf script -g python
>   generated Python script: perf-script.py
> 
> Reviewed-and-tested-by: Ravi Bangoria <ravi.bangoria@...ux.ibm.com>

This was fixed already in perf/core, by Steven:

commit 9bdff5b6436655d42dd30253c521e86ce07b9961
Author: Steven Rostedt (VMware) <rostedt@...dmis.org>
Date:   Thu Oct 17 17:05:23 2019 -0400

    perf tools: Remove unused trace_find_next_event()

    trace_find_next_event() was buggy and pretty much a useless helper. As
    there are no more users, just remove it.

    Signed-off-by: Steven Rostedt (VMware) <rostedt@...dmis.org>
    Cc: Andrew Morton <akpm@...ux-foundation.org>
    Cc: Jiri Olsa <jolsa@...hat.com>
    Cc: Namhyung Kim <namhyung@...nel.org>
    Cc: Tzvetomir Stoyanov <tstoyanov@...are.com>
    Cc: linux-trace-devel@...r.kernel.org
    Link: http://lore.kernel.org/lkml/20191017210636.224045576@goodmis.org
    Signed-off-by: Arnaldo Carvalho de Melo <acme@...hat.com>

commit a5e05abc6b8d81148b35cd8632a4a6252383d968
Author: Steven Rostedt (VMware) <rostedt@...dmis.org>
Date:   Thu Oct 17 17:05:22 2019 -0400

    perf scripting engines: Iterate on tep event arrays directly

    Instead of calling a useless (and broken) helper function to get the
    next event of a tep event array, just get the array directly and iterate
    over it.

    Note, the broken part was from trace_find_next_event() which after this
    will no longer be used, and can be removed.

    Committer notes:

    This fixes a segfault when generating python scripts from perf.data
    files with multiple tracepoint events, i.e. the following use case is
    fixed by this patch:

      # perf record -e sched:* sleep 1
      [ perf record: Woken up 31 times to write data ]
      [ perf record: Captured and wrote 0.031 MB perf.data (9 samples) ]
      # perf script -g python
      Segmentation fault (core dumped)
      #

    Reported-by: Daniel Bristot de Oliveira <bristot@...hat.com>
    Signed-off-by: Steven Rostedt (VMware) <rostedt@...dmis.org>
    Tested-by: Arnaldo Carvalho de Melo <acme@...hat.com>
    Cc: Andrew Morton <akpm@...ux-foundation.org>
    Cc: Jiri Olsa <jolsa@...hat.com>
    Cc: Namhyung Kim <namhyung@...nel.org>
    Cc: Tzvetomir Stoyanov <tstoyanov@...are.com>
    Cc: linux-trace-devel@...r.kernel.org
    Link: http://lkml.kernel.org/r/20191017153733.630cd5eb@gandalf.local.home
    Link: http://lore.kernel.org/lkml/20191017210636.061448713@goodmis.org
    Signed-off-by: Arnaldo Carvalho de Melo <acme@...hat.com>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ