lkml.org 
[lkml]   [2015]   [Oct]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH] perf tools: Fix endless loop in dso__split_kallsyms_for_kcore
On Mon, Oct 26, 2015 at 03:22:33PM +0200, Adrian Hunter wrote:
> On 26/10/15 15:01, Jiri Olsa wrote:
> > hi,
> > I'm getting stuck buildid-list command on s390
> >
> > seems like the kcore code gets stuck with inseting
> > into rbtree while iterating it..
> >
> > I was able to fix it with patch below, bu I'm not sure it's the
> > correct fix because the kcore maps magic is beyond me so far ;-)
> >
> > please check attached backtrace and patch
>
> Your fix looks correct to me.

great, attached patch with changelog.. please
feel free to add more detail or correct it

thanks,
jirka


---
Currently we split symbols based on the map comparison,
but symbols are stored within dso objects and maps could
point into same dso objects (kernel maps).

Hence we could end up changing rbtree we are currently
iterating and mess it up. It's easily reproduced on
s390x by running:

$ perf record -a -- sleep 3
$ perf buildid-list -i perf.data --with-hits

The fix is to compare dso objects instead.

Reported-by: Michael Petlan <mpetlan@redhat.com>
Link: http://lkml.kernel.org/n/tip-p9ge2nvme7u5s21j0sn987wd@git.kernel.org
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
tools/perf/util/symbol.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index e7bf0c46918d..b0d2fb272f7e 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -680,7 +680,7 @@ static int dso__split_kallsyms_for_kcore(struct dso *dso, struct map *map,
pos->start -= curr_map->start - curr_map->pgoff;
if (pos->end)
pos->end -= curr_map->start - curr_map->pgoff;
- if (curr_map != map) {
+ if (curr_map->dso != map->dso) {
rb_erase_init(&pos->rb_node, root);
symbols__insert(
&curr_map->dso->symbols[curr_map->type],
--
2.4.3


\
 
 \ /
  Last update: 2015-10-26 15:01    [W:0.040 / U:0.052 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site