[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20120325.162808.1311176271259118121.davem@davemloft.net>
Date: Sun, 25 Mar 2012 16:28:08 -0400 (EDT)
From: David Miller <davem@...emloft.net>
To: acme@...stprotocols.net
CC: linux-kernel@...r.kernel.org
Subject: [PATCH 1/5] perf: Validate address in symbol__inc_addr_samples().
If addr < sym->start then we are going to access past the end of the
h->addr[] array, since the offset calculated will be huge.
Trigger an assertion instead of randomly scribbling memory when this
situation occurs.
Signed-off-by: David S. Miller <davem@...emloft.net>
---
tools/perf/util/annotate.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c
index e5a462f..734a503 100644
--- a/tools/perf/util/annotate.c
+++ b/tools/perf/util/annotate.c
@@ -15,6 +15,7 @@
#include "debug.h"
#include "annotate.h"
#include <pthread.h>
+#include <assert.h>
const char *disassembler_style;
@@ -64,6 +65,7 @@ int symbol__inc_addr_samples(struct symbol *sym, struct map *map,
pr_debug3("%s: addr=%#" PRIx64 "\n", __func__, map->unmap_ip(map, addr));
+ assert(addr >= sym->start);
if (addr >= sym->end)
return 0;
--
1.7.9.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists