selftest/livepatch: Only run test-kprobe with CONFIG_KPROBES_ON_FTRACE
Subsystems (2)
Song Liu
maintainerPATCH v2 1/1 selftest/livepatch: Only run test-kprobe with CONFIG_KPROBES_ON_FTRACE
CONFIG_KPROBES_ON_FTRACE is required for test-kprobe. Skip test-kprobe when CONFIG_KPROBES_ON_FTRACE is not set. Since some kernel may not have /proc/config.gz, grep for kprobe_ftrace_ops from /proc/kallsyms to check whether CONFIG_KPROBES_ON_FTRACE is enabled.
---
Changes v1 => v2:
1. Grep for kprobe_ftrace_ops in /proc/kallsyms, as some systems may not have /proc/config.gz
--- tools/testing/selftests/livepatch/test-kprobe.sh | 2 ++ 1 file changed, 2 insertions(+)
tools/testing/selftests/livepatch/test-kprobe.sh +2 -0
@@ -5,6 +5,8 @@ . $(dirname $0)/functions.sh +grep kprobe_ftrace_ops /proc/kallsyms || skip "test-kprobe requires CONFIG_KPROBES_ON_FTRACE" + MOD_LIVEPATCH=test_klp_livepatch MOD_KPROBE=test_klp_kprobe
Signature · 1 line
2.47.1
Quoted 6 lines · Song Liu
CONFIG_KPROBES_ON_FTRACEis required for test-kprobe. Skip test-kprobe whenCONFIG_KPROBES_ON_FTRACEis not set. Since some kernel may not have/proc/config.gz, grep forkprobe_ftrace_opsfrom/proc/kallsymsto check whetherCONFIG_KPROBES_ON_FTRACEis enabled.Signed-off-by Song Liu <[email protected]>
M
Quoted 21 lines · Song Liu
CONFIG_KPROBES_ON_FTRACEis required for test-kprobe. Skip test-kprobe whenCONFIG_KPROBES_ON_FTRACEis not set. Since some kernel may not have/proc/config.gz, grep forkprobe_ftrace_opsfrom/proc/kallsymsto check whetherCONFIG_KPROBES_ON_FTRACEis enabled.Signed-off-by Song Liu <[email protected]>---
Changes v1 => v2:
1. Grep forkprobe_ftrace_opsin/proc/kallsyms, as some systems may not have/proc/config.gz--- tools/testing/selftests/livepatch/test-kprobe.sh | 2 ++ 1 file changed, 2 insertions(+)tools/testing/selftests/livepatch/test-kprobe.sh +0
-0
tools/testing/selftests/livepatch/test-kprobe.sh line 12
Quoted 8 lines
tools/testing/selftests/livepatch/test-kprobe.sh +2
-0@@ -5,6 +5,8 @@ . $(dirname $0)/functions.sh +grep kprobe_ftrace_ops /proc/kallsyms || skip "test-kprobe requires CONFIG_KPROBES_ON_FTRACE" + MOD_LIVEPATCH=test_klp_livepatch MOD_KPROBE=test_klp_kprobe
Super minor nit (maybe Petr can tweak on merging): this grep (without -q) will dump the resulting search lines to the terminal while all other existing tests only show "TEST: description .... ok" lines they pass.
-- Joe
Petr Mladek
maintainerQuoted 6 lines · Song Liu
CONFIG_KPROBES_ON_FTRACEis required for test-kprobe. Skip test-kprobe whenCONFIG_KPROBES_ON_FTRACEis not set. Since some kernel may not have/proc/config.gz, grep forkprobe_ftrace_opsfrom/proc/kallsymsto check whetherCONFIG_KPROBES_ON_FTRACEis enabled.Signed-off-by Song Liu <[email protected]>
JFYI, I have added the -q option and pushed the patch into livepatching.git, branch for-6.15/trivial, see
https://web.git.kernel.org/pub/scm/linux/kernel/git/livepatching/livepatching.git/commit/?h=for-6.15/trivial
IMHO, it is trivial and it is a selftest so it still go into 6.15. I am going to send the pull request on Thursday or so.
Best Regards,
Petr