Skip to contentSkip to conversation

perf report: Add validation of call-chain entries

tip:perfcounters/core tip-bot for Ingo Molnar 1 participant 1 message Jun 18, 2009 perf events

lore
Share & tools
lore
#0 lore raw
Commit-ID:  7522060c95395f479ee4a6af3bbf9e097e92e48f
Gitweb:     http://git.kernel.org/tip/7522060c95395f479ee4a6af3bbf9e097e92e48f
Author:     Ingo Molnar <[email protected]>
AuthorDate: Thu, 18 Jun 2009 08:00:17 +0200
Committer:  Ingo Molnar <[email protected]>
CommitDate: Thu, 18 Jun 2009 08:15:47 +0200

perf report: Add validation of call-chain entries

Add boundary checks for call-chain events. In case of corrupted entries we could crash otherwise.

Cc: Peter Zijlstra <[email protected]>
Cc: Mike Galbraith <[email protected]>
Cc: Paul Mackerras <[email protected]>
Cc: Arnaldo Carvalho de Melo <[email protected]>
LKML-Reference: <new-submission>

---
 include/linux/perf_counter.h |   20 ++++++------
 tools/perf/builtin-report.c  |   74 ++++++++++++++++++++++++++----------------
 2 files changed, 56 insertions(+), 38 deletions(-)
include/linux/perf_counter.h +10 -10
index eccae43..a7d3a61 100644
@@ -337,6 +337,16 @@ enum perf_event_type {
 	 */
 };
 
+#define MAX_STACK_DEPTH			255
+
+struct perf_callchain_entry {
+	__u16				nr;
+	__u16				hv;
+	__u16				kernel;
+	__u16				user;
+	__u64				ip[MAX_STACK_DEPTH];
+};
+
 #ifdef __KERNEL__
 /*
  * Kernel-internal data types and definitions:
@@ -652,16 +662,6 @@ extern void perf_counter_fork(struct task_struct *tsk);
 
 extern void perf_counter_task_migration(struct task_struct *task, int cpu);
 
-#define MAX_STACK_DEPTH			255
-
-struct perf_callchain_entry {
-	u16				nr;
-	u16				hv;
-	u16				kernel;
-	u16				user;
-	u64				ip[MAX_STACK_DEPTH];
-};
-
 extern struct perf_callchain_entry *perf_callchain(struct pt_regs *regs);
 
 extern int sysctl_perf_counter_paranoid;
tools/perf/builtin-report.c +46 -28

144 lines not on this page · raw message