From: Jiri Olsa <olsajiri@gmail.com>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: Jiri Olsa <olsajiri@gmail.com>, Feng Yang <yangfeng59949@163.com>,
andrii@kernel.org, bpf@vger.kernel.org, jpoimboe@kernel.org,
linux-trace-kernel@vger.kernel.org, mhiramat@kernel.org,
peterz@infradead.org, x86@kernel.org, yhs@fb.com
Subject: Re: [BUG] no ORC stacktrace from kretprobe.multi bpf program
Date: Thu, 23 Oct 2025 22:42:08 +0200 [thread overview]
Message-ID: <aPqTIDSHOSTiwYA6@krava> (raw)
In-Reply-To: <20251022171711.5c18f043@gandalf.local.home>
On Wed, Oct 22, 2025 at 05:17:11PM -0400, Steven Rostedt wrote:
> On Wed, 22 Oct 2025 22:41:20 +0200
> Jiri Olsa <olsajiri@gmail.com> wrote:
>
> > >
> > > > ANNOTATE_NOENDBR
> > > > + push $return_to_handler
> > > > + UNWIND_HINT_FUNC
> > >
> > > OK, so what happened here is that you put in the return_to_handle into the
> > > stack and told ORC that this is a normal function, and that when it
> > > triggers to do a lookup from the handler itself.
> >
> > together with the "push $return_to_handler" it suppose to instruct ftrace_graph_ret_addr
> > to go get the 'real' return address from shadow stack
> >
> > >
> > > I wonder if we could just add a new UNWIND_HINT that tells ORC to do that?
> >
> > if I remove the initial UNWIND_HINT_UNDEFINED I get objtool warning
> > about unreachable instruction
>
> Right. I was thinking we add UNWIND_HINT_RETHOOK and an
> UNWIND_HINT_TYPE_RETHOOK that lets objtool know that this function is a
> "return_to_hook" function and the unwinder can do something special with it.
>
> >
> > >
> > > >
> > > > /* Save ftrace_regs for function exit context */
> > > > subq $(FRAME_SIZE), %rsp
> > > > @@ -360,6 +362,9 @@ SYM_CODE_START(return_to_handler)
> > > > movq %rax, RAX(%rsp)
> > > > movq %rdx, RDX(%rsp)
> > > > movq %rbp, RBP(%rsp)
> > > > + movq %rsp, RSP(%rsp)
> > > > + movq $0, EFLAGS(%rsp)
> > > > + movq $__KERNEL_CS, CS(%rsp)
> > >
> > > Is this simulating some kind of interrupt?
> >
> > there are several checks in pt_regs on these fields
> >
> > - in get_perf_callchain we check user_mode(regs) so CS has to be set
> > - in perf_callchain_kernel we call perf_hw_regs(regs), so EFLAGS has to be set
>
> So this is a different issue. I rather have this added in
> kprobe_multi_link_prog_run as its the only user of it. Or have the
there's also fprobe tracer that probably needs it as well
> ftrace_regs conversion update it. This isn't something that should be done
> at every call and slow everyone else down.
I think it's ok, but not sure where to get rsp value at that point,
perhaps we could just use the pt_regs address
jirka
>
> >
> > >
> > > > movq %rsp, %rdi
> > > >
> > > > call ftrace_return_to_handler
SNIP
next prev parent reply other threads:[~2025-10-23 20:42 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-08 21:08 [BUG] no ORC stacktrace from kretprobe.multi bpf program Jiri Olsa
2025-10-12 4:09 ` Masami Hiramatsu
2025-10-13 14:36 ` Jiri Olsa
2025-10-13 17:10 ` Steven Rostedt
2025-10-15 16:06 ` Josh Poimboeuf
2025-10-15 16:11 ` Steven Rostedt
2025-10-22 9:04 ` Feng Yang
2025-10-22 12:32 ` Jiri Olsa
2025-10-22 14:28 ` Steven Rostedt
2025-10-22 20:41 ` Jiri Olsa
2025-10-22 21:17 ` Steven Rostedt
2025-10-23 20:42 ` Jiri Olsa [this message]
2025-10-23 20:55 ` 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=aPqTIDSHOSTiwYA6@krava \
--to=olsajiri@gmail.com \
--cc=andrii@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=jpoimboe@kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=mhiramat@kernel.org \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=x86@kernel.org \
--cc=yangfeng59949@163.com \
--cc=yhs@fb.com \
/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