This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
[tip:perf/urgent] perf probe: Fix event namelist to duplicate string
- From: tip-bot for Masami Hiramatsu <mhiramat at redhat dot com>
- To: linux-tip-commits at vger dot kernel dot org
- Cc: linux-kernel at vger dot kernel dot org, acme at redhat dot com, hpa at zytor dot com, mingo at redhat dot com, dle-develop at lists dot sourceforge dot net, fweisbec at gmail dot com, tglx at linutronix dot de, mhiramat at redhat dot com, mingo at elte dot hu, systemtap at sources dot redhat dot com
- Date: Mon, 7 Dec 2009 17:37:03 GMT
- Subject: [tip:perf/urgent] perf probe: Fix event namelist to duplicate string
- Git-commit-id: e1d2017b24fb31602f1128e6a8b2afc54c9283cd
- References: <20091207170046.19230.55557.stgit@dhcp-100-2-132.bos.redhat.com>
- Reply-to: mingo at redhat dot com, hpa at zytor dot com, acme at redhat dot com, linux-kernel at vger dot kernel dot org, dle-develop at lists dot sourceforge dot net, fweisbec at gmail dot com, tglx at linutronix dot de, mhiramat at redhat dot com, mingo at elte dot hu, systemtap at sources dot redhat dot com
Commit-ID: e1d2017b24fb31602f1128e6a8b2afc54c9283cd
Gitweb: http://git.kernel.org/tip/e1d2017b24fb31602f1128e6a8b2afc54c9283cd
Author: Masami Hiramatsu <mhiramat@redhat.com>
AuthorDate: Mon, 7 Dec 2009 12:00:46 -0500
Committer: Ingo Molnar <mingo@elte.hu>
CommitDate: Mon, 7 Dec 2009 18:33:21 +0100
perf probe: Fix event namelist to duplicate string
Fix event namelist to duplicate string. Without duplicating, adding
multiple probes causes stack overwrite bug, because it reuses a
buffer on stack while the buffer is already added in the namelist.
String duplication solves this bug because only contents of the
buffer is copied to the namelist.
Signed-off-by: Masami Hiramatsu <mhiramat@redhat.com>
Cc: systemtap <systemtap@sources.redhat.com>
Cc: DLE <dle-develop@lists.sourceforge.net>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
LKML-Reference: <20091207170046.19230.55557.stgit@dhcp-100-2-132.bos.redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
tools/perf/util/probe-event.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
index cd7fbda..de0d913 100644
--- a/tools/perf/util/probe-event.c
+++ b/tools/perf/util/probe-event.c
@@ -413,12 +413,13 @@ static struct strlist *get_perf_event_names(int fd)
rawlist = get_trace_kprobe_event_rawlist(fd);
- sl = strlist__new(false, NULL);
+ sl = strlist__new(true, NULL);
for (i = 0; i < strlist__nr_entries(rawlist); i++) {
ent = strlist__entry(rawlist, i);
parse_trace_kprobe_event(ent->s, &group, &event, NULL);
strlist__add(sl, event);
free(group);
+ free(event);
}
strlist__delete(rawlist);
@@ -480,5 +481,6 @@ void add_trace_kprobe_events(struct probe_point *probes, int nr_probes)
strlist__add(namelist, event);
}
}
+ strlist__delete(namelist);
close(fd);
}