[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190311195516.137772-42-sashal@kernel.org>
Date: Mon, 11 Mar 2019 15:55:06 -0400
From: Sasha Levin <sashal@...nel.org>
To: linux-kernel@...r.kernel.org, stable@...r.kernel.org
Cc: Guo Ren <ren_guo@...ky.com>, Sasha Levin <sashal@...nel.org>
Subject: [PATCH AUTOSEL 4.20 42/52] csky: Fixup dead loop in show_stack
From: Guo Ren <ren_guo@...ky.com>
[ Upstream commit 131aee8b9807bc98379fa5a0270389dbc7dcec90 ]
When STACKTRACE is enabled, we must pass fp as stack for unwind,
otherwise random value in stack will casue a dead loop.
Signed-off-by: Guo Ren <ren_guo@...ky.com>
Reported-by: Lu Baoquan <lu.baoquan@...ellif.com>
Signed-off-by: Sasha Levin <sashal@...nel.org>
---
arch/csky/kernel/dumpstack.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/arch/csky/kernel/dumpstack.c b/arch/csky/kernel/dumpstack.c
index a9a03ac57ec5..28d2deb0848d 100644
--- a/arch/csky/kernel/dumpstack.c
+++ b/arch/csky/kernel/dumpstack.c
@@ -47,7 +47,11 @@ void show_stack(struct task_struct *task, unsigned long *stack)
if (task)
stack = (unsigned long *)task->thread.esp0;
else
+#ifdef CONFIG_STACKTRACE
+ asm volatile("mov %0, r8\n":"=r"(stack)::"memory");
+#else
stack = (unsigned long *)&stack;
+#endif
}
endstack = (unsigned long *)
(((unsigned long)stack + THREAD_SIZE - 1) & -THREAD_SIZE);
--
2.19.1
Powered by blists - more mailing lists