* [PATCH v2] selftests/ftrace: adjust offset for kprobe syntax error test
@ 2024-11-29 20:26 Hari Bathini
2024-12-02 19:41 ` Steven Rostedt
0 siblings, 1 reply; 6+ messages in thread
From: Hari Bathini @ 2024-11-29 20:26 UTC (permalink / raw)
To: Shuah Khan, linux-kselftest
Cc: Masami Hiramatsu, Steven Rostedt, Michael Ellerman,
Madhavan Srinivasan, Naveen N. Rao, linuxppc-dev,
linux-trace-kernel, linux-kernel
In 'NOFENTRY_ARGS' test case for syntax check, any offset X of
`vfs_read+X` except function entry offset (0) fits the criterion,
even if that offset is not at instruction boundary, as the parser
comes before probing. But with "ENDBR64" instruction on x86, offset
4 is treated as function entry. So, X can't be 4 as well. Thus, 8
was used as offset for the test case. On 64-bit powerpc though, any
offset <= 16 can be considered function entry depending on build
configuration (see arch_kprobe_on_func_entry() for implementation
details). So, use `vfs_read+20` to accommodate that scenario too.
Suggested-by: Masami Hiramatsu <mhiramat@kernel.org>
Signed-off-by: Hari Bathini <hbathini@linux.ibm.com>
---
Changes in v2:
* Use 20 as offset for all arches.
.../selftests/ftrace/test.d/kprobe/kprobe_syntax_errors.tc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_syntax_errors.tc b/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_syntax_errors.tc
index a16c6a6f6055..8f1c58f0c239 100644
--- a/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_syntax_errors.tc
+++ b/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_syntax_errors.tc
@@ -111,7 +111,7 @@ check_error 'p vfs_read $arg* ^$arg*' # DOUBLE_ARGS
if !grep -q 'kernel return probes support:' README; then
check_error 'r vfs_read ^$arg*' # NOFENTRY_ARGS
fi
-check_error 'p vfs_read+8 ^$arg*' # NOFENTRY_ARGS
+check_error 'p vfs_read+20 ^$arg*' # NOFENTRY_ARGS
check_error 'p vfs_read ^hoge' # NO_BTFARG
check_error 'p kfree ^$arg10' # NO_BTFARG (exceed the number of parameters)
check_error 'r kfree ^$retval' # NO_RETVAL
--
2.47.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v2] selftests/ftrace: adjust offset for kprobe syntax error test
2024-11-29 20:26 [PATCH v2] selftests/ftrace: adjust offset for kprobe syntax error test Hari Bathini
@ 2024-12-02 19:41 ` Steven Rostedt
2024-12-04 1:01 ` Shuah Khan
0 siblings, 1 reply; 6+ messages in thread
From: Steven Rostedt @ 2024-12-02 19:41 UTC (permalink / raw)
To: Hari Bathini
Cc: Shuah Khan, linux-kselftest, Masami Hiramatsu, Michael Ellerman,
Madhavan Srinivasan, Naveen N. Rao, linuxppc-dev,
linux-trace-kernel, linux-kernel
On Sat, 30 Nov 2024 01:56:21 +0530
Hari Bathini <hbathini@linux.ibm.com> wrote:
> In 'NOFENTRY_ARGS' test case for syntax check, any offset X of
> `vfs_read+X` except function entry offset (0) fits the criterion,
> even if that offset is not at instruction boundary, as the parser
> comes before probing. But with "ENDBR64" instruction on x86, offset
> 4 is treated as function entry. So, X can't be 4 as well. Thus, 8
> was used as offset for the test case. On 64-bit powerpc though, any
> offset <= 16 can be considered function entry depending on build
> configuration (see arch_kprobe_on_func_entry() for implementation
> details). So, use `vfs_read+20` to accommodate that scenario too.
>
> Suggested-by: Masami Hiramatsu <mhiramat@kernel.org>
> Signed-off-by: Hari Bathini <hbathini@linux.ibm.com>
Acked-by: Steven Rostedt (Google) <rostedt@goodmis.org>
Shuah,
Can you take this through your tree?
Thanks,
-- Steve
> ---
>
> Changes in v2:
> * Use 20 as offset for all arches.
>
>
> .../selftests/ftrace/test.d/kprobe/kprobe_syntax_errors.tc | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_syntax_errors.tc b/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_syntax_errors.tc
> index a16c6a6f6055..8f1c58f0c239 100644
> --- a/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_syntax_errors.tc
> +++ b/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_syntax_errors.tc
> @@ -111,7 +111,7 @@ check_error 'p vfs_read $arg* ^$arg*' # DOUBLE_ARGS
> if !grep -q 'kernel return probes support:' README; then
> check_error 'r vfs_read ^$arg*' # NOFENTRY_ARGS
> fi
> -check_error 'p vfs_read+8 ^$arg*' # NOFENTRY_ARGS
> +check_error 'p vfs_read+20 ^$arg*' # NOFENTRY_ARGS
> check_error 'p vfs_read ^hoge' # NO_BTFARG
> check_error 'p kfree ^$arg10' # NO_BTFARG (exceed the number of parameters)
> check_error 'r kfree ^$retval' # NO_RETVAL
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2] selftests/ftrace: adjust offset for kprobe syntax error test
2024-12-02 19:41 ` Steven Rostedt
@ 2024-12-04 1:01 ` Shuah Khan
2024-12-04 1:20 ` Steven Rostedt
0 siblings, 1 reply; 6+ messages in thread
From: Shuah Khan @ 2024-12-04 1:01 UTC (permalink / raw)
To: Steven Rostedt, Hari Bathini
Cc: Shuah Khan, linux-kselftest, Masami Hiramatsu, Michael Ellerman,
Madhavan Srinivasan, Naveen N. Rao, linuxppc-dev,
linux-trace-kernel, linux-kernel, Shuah Khan
On 12/2/24 12:41, Steven Rostedt wrote:
> On Sat, 30 Nov 2024 01:56:21 +0530
> Hari Bathini <hbathini@linux.ibm.com> wrote:
>
>> In 'NOFENTRY_ARGS' test case for syntax check, any offset X of
>> `vfs_read+X` except function entry offset (0) fits the criterion,
>> even if that offset is not at instruction boundary, as the parser
>> comes before probing. But with "ENDBR64" instruction on x86, offset
>> 4 is treated as function entry. So, X can't be 4 as well. Thus, 8
>> was used as offset for the test case. On 64-bit powerpc though, any
>> offset <= 16 can be considered function entry depending on build
>> configuration (see arch_kprobe_on_func_entry() for implementation
>> details). So, use `vfs_read+20` to accommodate that scenario too.
>>
>> Suggested-by: Masami Hiramatsu <mhiramat@kernel.org>
>> Signed-off-by: Hari Bathini <hbathini@linux.ibm.com>
>
> Acked-by: Steven Rostedt (Google) <rostedt@goodmis.org>
>
> Shuah,
>
> Can you take this through your tree?
Yes I can take it. I do have question about whether this is
a fix - sounds like it is from the change log.
Clearly stating that it is a fix will help so it can be picked
up for stables.
thanks,
-- Shuah
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2] selftests/ftrace: adjust offset for kprobe syntax error test
2024-12-04 1:01 ` Shuah Khan
@ 2024-12-04 1:20 ` Steven Rostedt
2024-12-05 16:06 ` Shuah Khan
0 siblings, 1 reply; 6+ messages in thread
From: Steven Rostedt @ 2024-12-04 1:20 UTC (permalink / raw)
To: Shuah Khan
Cc: Hari Bathini, Shuah Khan, linux-kselftest, Masami Hiramatsu,
Michael Ellerman, Madhavan Srinivasan, Naveen N. Rao,
linuxppc-dev, linux-trace-kernel, linux-kernel
On Tue, 3 Dec 2024 18:01:06 -0700
Shuah Khan <skhan@linuxfoundation.org> wrote:
> On 12/2/24 12:41, Steven Rostedt wrote:
> > On Sat, 30 Nov 2024 01:56:21 +0530
> > Hari Bathini <hbathini@linux.ibm.com> wrote:
> >
> >> In 'NOFENTRY_ARGS' test case for syntax check, any offset X of
> >> `vfs_read+X` except function entry offset (0) fits the criterion,
> >> even if that offset is not at instruction boundary, as the parser
> >> comes before probing. But with "ENDBR64" instruction on x86, offset
> >> 4 is treated as function entry. So, X can't be 4 as well. Thus, 8
> >> was used as offset for the test case. On 64-bit powerpc though, any
> >> offset <= 16 can be considered function entry depending on build
> >> configuration (see arch_kprobe_on_func_entry() for implementation
> >> details). So, use `vfs_read+20` to accommodate that scenario too.
> >>
> >> Suggested-by: Masami Hiramatsu <mhiramat@kernel.org>
> >> Signed-off-by: Hari Bathini <hbathini@linux.ibm.com>
> >
> > Acked-by: Steven Rostedt (Google) <rostedt@goodmis.org>
> >
> > Shuah,
> >
> > Can you take this through your tree?
>
> Yes I can take it. I do have question about whether this is
> a fix - sounds like it is from the change log.
>
> Clearly stating that it is a fix will help so it can be picked
> up for stables.
I would say it's a fix, as the test currently fails in certain scenarios
for powerpc.
You can add:
Fixes: 4231f30fcc34a ("selftests/ftrace: Add BTF arguments test cases")
-- Steve
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2] selftests/ftrace: adjust offset for kprobe syntax error test
2024-12-04 1:20 ` Steven Rostedt
@ 2024-12-05 16:06 ` Shuah Khan
2024-12-05 16:12 ` Steven Rostedt
0 siblings, 1 reply; 6+ messages in thread
From: Shuah Khan @ 2024-12-05 16:06 UTC (permalink / raw)
To: Steven Rostedt
Cc: Hari Bathini, Shuah Khan, linux-kselftest, Masami Hiramatsu,
Michael Ellerman, Madhavan Srinivasan, Naveen N. Rao,
linuxppc-dev, linux-trace-kernel, linux-kernel, Shuah Khan
On 12/3/24 18:20, Steven Rostedt wrote:
> On Tue, 3 Dec 2024 18:01:06 -0700
> Shuah Khan <skhan@linuxfoundation.org> wrote:
>
>> On 12/2/24 12:41, Steven Rostedt wrote:
>>> On Sat, 30 Nov 2024 01:56:21 +0530
>>> Hari Bathini <hbathini@linux.ibm.com> wrote:
>>>
>>>> In 'NOFENTRY_ARGS' test case for syntax check, any offset X of
>>>> `vfs_read+X` except function entry offset (0) fits the criterion,
>>>> even if that offset is not at instruction boundary, as the parser
>>>> comes before probing. But with "ENDBR64" instruction on x86, offset
>>>> 4 is treated as function entry. So, X can't be 4 as well. Thus, 8
>>>> was used as offset for the test case. On 64-bit powerpc though, any
>>>> offset <= 16 can be considered function entry depending on build
>>>> configuration (see arch_kprobe_on_func_entry() for implementation
>>>> details). So, use `vfs_read+20` to accommodate that scenario too.
>>>>
>>>> Suggested-by: Masami Hiramatsu <mhiramat@kernel.org>
>>>> Signed-off-by: Hari Bathini <hbathini@linux.ibm.com>
>>>
>>> Acked-by: Steven Rostedt (Google) <rostedt@goodmis.org>
>>>
>>> Shuah,
>>>
>>> Can you take this through your tree?
>>
>> Yes I can take it. I do have question about whether this is
>> a fix - sounds like it is from the change log.
>>
>> Clearly stating that it is a fix will help so it can be picked
>> up for stables.
>
> I would say it's a fix, as the test currently fails in certain scenarios
> for powerpc.
>
> You can add:
>
> Fixes: 4231f30fcc34a ("selftests/ftrace: Add BTF arguments test cases")
>
I applied this to linux-kselftest fixes - will send it up for rc2 or rc3
thanks,
-- Shuah
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2] selftests/ftrace: adjust offset for kprobe syntax error test
2024-12-05 16:06 ` Shuah Khan
@ 2024-12-05 16:12 ` Steven Rostedt
0 siblings, 0 replies; 6+ messages in thread
From: Steven Rostedt @ 2024-12-05 16:12 UTC (permalink / raw)
To: Shuah Khan
Cc: Hari Bathini, Shuah Khan, linux-kselftest, Masami Hiramatsu,
Michael Ellerman, Madhavan Srinivasan, Naveen N. Rao,
linuxppc-dev, linux-trace-kernel, linux-kernel
On Thu, 5 Dec 2024 09:06:43 -0700
Shuah Khan <skhan@linuxfoundation.org> wrote:
> I applied this to linux-kselftest fixes - will send it up for rc2 or rc3
Thanks Shuah,
-- Steve
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2024-12-05 16:12 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-29 20:26 [PATCH v2] selftests/ftrace: adjust offset for kprobe syntax error test Hari Bathini
2024-12-02 19:41 ` Steven Rostedt
2024-12-04 1:01 ` Shuah Khan
2024-12-04 1:20 ` Steven Rostedt
2024-12-05 16:06 ` Shuah Khan
2024-12-05 16:12 ` Steven Rostedt
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).