linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: Masami Hiramatsu <mhiramat@kernel.org>
Cc: "Daniel Xu" <dxu@dxuuu.xyz>,
	linux-kernel@vger.kernel.org,
	"bpf@vger.kernel.org" <bpf@vger.kernel.org>,
	kuba@kernel.org
Subject: Re: Broken kretprobe stack traces
Date: Wed, 3 Mar 2021 09:26:04 -0500	[thread overview]
Message-ID: <20210303092604.59aea82c@gandalf.local.home> (raw)
In-Reply-To: <20210303134828.39922eb167524bc7206c7880@kernel.org>

On Wed, 3 Mar 2021 13:48:28 +0900
Masami Hiramatsu <mhiramat@kernel.org> wrote:

> 
> > 
> > I think (can't prove) this used to work:  

Would be good to find out if it did.

> 
> I'm not sure the bpftrace had correctly handled it or not.
> 
> > 
> >     # bpftrace -e 'kretprobe:__tcp_retransmit_skb { @[kstack()] = count() }'
> >     Attaching 1 probe...
> >     ^C
> > 
> >     @[
> >         kretprobe_trampoline+0
> >     ]: 1  
> 
> Would you know how the bpftrace stacktracer rewinds the stack entries?
> FYI, ftrace does it in trace_seq_print_sym()@kernel/trace/trace_output.c
> 

The difference between trace events and normal function tracing stack
traces is that it keeps its original return address. But kretprobes (and
function graph tracing, and some bpf trampolines too) modify the return
pointer, and that could possibly cause havoc with the stack trace.

-- Steve

  reply	other threads:[~2021-03-03 18:39 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-03  1:15 Broken kretprobe stack traces Daniel Xu
2021-03-03  4:48 ` Masami Hiramatsu
2021-03-03 14:26   ` Steven Rostedt [this message]
2021-03-03 19:58     ` Daniel Xu
2021-03-03 20:13       ` Daniel Xu
2021-03-03 20:37         ` Steven Rostedt
2021-03-04  2:18           ` Daniel Xu
2021-03-04 19:04             ` Daniel Xu
2021-03-04 13:19     ` Masami Hiramatsu
2021-03-04 15:22       ` [PATCH] kprobes: stacktrace: Recover the address changed by kretprobe kernel test robot
2021-03-04 17:37       ` kernel test robot
2021-03-04 20:25       ` kernel test robot
2021-03-03 19:57   ` Broken kretprobe stack traces Daniel Xu

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=20210303092604.59aea82c@gandalf.local.home \
    --to=rostedt@goodmis.org \
    --cc=bpf@vger.kernel.org \
    --cc=dxu@dxuuu.xyz \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mhiramat@kernel.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;
as well as URLs for NNTP newsgroup(s).