[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20191025142110.jgz5jy4nuryhawv5@treble>
Date: Fri, 25 Oct 2019 09:21:10 -0500
From: Josh Poimboeuf <jpoimboe@...hat.com>
To: Jiri Slaby <jslaby@...e.cz>
Cc: tglx@...utronix.de, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] stacktrace: don't skip first entry on noncurrent tasks
On Fri, Oct 25, 2019 at 08:52:26AM +0200, Jiri Slaby wrote:
> When doing cat /proc/<PID>/stack, the output is missing the first entry.
> When the current code walks the stack starting in stack_trace_save_tsk,
> it skips all scheduler functions (that's OK) plus one more function. But
> this one function should be skipped only for the 'current' task as it is
> stack_trace_save_tsk proper.
>
> The original code (before the common infrastructure) skipped one
> function only for the 'current' task -- see save_stack_trace_tsk before
> 3599fe12a125. So do so also in the new infrastructure now.
>
> Signed-off-by: Jiri Slaby <jslaby@...e.cz>
> Fixes: 214d8ca6ee85 ("stacktrace: Provide common infrastructure")
> Cc: Thomas Gleixner <tglx@...utronix.de>
> Cc: Josh Poimboeuf <jpoimboe@...hat.com>
> ---
> kernel/stacktrace.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/kernel/stacktrace.c b/kernel/stacktrace.c
> index 6d1f68b7e528..d06a2e4d0142 100644
> --- a/kernel/stacktrace.c
> +++ b/kernel/stacktrace.c
> @@ -141,7 +141,8 @@ unsigned int stack_trace_save_tsk(struct task_struct *tsk, unsigned long *store,
> struct stacktrace_cookie c = {
> .store = store,
> .size = size,
> - .skip = skipnr + 1,
> + /* skip this function if they are tracing us */
> + .skip = skipnr + !!(current == tsk),
> };
>
> if (!try_get_task_stack(tsk))
I think a similar change is needed for the other !CONFIG_ARCH_STACKWALK
version of stack_trace_save_tsk() in that file?
--
Josh
Powered by blists - more mailing lists