From: Vasily Gorbik <gor@linux.ibm.com>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: Josef Bacik <jbacik@fb.com>, linux-kernel@vger.kernel.org
Subject: Re: User stacktrace garbage when USER_STACKTRACE_SUPPORT is not enabled
Date: Wed, 31 Mar 2021 22:51:15 +0200 [thread overview]
Message-ID: <your-ad-here.call-01617223875-ext-7005@work.hours> (raw)
In-Reply-To: <20210331103749.01a7c283@gandalf.local.home>
On Wed, Mar 31, 2021 at 10:37:49AM -0400, Steven Rostedt wrote:
> But after writing all of the above, I think I found a bug! It's this:
>
> size = nr_entries * sizeof(unsigned long);
> event = __trace_buffer_lock_reserve(buffer, TRACE_STACK,
> sizeof(*entry) + size, trace_ctx);
>
>
> I said the above commit did not play a role in output, but it does play a
> role in creating the struct stack_trace entry. And by making it a fixed
> array (even though it's not used) it added 8 more entries to the stack!
>
> This should fix the problem:
>
> -- Steve
>
> diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
> index 3c605957bb5c..507a30bf26e4 100644
> --- a/kernel/trace/trace.c
> +++ b/kernel/trace/trace.c
> @@ -2985,7 +2985,8 @@ static void __ftrace_trace_stack(struct trace_buffer *buffer,
>
> size = nr_entries * sizeof(unsigned long);
> event = __trace_buffer_lock_reserve(buffer, TRACE_STACK,
> - sizeof(*entry) + size, trace_ctx);
> + (sizeof(*entry) - sizeof(entry->caller)) + size,
> + trace_ctx);
> if (!event)
> goto out;
> entry = ring_buffer_event_data(event);
It does! Thanks for the explanation and for the fix. I wonder why nobody
noticed and complained about that since v5.6.
Acked-by: Vasily Gorbik <gor@linux.ibm.com>
next prev parent reply other threads:[~2021-03-31 20:52 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-31 11:52 User stacktrace garbage when USER_STACKTRACE_SUPPORT is not enabled Vasily Gorbik
2021-03-31 14:37 ` Steven Rostedt
2021-03-31 20:51 ` Vasily Gorbik [this message]
2021-03-31 21:09 ` Steven Rostedt
2021-03-31 22:02 ` Vasily Gorbik
2021-03-31 22:27 ` Steven Rostedt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=your-ad-here.call-01617223875-ext-7005@work.hours \
--to=gor@linux.ibm.com \
--cc=jbacik@fb.com \
--cc=linux-kernel@vger.kernel.org \
--cc=rostedt@goodmis.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox