From: Segher Boessenkool <segher@kernel.crashing.org>
To: Hari Bathini <hbathini@linux.ibm.com>
Cc: Shuah Khan <shuah@kernel.org>,
linux-kselftest@vger.kernel.org,
Steven Rostedt <rostedt@goodmis.org>,
Masami Hiramatsu <mhiramat@kernel.org>,
Michael Ellerman <mpe@ellerman.id.au>,
Madhavan Srinivasan <maddy@linux.ibm.com>,
"Naveen N. Rao" <naveen@kernel.org>,
lkml <linux-kernel@vger.kernel.org>,
linux-trace-kernel@vger.kernel.org,
linuxppc-dev <linuxppc-dev@lists.ozlabs.org>
Subject: Re: [PATCH] selftests/ftrace: update kprobe syntax error test for ppc64le
Date: Tue, 5 Nov 2024 02:20:18 -0600 [thread overview]
Message-ID: <20241105082018.GA29862@gate.crashing.org> (raw)
In-Reply-To: <f7e8243a-a4c8-44ce-ad03-7d232df461ed@linux.ibm.com>
Hi!
On Mon, Nov 04, 2024 at 11:06:23PM +0530, Hari Bathini wrote:
> Seems like a bit of misunderstanding there. Function entry here intends
> to mean the actual start of function code (function prologue) - after
> GEP and function profiling sequence (mflr r0; bl mcount).
What you call "function entry" here simply does not exist. The compiler
can -- and ***WILL***, ***DOES*** -- mix up all of that. In particular,
"function prologue" does not exist at all (on any architecture worth
its salt, including PowerPC), and all instructions you consider part of
a function prologue might end up anywhere. The "profiling sequence" is
part of that btw, and that typically ends up *not* the first thing in
the function, not the first thing after the LEP (register saves are
earlier often, they are generated in that order in the first place,
but they can (and will) be moved if that schedules better).
> Function arguments can be accessed with kprobe only while setting a
> probe at an address the kernel treats as function start address.
That is a silly assumption to make. There is no guarantee you can
access function arguments *at all*, we're not in 1975 anymore. You
*need* to look at debug information if you want to deal with anything
about your high-level language program. Looking at the machine code
can only tell you about the machine state, whatever is in registers
etc.
> Note that the test case pass criteria here is setting probe to fail by
> providing an address (sym+offset) beyond the function start address.
>
> And in this specific test case (with "vfs_read+8", where vfs_read is
> the symbol and '8' is the offset), the test case was failing on powerpc
> because setting the probe at 'sym+8' was succeeding, as anywhere between
> 'sym' to 'sym+16' is treated as function start address on powerpc:
Yeah, fragile tests sometimes break. Changing a randomly chosen number
to some other randomly chosen number will not fix the problem (but you
can postpone having to deal with it, sure!)
Segher
next prev parent reply other threads:[~2024-11-05 8:23 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-01 19:19 [PATCH] selftests/ftrace: update kprobe syntax error test for ppc64le Hari Bathini
2024-11-01 20:59 ` Segher Boessenkool
2024-11-04 9:21 ` Hari Bathini
2024-11-04 9:44 ` Segher Boessenkool
2024-11-04 10:10 ` Hari Bathini
2024-11-04 10:36 ` Segher Boessenkool
2024-11-04 15:27 ` Steven Rostedt
2024-11-04 17:36 ` Hari Bathini
2024-11-05 8:20 ` Segher Boessenkool [this message]
2024-11-05 9:17 ` Masami Hiramatsu
2024-11-05 19:52 ` Segher Boessenkool
2024-11-06 5:54 ` Hari Bathini
2024-11-03 4:57 ` Masami Hiramatsu
2024-11-04 9:32 ` Hari Bathini
2024-11-05 8:37 ` Masami Hiramatsu
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=20241105082018.GA29862@gate.crashing.org \
--to=segher@kernel.crashing.org \
--cc=hbathini@linux.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=maddy@linux.ibm.com \
--cc=mhiramat@kernel.org \
--cc=mpe@ellerman.id.au \
--cc=naveen@kernel.org \
--cc=rostedt@goodmis.org \
--cc=shuah@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).