]> bbs.cooldavid.org Git - net-next-2.6.git/commitdiff
ARM: 6468/1: backtrace: fix calculation of thread stack base
authorWill Deacon <will.deacon@arm.com>
Thu, 4 Nov 2010 17:22:51 +0000 (18:22 +0100)
committerRussell King <rmk+kernel@arm.linux.org.uk>
Sun, 7 Nov 2010 16:12:37 +0000 (16:12 +0000)
When unwinding stack frames we must take care not to unwind
areas of memory that lie outside of the known extent of the stack.

This patch fixes an incorrect calculation of the stack base where
THREAD_SIZE is added to the stack pointer after it has already
been aligned to this value. Since the ALIGN macro performs this
addition internally, we end up overshooting the base by 8k.

Acked-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
arch/arm/kernel/stacktrace.c
arch/arm/kernel/unwind.c

index 20b7411e47fdeef9e31606e665957ea862638f5a..c2e112e1a05fbf0d4485db1236448653e25aa8cc 100644 (file)
@@ -28,7 +28,7 @@ int notrace unwind_frame(struct stackframe *frame)
 
        /* only go to a higher address on the stack */
        low = frame->sp;
-       high = ALIGN(low, THREAD_SIZE) + THREAD_SIZE;
+       high = ALIGN(low, THREAD_SIZE);
 
        /* check current frame pointer is within bounds */
        if (fp < (low + 12) || fp + 4 >= high)
index 2a161765f6d5fdc0ac07805c2a4a62957adf72a0..d2cb0b3c987216b4b7eea39289b739fbc7d0136d 100644 (file)
@@ -279,7 +279,7 @@ int unwind_frame(struct stackframe *frame)
 
        /* only go to a higher address on the stack */
        low = frame->sp;
-       high = ALIGN(low, THREAD_SIZE) + THREAD_SIZE;
+       high = ALIGN(low, THREAD_SIZE);
 
        pr_debug("%s(pc = %08lx lr = %08lx sp = %08lx)\n", __func__,
                 frame->pc, frame->lr, frame->sp);