]> git.hungrycats.org Git - linux/commitdiff
Make kernel stack dumps handle unaligned kernel stacks more gracefully.
authorLinus Torvalds <torvalds@home.osdl.org>
Sun, 12 Oct 2003 11:44:23 +0000 (04:44 -0700)
committerLinus Torvalds <torvalds@home.osdl.org>
Sun, 12 Oct 2003 11:44:23 +0000 (04:44 -0700)
They can happen on x86 as a result of interrupts in BIOS calls.

Noted by Manfred Spraul.

arch/i386/kernel/traps.c
mm/slab.c

index db4e89ef4cbc226aed7e68d9629300cc4061dd49..3687472948ecc50f0caa355fbc28cdc3511154e6 100644 (file)
@@ -104,7 +104,7 @@ void show_trace(struct task_struct *task, unsigned long * stack)
 #ifdef CONFIG_KALLSYMS
        printk("\n");
 #endif
-       while (((long) stack & (THREAD_SIZE-1)) != 0) {
+       while (((long) stack & (THREAD_SIZE-4)) != 0) {
                addr = *stack++;
                if (kernel_text_address(addr)) {
                        printk(" [<%08lx>] ", addr);
@@ -138,7 +138,7 @@ void show_stack(struct task_struct *task, unsigned long *esp)
 
        stack = esp;
        for(i = 0; i < kstack_depth_to_print; i++) {
-               if (((long) stack & (THREAD_SIZE-1)) == 0)
+               if (((long) stack & (THREAD_SIZE-4)) == 0)
                        break;
                if (i && ((i % 8) == 0))
                        printk("\n       ");
index 7838f7f4dfc80d745559b2efcda494829bf5918b..1947a87227ab4e17c7e5d12b38b3bdf397915b5d 100644 (file)
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -862,7 +862,7 @@ static void store_stackinfo(kmem_cache_t *cachep, unsigned long *addr, unsigned
                unsigned long *sptr = &caller;
                unsigned long svalue;
 
-               while (((long) sptr & (THREAD_SIZE-1)) != 0) {
+               while (((long) sptr & (THREAD_SIZE-4)) != 0) {
                        svalue = *sptr++;
                        if (kernel_text_address(svalue)) {
                                *addr++=svalue;