Commit 594087a04eea544356f9c52e83c1a9bc380ce80f

Authored by Masami Hiramatsu
Committed by Ingo Molnar
1 parent 9f591fd76a

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>

Showing 2 changed files with 3 additions and 1 deletions Side-by-side Diff

tools/perf/builtin-probe.c
... ... @@ -47,7 +47,6 @@
47 47 #include "util/probe-event.h"
48 48  
49 49 #define MAX_PATH_LEN 256
50   -#define MAX_PROBES 128
51 50  
52 51 /* Session management structure */
53 52 static struct {
tools/perf/util/probe-finder.c
... ... @@ -455,6 +455,9 @@
455 455 /* *pf->fb_ops will be cached in libdw. Don't free it. */
456 456 pf->fb_ops = NULL;
457 457  
  458 + if (pp->found == MAX_PROBES)
  459 + die("Too many( > %d) probe point found.\n", MAX_PROBES);
  460 +
458 461 pp->probes[pp->found] = strdup(tmp);
459 462 pp->found++;
460 463 }