Skip to contentSkip to conversation

perf: fix coredump caused by introduce of probe module option

PATCH In review [email protected] 2 participants 4 messages Jul 30, 2011 – Aug 10, 2011 perf events

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 perf: fix coredump caused by introduce of probe module option

From: root <[email protected]>

perf will coredump if user don't give "-m" option in probe command, this patch fix it.

[root@localhost perf]# ./perf probe --add='PROBE'
Segmentation fault (core dumped)

---
 tools/perf/util/probe-event.c |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)
tools/perf/util/probe-event.c +8 -4
index b82d54f..1c7bfa5 100644
@@ -1820,11 +1820,15 @@ static int convert_to_probe_trace_events(struct perf_probe_event *pev,
 		ret = -ENOMEM;
 		goto error;
 	}
-	tev->point.module = strdup(module);
-	if (tev->point.module == NULL) {
-		ret = -ENOMEM;
-		goto error;
+
+	if (module) {
+		tev->point.module = strdup(module);
+		if (tev->point.module == NULL) {
+			ret = -ENOMEM;
+			goto error;
+		}
 	}
+
 	tev->point.offset = pev->point.offset;
 	tev->point.retprobe = pev->point.retprobe;
 	tev->nargs = pev->nargs;
Signature · 1 line
1.6.5.2
author
#1 lore raw
Quoted 5 lines · On Mon, Jul 25, 2011 at 10:08 PM,  <[email protected]> wrote:

From: root <[email protected]>

perf will coredump if user don't give "-m" option in probe command, this patch fix it.

Quoted 8 lines

[root@localhost perf]# ./perf probe --add='PROBE'
Segmentation fault (core dumped)

---
 tools/perf/util/probe-event.c |   12 ++++++++----

 1 files changed, 8 insertions(+), 4 deletions(-)

Hi acme,
   Can this patch go through your tree?
   (Get rid of "From" field, that's suck. :))

.jovi

#2 lore raw

Em Mon, Aug 08, 2011 at 11:01:19AM +0800, Jovi Zhang escreveu:

Quoted 15 lines · On Mon, Jul 25, 2011 at 10:08 PM,  <[email protected]> wrote:
Quoted 5 lines

From: root <[email protected]>

perf will coredump if user don't give "-m" option in probe command, this patch fix it.

Quoted 8 lines

[root@localhost perf]# ./perf probe --add='PROBE'
Segmentation fault (core dumped)

---
 tools/perf/util/probe-event.c |   12 ++++++++----

 1 files changed, 8 insertions(+), 4 deletions(-)
Quoted 3 lines

Hi acme,
   Can this patch go through your tree?
   (Get rid of "From" field, that's suck. :))

yeah, I'm applying it.

Thanks,

- Arnaldo

#3 lore raw

[tip:perf/urgent] perf probe: Fix coredump introduced by probe module option

In reply to [email protected]
Commit-ID:  ce27a443d17dccf613079a7147cf0d220bc4ec82
Gitweb:     http://git.kernel.org/tip/ce27a443d17dccf613079a7147cf0d220bc4ec82
Author:     Jovi Zhang <[email protected]>
AuthorDate: Mon, 25 Jul 2011 22:08:08 +0800
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Mon, 8 Aug 2011 09:35:41 -0300

perf probe: Fix coredump introduced by probe module option

perf will coredump if the user doesn't give the "-m" option in probe command, this patch fixes it.

[root@localhost perf]# ./perf probe --add='PROBE'
Segmentation fault (core dumped)

---
 tools/perf/util/probe-event.c |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)
tools/perf/util/probe-event.c +8 -4
index b82d54f..1c7bfa5 100644
@@ -1820,11 +1820,15 @@ static int convert_to_probe_trace_events(struct perf_probe_event *pev,
 		ret = -ENOMEM;
 		goto error;
 	}
-	tev->point.module = strdup(module);
-	if (tev->point.module == NULL) {
-		ret = -ENOMEM;
-		goto error;
+
+	if (module) {
+		tev->point.module = strdup(module);
+		if (tev->point.module == NULL) {
+			ret = -ENOMEM;
+			goto error;
+		}
 	}
+
 	tev->point.offset = pev->point.offset;
 	tev->point.retprobe = pev->point.retprobe;
 	tev->nargs = pev->nargs;