Skip to contentSkip to conversation

trace-cmd: backport three patches

PATCH New [email protected] 1 participant 2 messages Jun 7, 2013

lore
Share & tools
lore
#0 lore raw

cover trace-cmd: backport three patches

From: "Roy.Li" <[email protected]>

The following changes since commit 8a2ac668d99f7d64c2acffc3a39cedb2d152be6e:

lrzsz: check locale.h in configure (2013-06-04 15:53:45 +0100)

are available in the git repository at:

git://git.pokylinux.org/poky-contrib roy/trace-cmd
http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=roy/trace-cmd

Roy.Li (1):
trace-cmd: backport three patches

 ...dd-checks-for-invalid-pointers-to-fix-seg.patch |   61 +++++++++++++
 ...o-not-call-stop_threads-if-doing-latency-.patch |   38 ++++++++
 ...etting-plugin-to-nop-clears-data-before-i.patch |   96 ++++++++++++++++++++
 meta/recipes-kernel/trace-cmd/trace-cmd_1.2.bb     |    8 +-
 4 files changed, 201 insertions(+), 2 deletions(-)
 create mode 100644 meta/recipes-kernel/trace-cmd/trace-cmd/trace-cmd-Add-checks-for-invalid-pointers-to-fix-seg.patch
 create mode 100644 meta/recipes-kernel/trace-cmd/trace-cmd/trace-cmd-Do-not-call-stop_threads-if-doing-latency-.patch
 create mode 100644 meta/recipes-kernel/trace-cmd/trace-cmd/trace-cmd-Setting-plugin-to-nop-clears-data-before-i.patch
Signature · 1 line
1.7.10.4
#1 lore raw

PATCH 1/1 trace-cmd: backport three patches

From: "Roy.Li" <[email protected]>

Backport three patches to fix running issues.

---
 ...dd-checks-for-invalid-pointers-to-fix-seg.patch |   61 +++++++++++++
 ...o-not-call-stop_threads-if-doing-latency-.patch |   38 ++++++++
 ...etting-plugin-to-nop-clears-data-before-i.patch |   96 ++++++++++++++++++++
 meta/recipes-kernel/trace-cmd/trace-cmd_1.2.bb     |    8 +-
 4 files changed, 201 insertions(+), 2 deletions(-)
 create mode 100644 meta/recipes-kernel/trace-cmd/trace-cmd/trace-cmd-Add-checks-for-invalid-pointers-to-fix-seg.patch
 create mode 100644 meta/recipes-kernel/trace-cmd/trace-cmd/trace-cmd-Do-not-call-stop_threads-if-doing-latency-.patch
 create mode 100644 meta/recipes-kernel/trace-cmd/trace-cmd/trace-cmd-Setting-plugin-to-nop-clears-data-before-i.patch
meta/recipes-kernel/trace-cmd/trace-cmd/trace-cmd-Add-checks-for-invalid-pointers-to-fix-seg.patch new file +61 -0
new file mode 100644
index 0000000..8fdeedb
@@ -0,0 +1,61 @@
+From a6e259b2cd43db3c0f69441f627a8cf214f88506 Mon Sep 17 00:00:00 2001
+From: Mark Asselstine <[email protected]>
+Date: Thu, 5 Apr 2012 15:19:44 -0400
+Subject: [PATCH] trace-cmd: Add checks for invalid pointers to fix segfaults
+
+Upstream-Status: Backport
+
+Running 'trace-cmd report' after running latency tracers will cause a
+segfault due to invalid pointers. Adding checks to ensure
+pointers/lists are initialized before attempting to use them prevents
+these segfaults.
+
+Link: http://lkml.kernel.org/r/[email protected]
+
+Signed-off-by: Mark Asselstine <[email protected]>
+Signed-off-by: Steven Rostedt <[email protected]>
+---
+ trace-input.c |   12 +++++++++---
+ 1 file changed, 9 insertions(+), 3 deletions(-)
+
+diff --git a/trace-input.c b/trace-input.c
+index b6af1e6..5151c1e 100644
+--- a/trace-input.c
++++ b/trace-input.c
+@@ -695,7 +695,8 @@ static void __free_page(struct tracecmd_input *handle, struct page *page)
+ 
+ static void free_page(struct tracecmd_input *handle, int cpu)
+ {
+-	if (!handle->cpu_data[cpu].page)
++	if (!handle->cpu_data || cpu >= handle->cpus ||
++	    !handle->cpu_data[cpu].page)
+ 		return;
+ 
+ 	__free_page(handle, handle->cpu_data[cpu].page);
+@@ -746,8 +747,12 @@ void tracecmd_record_ref(struct record *record)
+ 
+ static void free_next(struct tracecmd_input *handle, int cpu)
+ {
+-	struct record *record = handle->cpu_data[cpu].next;
++	struct record *record;
++
++	if (!handle->cpu_data || cpu >= handle->cpus)
++		return;
+ 
++	record = handle->cpu_data[cpu].next;
+ 	if (!record)
+ 		return;
+ 
+@@ -2337,7 +2342,8 @@ void tracecmd_close(struct tracecmd_input *handle)
+ 		/* The tracecmd_peek_data may have cached a record */
+ 		free_next(handle, cpu);
+ 		free_page(handle, cpu);
+-		if (!list_empty(&handle->cpu_data[cpu].pages))
++		if (handle->cpu_data &&
++		    !list_empty(&handle->cpu_data[cpu].pages))
+ 			warning("pages still allocated on cpu %d%s",
+ 				cpu, show_records(&handle->cpu_data[cpu].pages));
+ 	}
+-- 
+1.7.10.4
+
meta/recipes-kernel/trace-cmd/trace-cmd/trace-cmd-Do-not-call-stop_threads-if-doing-latency-.patch new file +38 -0
new file mode 100644
index 0000000..4c00c51
@@ -0,0 +1,38 @@
+From 356dee73d9ced3e019dea2883a7f357fd4664b3e Mon Sep 17 00:00:00 2001
+From: Mark Asselstine <[email protected]>
+Date: Thu, 5 Apr 2012 15:19:45 -0400
+Subject: [PATCH] trace-cmd: Do not call stop_threads() if doing latency
+ tracing
+
+Upstream-Status: Backport
+
+If we are using a latency tracer we do not call start_threads() we
+should therefore not call stop_threads() if 'latency'. Attempting
+to call stop_threads() without first calling start_threads() will
+cause a segfault since pids will be uninitialized.
+
+Link: http://lkml.kernel.org/r/[email protected]
+
+Signed-off-by: Mark Asselstine <[email protected]>
+Signed-off-by: Steven Rostedt <[email protected]>
+---
+ trace-record.c |    3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/trace-record.c b/trace-record.c
+index fcec28b..1c56fa9 100644
+--- a/trace-record.c
++++ b/trace-record.c
+@@ -2216,7 +2216,8 @@ void trace_record (int argc, char **argv)
+ 		}
+ 
+ 		disable_tracing();
+-		stop_threads();
++		if (!latency)
++			stop_threads();
+ 	}
+ 
+ 	for (cpu = 0; cpu < cpu_count; cpu++) {
+-- 
+1.7.10.4
+
meta/recipes-kernel/trace-cmd/trace-cmd/trace-cmd-Setting-plugin-to-nop-clears-data-before-i.patch new file +96 -0

96 lines not on this page · raw message

meta/recipes-kernel/trace-cmd/trace-cmd_1.2.bb +6 -2
index 90ba3b3..ff895f8 100644
@@ -3,7 +3,7 @@ LICENSE = "GPLv2 & LGPLv2.1"
 LIC_FILES_CHKSUM = "file://COPYING;md5=751419260aa954499f7abaabaa882bbe \
                     file://trace-cmd.c;beginline=6;endline=8;md5=2c22c965a649ddd7973d7913c5634a5e \
                     file://COPYING.LIB;md5=bbb461211a33b134d42ed5ee802b37ff \
-                    file://trace-input.c;beginline=5;endine=8;md5=c9c405aaf5cfc09582ec83cf6e83a020"
+                    file://trace-input.c;beginline=5;endine=8;md5=6ad47cc2b03385d8456771eec5eeea0b"
 
 SRCREV = "7055ffd37beeb44714e86a4abc703f7e175a0db5"
 PR = "r3"
@@ -14,7 +14,11 @@ inherit pkgconfig pythonnative
 SRC_URI = "git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/trace-cmd.git;protocol=git \
            file://addldflags.patch \
            file://make-docs-optional.patch \
-           file://blktrace-api-compatibility.patch"
+           file://blktrace-api-compatibility.patch \
+           file://trace-cmd-Add-checks-for-invalid-pointers-to-fix-seg.patch \
+           file://trace-cmd-Do-not-call-stop_threads-if-doing-latency-.patch \
+           file://trace-cmd-Setting-plugin-to-nop-clears-data-before-i.patch \
+"
 S = "${WORKDIR}/git"
 
 EXTRA_OEMAKE = "'prefix=${prefix}'"
Signature · 1 line
1.7.10.4