Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1610106
| From | Thadeu Lima de Souza Cascardo <cascardo@canonical.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH v2] powerpc: make /proc/self/stack always print the current stack |
| Date | 2017-03-27 22:20 +0200 |
| Message-ID | <tpJho-55U-7@gated-at.bofh.it> (permalink) |
| References | <tm2sh-kO-1@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
For the current task, the kernel stack would only tell the last time the
process was rescheduled, if ever. Use the current stack pointer for the
current task.
Otherwise, every once in a while, the stacktrace printed when reading
/proc/self/stack would look like the process is running in userspace,
while it's not, which some may consider as a bug.
This is also consistent with some other architectures, like x86 and arm,
at least.
Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
---
arch/powerpc/kernel/stacktrace.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/arch/powerpc/kernel/stacktrace.c b/arch/powerpc/kernel/stacktrace.c
index 6671195..d534ed9 100644
--- a/arch/powerpc/kernel/stacktrace.c
+++ b/arch/powerpc/kernel/stacktrace.c
@@ -59,7 +59,14 @@ EXPORT_SYMBOL_GPL(save_stack_trace);
void save_stack_trace_tsk(struct task_struct *tsk, struct stack_trace *trace)
{
- save_context_stack(trace, tsk->thread.ksp, tsk, 0);
+ unsigned long sp;
+
+ if (tsk == current)
+ sp = current_stack_pointer();
+ else
+ sp = tsk->thread.ksp;
+
+ save_context_stack(trace, sp, tsk, 0);
}
EXPORT_SYMBOL_GPL(save_stack_trace_tsk);
--
2.9.3
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH] powerpc: fix /proc/self/stack Thadeu Lima de Souza Cascardo <cascardo@canonical.com> - 2017-03-17 17:00 +0100
Re: [PATCH] powerpc: fix /proc/self/stack Michael Ellerman <mpe@ellerman.id.au> - 2017-03-22 12:20 +0100
[PATCH v2] powerpc: make /proc/self/stack always print the current stack Thadeu Lima de Souza Cascardo <cascardo@canonical.com> - 2017-03-27 22:20 +0200
Re: [v2] powerpc: make /proc/self/stack always print the current stack Michael Ellerman <patch-notifications@ellerman.id.au> - 2017-03-31 14:40 +0200
csiph-web