Commit f8cc59dd authored by Hari Bathini's avatar Hari Bathini Committed by cuiyudong
Browse files

selftests/ftrace: adjust offset for kprobe syntax error test

stable inclusion
from stable-v6.6.66
commit 67b5ed3b4d367882ddd93d1d55f592294046844f
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/IBLUBO

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=67b5ed3b4d367882ddd93d1d55f592294046844f

--------------------------------

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: 4231f30f ("selftests/ftrace: Add BTF arguments test cases")
Suggested-by: default avatarMasami Hiramatsu <mhiramat@kernel.org>
Signed-off-by: default avatarHari Bathini <hbathini@linux.ibm.com>
Acked-by: default avatarSteven Rostedt (Google) <rostedt@goodmis.org>
Signed-off-by: default avatarShuah Khan <skhan@linuxfoundation.org>
Conflicts:
selftests/ftrace/test.d/kprobe/kprobe_syntax_errors.tc
Signed-off-by: default avatarcuiyudong <cuiyudong@kylinos.cn>
parent 0d8f72d3
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -109,7 +109,7 @@ check_error 'p vfs_read args=^$arg*' # BAD_VAR_ARGS
check_error 'p vfs_read +0(^$arg*)'		# BAD_VAR_ARGS
check_error 'p vfs_read $arg* ^$arg*'		# DOUBLE_ARGS
check_error 'r vfs_read ^$arg*'			# NOFENTRY_ARGS
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