From: Ravi Bangoria <ravi.bangoria@linux.ibm.com>
To: Chandan Rajendra <chandanrlinux@gmail.com>, acme@kernel.org
Cc: linux-kernel@vger.kernel.org, peterz@infradead.org,
mingo@redhat.com, mark.rutland@arm.com,
alexander.shishkin@linux.intel.com, jolsa@redhat.com,
namhyung@kernel.org, rostedt@goodmis.org, tstoyanov@vmware.com,
gregkh@linuxfoundation.org, kstewart@linuxfoundation.org,
tglx@linutronix.de, chandan@linux.ibm.com,
Ravi Bangoria <ravi.bangoria@linux.ibm.com>
Subject: Re: [PATCH] perf script: Fix obtaining next event
Date: Wed, 30 Oct 2019 15:16:10 +0530 [thread overview]
Message-ID: <0befd460-b9bf-ba2b-556a-aa06798b16b9@linux.ibm.com> (raw)
In-Reply-To: <20191030084032.31503-1-chandanrlinux@gmail.com>
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@gmail.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@linux.ibm.com>
next prev parent reply other threads:[~2019-10-30 9:46 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-30 8:40 [PATCH] perf script: Fix obtaining next event Chandan Rajendra
2019-10-30 9:46 ` Ravi Bangoria [this message]
2019-10-30 11:50 ` Arnaldo Carvalho de Melo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=0befd460-b9bf-ba2b-556a-aa06798b16b9@linux.ibm.com \
--to=ravi.bangoria@linux.ibm.com \
--cc=acme@kernel.org \
--cc=alexander.shishkin@linux.intel.com \
--cc=chandan@linux.ibm.com \
--cc=chandanrlinux@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=jolsa@redhat.com \
--cc=kstewart@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=tglx@linutronix.de \
--cc=tstoyanov@vmware.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox