]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - queue-4.9/xtensa-fix-get_wchan.patch
4.9-stable patches
[thirdparty/kernel/stable-queue.git] / queue-4.9 / xtensa-fix-get_wchan.patch
1 From d90b88fd3653f1fb66ecc6571b860d5a5749fa56 Mon Sep 17 00:00:00 2001
2 From: Max Filippov <jcmvbkbc@gmail.com>
3 Date: Wed, 2 Jan 2019 01:08:32 -0800
4 Subject: xtensa: fix get_wchan
5
6 From: Max Filippov <jcmvbkbc@gmail.com>
7
8 commit d90b88fd3653f1fb66ecc6571b860d5a5749fa56 upstream.
9
10 Stack unwinding is implemented incorrectly in xtensa get_wchan: instead
11 of extracting a0 and a1 registers from the spill location under the
12 stack pointer it extracts a word pointed to by the stack pointer and
13 subtracts 4 or 3 from it.
14
15 Cc: stable@vger.kernel.org
16 Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
17 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
18
19 ---
20 arch/xtensa/kernel/process.c | 4 ++--
21 1 file changed, 2 insertions(+), 2 deletions(-)
22
23 --- a/arch/xtensa/kernel/process.c
24 +++ b/arch/xtensa/kernel/process.c
25 @@ -311,8 +311,8 @@ unsigned long get_wchan(struct task_stru
26
27 /* Stack layout: sp-4: ra, sp-3: sp' */
28
29 - pc = MAKE_PC_FROM_RA(*(unsigned long*)sp - 4, sp);
30 - sp = *(unsigned long *)sp - 3;
31 + pc = MAKE_PC_FROM_RA(SPILL_SLOT(sp, 0), sp);
32 + sp = SPILL_SLOT(sp, 1);
33 } while (count++ < 16);
34 return 0;
35 }