From 763d7f5f2718f085bab5a9e63308349728f3ad12 Mon Sep 17 00:00:00 2001 From: Masanari Iida Date: Sun, 20 Apr 2014 00:16:41 +0900 Subject: perf tests x86: Fix memory leak in sample_ustack() The buf is not freed, when kernel failed to get stack map and return. Signed-off-by: Masanari Iida Link: http://lkml.kernel.org/r/1398091024-7901-1-git-send-email-standby24x7@gmail.com Signed-off-by: Jiri Olsa --- tools/perf/arch/x86/tests/dwarf-unwind.c | 1 + 1 file changed, 1 insertion(+) (limited to 'tools') diff --git a/tools/perf/arch/x86/tests/dwarf-unwind.c b/tools/perf/arch/x86/tests/dwarf-unwind.c index b602ad93ce63..b8c0102c70c8 100644 --- a/tools/perf/arch/x86/tests/dwarf-unwind.c +++ b/tools/perf/arch/x86/tests/dwarf-unwind.c @@ -26,6 +26,7 @@ static int sample_ustack(struct perf_sample *sample, map = map_groups__find(&thread->mg, MAP__FUNCTION, (u64) sp); if (!map) { pr_debug("failed to get stack map\n"); + free(buf); return -1; } -- cgit v1.2.3 From 4dc549e58b6ebf63554cd466d5ceb0e9c70ab859 Mon Sep 17 00:00:00 2001 From: Jiri Olsa Date: Sun, 20 Apr 2014 10:50:00 +0200 Subject: perf tools: Disable libdw unwind for all but x86 arch So far there's only x86 libdw unwind support merged in perf. Disable it on all other architectures in case libdw unwind support is detected in system. Cc: Arnaldo Carvalho de Melo Cc: Corey Ashford Cc: David Ahern Cc: Frederic Weisbecker Cc: Ingo Molnar Cc: Jean Pihet Cc: Josh Boyer Cc: Namhyung Kim Cc: Paul Mackerras Cc: Peter Zijlstra Link: http://lkml.kernel.org/r/1397988006-14158-1-git-send-email-jolsa@redhat.com Signed-off-by: Jiri Olsa --- tools/perf/config/Makefile | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'tools') diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile index ee21fa95ebcf..a71fb395e38f 100644 --- a/tools/perf/config/Makefile +++ b/tools/perf/config/Makefile @@ -34,6 +34,14 @@ ifeq ($(ARCH),arm) LIBUNWIND_LIBS = -lunwind -lunwind-arm endif +# So far there's only x86 libdw unwind support merged in perf. +# Disable it on all other architectures in case libdw unwind +# support is detected in system. Add supported architectures +# to the check. +ifneq ($(ARCH),x86) + NO_LIBDW_DWARF_UNWIND := 1 +endif + ifeq ($(LIBUNWIND_LIBS),) NO_LIBUNWIND := 1 else -- cgit v1.2.3 From 4508793541140723ab862d83095f6b5141d24e49 Mon Sep 17 00:00:00 2001 From: Steven Rostedt Date: Mon, 21 Apr 2014 22:23:46 -0400 Subject: tools lib traceevent: Fix backward compatibility macros for pevent filter enums The return value for pevent_filter_match() is suppose to return FILTER_NONE if the event doesn't have a filter, and FILTER_NOEXIST if there is no filter at all. But the change 41e12e580a7 "tools lib traceevent: Refactor pevent_filter_match() to get rid of die()" replaced the return value with PEVENT_ERRNO__* values and added "backward compatibility" macros that used the old names. Unfortunately, the NOEXIST and NONE macros were swapped, and this broke users that use the old return names. Signed-off-by: Steven Rostedt Link: http://lkml.kernel.org/r/20140421222346.0351ced4@gandalf.local.home Signed-off-by: Jiri Olsa --- tools/lib/traceevent/event-parse.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'tools') diff --git a/tools/lib/traceevent/event-parse.h b/tools/lib/traceevent/event-parse.h index 791c539374c7..feab94281634 100644 --- a/tools/lib/traceevent/event-parse.h +++ b/tools/lib/traceevent/event-parse.h @@ -876,8 +876,8 @@ struct event_filter { struct event_filter *pevent_filter_alloc(struct pevent *pevent); /* for backward compatibility */ -#define FILTER_NONE PEVENT_ERRNO__FILTER_NOT_FOUND -#define FILTER_NOEXIST PEVENT_ERRNO__NO_FILTER +#define FILTER_NONE PEVENT_ERRNO__NO_FILTER +#define FILTER_NOEXIST PEVENT_ERRNO__FILTER_NOT_FOUND #define FILTER_MISS PEVENT_ERRNO__FILTER_MISS #define FILTER_MATCH PEVENT_ERRNO__FILTER_MATCH -- cgit v1.2.3 From de04f8657de9d3351a2d5880f1f7080b23b798cf Mon Sep 17 00:00:00 2001 From: Steven Rostedt Date: Tue, 22 Apr 2014 19:23:30 -0400 Subject: tools lib traceevent: Fix memory leak in pretty_print() Commit 12e55569a244 "tools lib traceevent: Use helper trace-seq in print functions like kernel does" added a extra trace_seq helper to process string arguments like the kernel does it. But the difference between the kernel and the userspace library is that the kernel's trace_seq structure has a static allocated buffer. The userspace one has a dynamically allocated one. It requires a trace_seq_destroy(), otherwise it produces a nasty memory leak. Cc: stable@vger.kernel.org # 3.14+ Signed-off-by: Steven Rostedt Link: http://lkml.kernel.org/r/20140422192330.6bb09bf8@gandalf.local.home Signed-off-by: Jiri Olsa --- tools/lib/traceevent/event-parse.c | 1 + 1 file changed, 1 insertion(+) (limited to 'tools') diff --git a/tools/lib/traceevent/event-parse.c b/tools/lib/traceevent/event-parse.c index baec7d887da4..b83184f2d484 100644 --- a/tools/lib/traceevent/event-parse.c +++ b/tools/lib/traceevent/event-parse.c @@ -4344,6 +4344,7 @@ static void pretty_print(struct trace_seq *s, void *data, int size, struct event format, len_arg, arg); trace_seq_terminate(&p); trace_seq_puts(s, p.buffer); + trace_seq_destroy(&p); arg = arg->next; break; default: -- cgit v1.2.3