Generic Linux architectural discussions
 help / color / mirror / Atom feed
* [PATCH] csky: fixup dead loop in show_stack
@ 2019-01-31  7:02 guoren
  2019-01-31  7:02 ` guoren
  0 siblings, 1 reply; 2+ messages in thread
From: guoren @ 2019-01-31  7:02 UTC (permalink / raw)
  To: arnd; +Cc: linux-kernel, guoren, linux-arch, lu.baoquan, Guo Ren

From: Guo Ren <ren_guo@c-sky.com>

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@c-sky.com>
Reported-by: Lu Baoquan <lu.baoquan@intellif.com>
---
 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 659253e..d67f977 100644
--- a/arch/csky/kernel/dumpstack.c
+++ b/arch/csky/kernel/dumpstack.c
@@ -38,7 +38,11 @@ void show_stack(struct task_struct *task, unsigned long *stack)
 		if (task)
 			stack = (unsigned long *)thread_saved_fp(task);
 		else
+#ifdef CONFIG_STACKTRACE
+			asm volatile("mov %0, r8\n":"=r"(stack)::"memory");
+#else
 			stack = (unsigned long *)&stack;
+#endif
 	}
 
 	show_trace(stack);
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [PATCH] csky: fixup dead loop in show_stack
  2019-01-31  7:02 [PATCH] csky: fixup dead loop in show_stack guoren
@ 2019-01-31  7:02 ` guoren
  0 siblings, 0 replies; 2+ messages in thread
From: guoren @ 2019-01-31  7:02 UTC (permalink / raw)
  To: arnd; +Cc: linux-kernel, guoren, linux-arch, lu.baoquan, Guo Ren

From: Guo Ren <ren_guo@c-sky.com>

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@c-sky.com>
Reported-by: Lu Baoquan <lu.baoquan@intellif.com>
---
 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 659253e..d67f977 100644
--- a/arch/csky/kernel/dumpstack.c
+++ b/arch/csky/kernel/dumpstack.c
@@ -38,7 +38,11 @@ void show_stack(struct task_struct *task, unsigned long *stack)
 		if (task)
 			stack = (unsigned long *)thread_saved_fp(task);
 		else
+#ifdef CONFIG_STACKTRACE
+			asm volatile("mov %0, r8\n":"=r"(stack)::"memory");
+#else
 			stack = (unsigned long *)&stack;
+#endif
 	}
 
 	show_trace(stack);
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-01-31  7:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-01-31  7:02 [PATCH] csky: fixup dead loop in show_stack guoren
2019-01-31  7:02 ` guoren

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox