From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Michael Petlan <mpetlan@redhat.com>
Cc: acme@redhat.com, linux-perf-users@vger.kernel.org,
jolsa@redhat.com, jlelli@redhat.com, milian.wolff@kdab.com
Subject: Re: [PATCH] perf machine: Initialize srcline string member in add_location struct
Date: Thu, 9 Sep 2021 10:14:33 -0300 [thread overview]
Message-ID: <YToIuTUuudHKZmN2@kernel.org> (raw)
In-Reply-To: <20210719145332.29747-1-mpetlan@redhat.com>
Em Mon, Jul 19, 2021 at 04:53:32PM +0200, Michael Petlan escreveu:
> It's later supposed to be either a correct address or NULL. Without the
> initialization, it may contain an undefined value which results in the
> following segmentation fault:
>
> # perf top --sort comm -g --ignore-callees=do_idle
Later where? The backtrace below is unresolved, I couldn't reproduce it
here, that al variable is local to add_callchain_ip(), and is then
passed to several places where I couldn't find al->srcline being used,
can you state where it is used and causes the segfault?
- Arnaldo
> terminates with
>
> perf: Segmentation fault
> -------- backtrace --------
> perf(+0x417b26)[0x557794f1fb26]
> /lib64/libc.so.6(+0x37400)[0x7f62a0194400]
> /lib64/libc.so.6(+0x15d685)[0x7f62a02ba685]
> /lib64/libc.so.6(__strdup+0x12)[0x7f62a01e6802]
> perf(+0x3769d9)[0x557794e7e9d9]
> perf(+0x376d3a)[0x557794e7ed3a]
> perf(+0x377284)[0x557794e7f284]
> perf(+0x3773e0)[0x557794e7f3e0]
> perf(hist_entry_iter__add+0xc4)[0x557794e80114]
> perf(+0x2799aa)[0x557794d819aa]
> perf(+0x354ec8)[0x557794e5cec8]
> perf(+0x279341)[0x557794d81341]
> /lib64/libpthread.so.0(+0x814a)[0x7f62a27b514a]
> /lib64/libc.so.6(clone+0x43)[0x7f62a0259dc3]
>
> Fixes: 1fb7d06a509e ("perf report: Use srcline from callchain for hist entries")
>
> Signed-off-by: Michael Petlan <mpetlan@redhat.com>
> Reported-by: Juri Lelli <jlelli@redhat.com>
> CC: Milian Wolff <milian.wolff@kdab.com>
> Cc: Jiri Olsa <jolsa@kernel.org>
> Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
> ---
> tools/perf/util/machine.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c
> index da19be7da284..44e40bad0e33 100644
> --- a/tools/perf/util/machine.c
> +++ b/tools/perf/util/machine.c
> @@ -2149,6 +2149,7 @@ static int add_callchain_ip(struct thread *thread,
>
> al.filtered = 0;
> al.sym = NULL;
> + al.srcline = NULL;
> if (!cpumode) {
> thread__find_cpumode_addr_location(thread, ip, &al);
> } else {
> --
> 2.18.4
>
--
- Arnaldo
next prev parent reply other threads:[~2021-09-09 13:21 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-19 14:53 [PATCH] perf machine: Initialize srcline string member in add_location struct Michael Petlan
2021-09-06 14:21 ` Michael Petlan
2021-09-09 13:14 ` Arnaldo Carvalho de Melo [this message]
2021-09-13 15:13 ` Michael Petlan
2021-09-14 21:21 ` 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=YToIuTUuudHKZmN2@kernel.org \
--to=acme@kernel.org \
--cc=acme@redhat.com \
--cc=jlelli@redhat.com \
--cc=jolsa@redhat.com \
--cc=linux-perf-users@vger.kernel.org \
--cc=milian.wolff@kdab.com \
--cc=mpetlan@redhat.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;
as well as URLs for NNTP newsgroup(s).