diff options
author | Ingo Molnar <mingo@elte.hu> | 2009-06-18 02:00:17 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-06-18 02:15:47 -0400 |
commit | 7522060c95395f479ee4a6af3bbf9e097e92e48f (patch) | |
tree | 3530611cfd45c75c5a1952210edb2953598a9afe /include/linux/perf_counter.h | |
parent | b25bcf2f133b1e6216c3d40be394756107d3880f (diff) |
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 <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'include/linux/perf_counter.h')
-rw-r--r-- | include/linux/perf_counter.h | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/include/linux/perf_counter.h b/include/linux/perf_counter.h index eccae437fe37..a7d3a61a59b7 100644 --- a/include/linux/perf_counter.h +++ b/include/linux/perf_counter.h | |||
@@ -337,6 +337,16 @@ enum perf_event_type { | |||
337 | */ | 337 | */ |
338 | }; | 338 | }; |
339 | 339 | ||
340 | #define MAX_STACK_DEPTH 255 | ||
341 | |||
342 | struct perf_callchain_entry { | ||
343 | __u16 nr; | ||
344 | __u16 hv; | ||
345 | __u16 kernel; | ||
346 | __u16 user; | ||
347 | __u64 ip[MAX_STACK_DEPTH]; | ||
348 | }; | ||
349 | |||
340 | #ifdef __KERNEL__ | 350 | #ifdef __KERNEL__ |
341 | /* | 351 | /* |
342 | * Kernel-internal data types and definitions: | 352 | * Kernel-internal data types and definitions: |
@@ -652,16 +662,6 @@ extern void perf_counter_fork(struct task_struct *tsk); | |||
652 | 662 | ||
653 | extern void perf_counter_task_migration(struct task_struct *task, int cpu); | 663 | extern void perf_counter_task_migration(struct task_struct *task, int cpu); |
654 | 664 | ||
655 | #define MAX_STACK_DEPTH 255 | ||
656 | |||
657 | struct perf_callchain_entry { | ||
658 | u16 nr; | ||
659 | u16 hv; | ||
660 | u16 kernel; | ||
661 | u16 user; | ||
662 | u64 ip[MAX_STACK_DEPTH]; | ||
663 | }; | ||
664 | |||
665 | extern struct perf_callchain_entry *perf_callchain(struct pt_regs *regs); | 665 | extern struct perf_callchain_entry *perf_callchain(struct pt_regs *regs); |
666 | 666 | ||
667 | extern int sysctl_perf_counter_paranoid; | 667 | extern int sysctl_perf_counter_paranoid; |