Skip to content

Commit

Permalink
perf probe: Fix probe_point buffer overrun
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Masami Hiramatsu authored and Ingo Molnar committed Mar 13, 2010
1 parent 9f591fd commit 594087a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 0 additions & 1 deletion tools/perf/builtin-probe.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@
#include "util/probe-event.h"

#define MAX_PATH_LEN 256
#define MAX_PROBES 128

/* Session management structure */
static struct {
Expand Down
3 changes: 3 additions & 0 deletions tools/perf/util/probe-finder.c
Original file line number Diff line number Diff line change
Expand Up @@ -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++;
}
Expand Down

0 comments on commit 594087a

Please sign in to comment.