Skip to content

Commit 777f290

Browse files
hbathinishuahkh
authored andcommitted
selftests/ftrace: adjust offset for kprobe syntax error test
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/[email protected] Fixes: 4231f30 ("selftests/ftrace: Add BTF arguments test cases") Suggested-by: Masami Hiramatsu <[email protected]> Signed-off-by: Hari Bathini <[email protected]> Acked-by: Steven Rostedt (Google) <[email protected]> Signed-off-by: Shuah Khan <[email protected]>
1 parent 40384c8 commit 777f290

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

tools/testing/selftests/ftrace/test.d/kprobe/kprobe_syntax_errors.tc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ check_error 'p vfs_read $arg* ^$arg*' # DOUBLE_ARGS
111111
if !grep -q 'kernel return probes support:' README; then
112112
check_error 'r vfs_read ^$arg*' # NOFENTRY_ARGS
113113
fi
114-
check_error 'p vfs_read+8 ^$arg*' # NOFENTRY_ARGS
114+
check_error 'p vfs_read+20 ^$arg*' # NOFENTRY_ARGS
115115
check_error 'p vfs_read ^hoge' # NO_BTFARG
116116
check_error 'p kfree ^$arg10' # NO_BTFARG (exceed the number of parameters)
117117
check_error 'r kfree ^$retval' # NO_RETVAL

0 commit comments

Comments
 (0)