linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] perf-list: perf list sw segmentation fault fix
@ 2015-12-02 13:52 Michael Petlan
  2015-12-06 18:14 ` Arnaldo Carvalho de Melo
  0 siblings, 1 reply; 2+ messages in thread
From: Michael Petlan @ 2015-12-02 13:52 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo; +Cc: linux-perf-users@vger.kernel.org, ast

The PERF_COUNT_SW_BPF_OUTPUT entry is missing in the event_symbols_sw
array.  Due to that "perf list sw" segfaults,  because a NULL pointer
is passed to strlen() function at util/parse-events.c:1895.

After this patch, the syms array is set correctly,  so "perf list sw"
does not segfault.

Before:

Segmentation fault

After:

List of pre-defined events (to be used in -e):

  alignment-faults                                   [Software event]
  bpf-output                                         [Software event]
  context-switches OR cs                             [Software event]
  cpu-clock                                          [Software event]
  cpu-migrations OR migrations                       [Software event]
  dummy                                              [Software event]
  emulation-faults                                   [Software event]
  major-faults                                       [Software event]
  minor-faults                                       [Software event]
  page-faults OR faults                              [Software event]
  task-clock                                         [Software event]

Signed-off-by: Michael Petlan <mpetlan@redhat.com>
---
 tools/perf/util/parse-events.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
index e48d9da..40ae92a 100644
--- a/tools/perf/util/parse-events.c
+++ b/tools/perf/util/parse-events.c
@@ -124,6 +124,10 @@ struct event_symbol event_symbols_sw[PERF_COUNT_SW_MAX] = {
 		.symbol = "dummy",
 		.alias  = "",
 	},
+	[PERF_COUNT_SW_BPF_OUTPUT] = {
+		.symbol = "bpf-output",
+		.alias  = "",
+	},
 };
 
 #define __PERF_EVENT_FIELD(config, name) \

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] perf-list: perf list sw segmentation fault fix
  2015-12-02 13:52 [PATCH] perf-list: perf list sw segmentation fault fix Michael Petlan
@ 2015-12-06 18:14 ` Arnaldo Carvalho de Melo
  0 siblings, 0 replies; 2+ messages in thread
From: Arnaldo Carvalho de Melo @ 2015-12-06 18:14 UTC (permalink / raw)
  To: Michael Petlan; +Cc: linux-perf-users@vger.kernel.org, ast

Em Wed, Dec 02, 2015 at 02:52:02PM +0100, Michael Petlan escreveu:
> The PERF_COUNT_SW_BPF_OUTPUT entry is missing in the event_symbols_sw
> array.  Due to that "perf list sw" segfaults,  because a NULL pointer
> is passed to strlen() function at util/parse-events.c:1895.
> 
> After this patch, the syms array is set correctly,  so "perf list sw"
> does not segfault.

I had that fixed already, its upstream by now.

Thanks,

- Arnaldo

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-12-06 18:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-02 13:52 [PATCH] perf-list: perf list sw segmentation fault fix Michael Petlan
2015-12-06 18:14 ` Arnaldo Carvalho de Melo

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).