From: Ard Biesheuvel <ardb@kernel.org>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: Ard Biesheuvel <ardb+git@google.com>,
linux-trace-kernel@vger.kernel.org,
linux-kernel@vger.kernel.org,
Masami Hiramatsu <mhiramat@kernel.org>
Subject: Re: [PATCH] x86/ftrace: Don't bother preserving/restoring R10/R11
Date: Wed, 9 Oct 2024 19:10:53 +0200 [thread overview]
Message-ID: <CAMj1kXFcxOTKBZzT8gar58xZn+hsAN0gnu3ELKoYzmcXF76H5A@mail.gmail.com> (raw)
In-Reply-To: <20241009123153.4a26f226@gandalf.local.home>
On Wed, 9 Oct 2024 at 18:31, Steven Rostedt <rostedt@goodmis.org> wrote:
>
> On Wed, 9 Oct 2024 18:25:25 +0200
> Ard Biesheuvel <ardb@kernel.org> wrote:
>
> > > Say we have code of:
> > >
> > > pushq r10
> > > pushq r11
> > > call foo
> > > popq r11
> > > popq r10
> > >
> > > Where we add a kprobe to the start of foo, the callback should be able to
> > > see what r10 and r11 were.
> >
> > Why exactly is that? The contents of R10 and R11 have no purpose going
> > forward, so is it just to see what some previous code may have left in
> > them?
>
> Because the probe is on the call. Unless they were used between the push
> and the call, they still have the value you may be looking for.
>
Right. So putting a probe on foo() is a way to inspect the register
values during the execution if its caller. Fair enough.
> >
> > > But the restore part is for the function foo to
> > > see. It shouldn't care about r10 or r11 and if a kprobe updates them, it
> > > should not have any effect.
> > >
> > > What does restoring r10 and r11 give us?
> > >
> >
> > Nothing. Which is why I don't understand why you would need to record
> > them in the first place.
>
> As I mentioned above. Unless they are used after they are pushed, you still
> have access to them on the call (or the kprobe attached to ftrace).
>
OK. I just didn't imagine this usage mode, where you probe foo() to
capture the values of dead registers in its callers.
I'll send a v2 and drop the first hunk.
prev parent reply other threads:[~2024-10-09 17:11 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-09 15:39 [PATCH] x86/ftrace: Don't bother preserving/restoring R10/R11 Ard Biesheuvel
2024-10-09 16:02 ` Steven Rostedt
2024-10-09 16:13 ` Ard Biesheuvel
2024-10-09 16:19 ` Steven Rostedt
2024-10-09 16:25 ` Ard Biesheuvel
2024-10-09 16:31 ` Steven Rostedt
2024-10-09 17:10 ` Ard Biesheuvel [this message]
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=CAMj1kXFcxOTKBZzT8gar58xZn+hsAN0gnu3ELKoYzmcXF76H5A@mail.gmail.com \
--to=ardb@kernel.org \
--cc=ardb+git@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=mhiramat@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;
as well as URLs for NNTP newsgroup(s).