Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1224389

Re: [PATCH v2] perf tools: Fix segfault in 'perf top'

From Arnaldo Carvalho de Melo <acme@kernel.org>
Newsgroups linux.kernel
Subject Re: [PATCH v2] perf tools: Fix segfault in 'perf top'
Date 2015-09-14 20:20 +0200
Message-ID <q8Gw9-5zh-3@gated-at.bofh.it> (permalink)
References <q7zn4-6Xj-29@gated-at.bofh.it> <q8zbl-3r6-31@gated-at.bofh.it> <q8Gmu-5nU-21@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Em Mon, Sep 14, 2015 at 03:07:14PM -0300, Arnaldo Carvalho de Melo escreveu:
> Em Mon, Sep 14, 2015 at 10:23:55AM +0000, Wang Nan escreveu:
> > 'perf top' segfaults with following operation:
> > 
> >  # perf top -e page-faults -p 11400 # 11400 never generates page-fault
> > 
> > Then on the resulting empty interface, press right key:
> 
> So, this happens in perf/urgent, so we need to apply it there first,
> which this patch doesn't.
> 
> I am fixing it up this time, thanks for the patch!

For reference, below is the resulting patch, pushed to acme/perf/urgent,
now checking if there are more patches to go together with this one...

- Arnaldo

diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
index cf86f2d3a5e7..c04c60d4863c 100644
--- a/tools/perf/ui/browsers/hists.c
+++ b/tools/perf/ui/browsers/hists.c
@@ -1968,7 +1968,8 @@ skip_annotation:
 					  &options[nr_options], dso);
 		nr_options += add_map_opt(browser, &actions[nr_options],
 					  &options[nr_options],
-					  browser->selection->map);
+					  browser->selection ?
+						browser->selection->map : NULL);
 
 		/* perf script support */
 		if (browser->he_selection) {
@@ -1976,6 +1977,15 @@ skip_annotation:
 						     &actions[nr_options],
 						     &options[nr_options],
 						     thread, NULL);
+			/*
+			 * Note that browser->selection != NULL
+			 * when browser->he_selection is not NULL,
+			 * so we don't need to check browser->selection
+			 * before fetching browser->selection->sym like what
+			 * we do before fetching browser->selection->map.
+			 *
+			 * See hist_browser__show_entry.
+			 */
 			nr_options += add_script_opt(browser,
 						     &actions[nr_options],
 						     &options[nr_options],
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] perf tools: Fix segfault in 'perf top' Wang Nan <wangnan0@huawei.com> - 2015-09-11 07:00 +0200
  Re: [PATCH] perf tools: Fix segfault in 'perf top' Namhyung Kim <namhyung@kernel.org> - 2015-09-11 18:30 +0200
    Re: [PATCH] perf tools: Fix segfault in 'perf top' "Wangnan (F)" <wangnan0@huawei.com> - 2015-09-14 12:20 +0200
    [PATCH v2] perf tools: Fix segfault in 'perf top' Wang Nan <wangnan0@huawei.com> - 2015-09-14 12:30 +0200
      Re: [PATCH v2] perf tools: Fix segfault in 'perf top' Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-09-14 20:10 +0200
        Re: [PATCH v2] perf tools: Fix segfault in 'perf top' Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-09-14 20:20 +0200
      [tip:perf/core] perf top: Fix segfault pressing ->   with no hist entries tip-bot for Wang Nan <tipbot@zytor.com> - 2015-09-16 09:30 +0200

csiph-web