]> git.hungrycats.org Git - linux/commitdiff
xtensa: fix get_wchan
authorMax Filippov <jcmvbkbc@gmail.com>
Wed, 2 Jan 2019 09:08:32 +0000 (01:08 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 10 Mar 2019 06:09:01 +0000 (07:09 +0100)
commit d90b88fd3653f1fb66ecc6571b860d5a5749fa56 upstream.

Stack unwinding is implemented incorrectly in xtensa get_wchan: instead
of extracting a0 and a1 registers from the spill location under the
stack pointer it extracts a word pointed to by the stack pointer and
subtracts 4 or 3 from it.

Cc: stable@vger.kernel.org
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/xtensa/kernel/process.c

index 74969a437a37cea70c273281d068b4633364f39f..2e73395f0560c58a6098078f534b2b845a552f86 100644 (file)
@@ -321,8 +321,8 @@ unsigned long get_wchan(struct task_struct *p)
 
                /* Stack layout: sp-4: ra, sp-3: sp' */
 
-               pc = MAKE_PC_FROM_RA(*(unsigned long*)sp - 4, sp);
-               sp = *(unsigned long *)sp - 3;
+               pc = MAKE_PC_FROM_RA(SPILL_SLOT(sp, 0), sp);
+               sp = SPILL_SLOT(sp, 1);
        } while (count++ < 16);
        return 0;
 }