summaryrefslogtreecommitdiff
path: root/arch/arm/kernel
diff options
context:
space:
mode:
authorSonny Rao <sonnyrao@chromium.org>2011-04-18 21:12:59 (GMT)
committerRussell King <rmk+kernel@arm.linux.org.uk>2011-04-27 21:02:46 (GMT)
commit860ad7823fdc00cd61dc70e7f35e07fb327cc9a4 (patch)
tree810f49eaad81ab60b4469c7c1c5203539df42acd /arch/arm/kernel
parent167f829752f9cef51f59cc500abc0ad6ba69f5cb (diff)
downloadlinux-fsl-qoriq-860ad7823fdc00cd61dc70e7f35e07fb327cc9a4.tar.xz
ARM: 6884/1: Fix infinite loop in ARM user perf_event backtrace code
The ARM user backtrace code can get into an infinite loop if it runs into an invalid stack frame which points back to itself. This situation has been observed in practice. Fix it by capping the number of entries in the backtrace. This is also what other architectures do in their backtrace code. Signed-off-by: Sonny Rao <sonnyrao@chromium.org> Acked-by: Jamie Iles <jamie@jamieiles.com> Acked-by: Olof Johansson <olof@lixom.net> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/kernel')
-rw-r--r--arch/arm/kernel/perf_event.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/arch/arm/kernel/perf_event.c b/arch/arm/kernel/perf_event.c
index 979da39..139e3c8 100644
--- a/arch/arm/kernel/perf_event.c
+++ b/arch/arm/kernel/perf_event.c
@@ -746,7 +746,8 @@ perf_callchain_user(struct perf_callchain_entry *entry, struct pt_regs *regs)
tail = (struct frame_tail __user *)regs->ARM_fp - 1;
- while (tail && !((unsigned long)tail & 0x3))
+ while ((entry->nr < PERF_MAX_STACK_DEPTH) &&
+ tail && !((unsigned long)tail & 0x3))
tail = user_backtrace(tail, entry);
}