summaryrefslogtreecommitdiff
path: root/tools/perf
diff options
context:
space:
mode:
authorMasami Hiramatsu <mhiramat@redhat.com>2010-03-13 02:22:17 +0300
committerIngo Molnar <mingo@elte.hu>2010-03-13 10:32:22 +0300
commit594087a04eea544356f9c52e83c1a9bc380ce80f (patch)
tree30aef0f600edc6bb20d77974c9de2c923aabec8f /tools/perf
parent9f591fd76afdc0e5192e9ed00a36f8efc0b4dfe6 (diff)
downloadlinux-594087a04eea544356f9c52e83c1a9bc380ce80f.tar.xz
perf probe: Fix probe_point buffer overrun
Fix probe_point array-size overrun problem. In some cases (e.g. inline function), one user-specified probe-point can be translated to many probe address, and it overruns pre-defined array-size. This also removes redundant MAX_PROBES macro definition. Signed-off-by: Masami Hiramatsu <mhiramat@redhat.com> Cc: systemtap <systemtap@sources.redhat.com> Cc: DLE <dle-develop@lists.sourceforge.net> Cc: <stable@kernel.org> LKML-Reference: <20100312232217.2017.45017.stgit@localhost6.localdomain6> [ Note that only root can create new probes. Eventually we should remove the MAX_PROBES limit, but that is a larger patch not eligible to perf/urgent treatment. ] Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'tools/perf')
-rw-r--r--tools/perf/builtin-probe.c1
-rw-r--r--tools/perf/util/probe-finder.c3
2 files changed, 3 insertions, 1 deletions
diff --git a/tools/perf/builtin-probe.c b/tools/perf/builtin-probe.c
index c30a33592340..152d6c9b1fa4 100644
--- a/tools/perf/builtin-probe.c
+++ b/tools/perf/builtin-probe.c
@@ -47,7 +47,6 @@
#include "util/probe-event.h"
#define MAX_PATH_LEN 256
-#define MAX_PROBES 128
/* Session management structure */
static struct {
diff --git a/tools/perf/util/probe-finder.c b/tools/perf/util/probe-finder.c
index 1e6c65ebbd80..f9cbbf18e6ca 100644
--- a/tools/perf/util/probe-finder.c
+++ b/tools/perf/util/probe-finder.c
@@ -455,6 +455,9 @@ static void show_probe_point(Dwarf_Die *sp_die, struct probe_finder *pf)
/* *pf->fb_ops will be cached in libdw. Don't free it. */
pf->fb_ops = NULL;
+ if (pp->found == MAX_PROBES)
+ die("Too many( > %d) probe point found.\n", MAX_PROBES);
+
pp->probes[pp->found] = strdup(tmp);
pp->found++;
}