selftests/ftrace: adjust offset for kprobe syntax error test
authorHari Bathini <hbathini@linux.ibm.com>
Fri, 29 Nov 2024 20:26:21 +0000 (01:56 +0530)
committerShuah Khan <skhan@linuxfoundation.org>
Wed, 11 Dec 2024 17:08:04 +0000 (10:08 -0700)
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.

Link: https://lore.kernel.org/r/20241129202621.721159-1-hbathini@linux.ibm.com
Fixes: 4231f30fcc34a ("selftests/ftrace: Add BTF arguments test cases")
Suggested-by: Masami Hiramatsu <mhiramat@kernel.org>
Signed-off-by: Hari Bathini <hbathini@linux.ibm.com>
Acked-by: Steven Rostedt (Google) <rostedt@goodmis.org>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
tools/testing/selftests/ftrace/test.d/kprobe/kprobe_syntax_errors.tc

index a16c6a6f6055cfbbfd01dea754060f32c1db434e..8f1c58f0c2397f9a627abc6d4aa61cca84275b51 100644 (file)
@@ -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