Skip to contentSkip to conversation

selftest/livepatch: Only run test-kprobe with CONFIG_KPROBES_ON_FTRACE

PATCH In review Song Liu 4 participants 4 messages Mar 18, 2025 – Mar 25, 2025

Subsystems (2)
lore
Share & tools
lore

Song Liu

author maintainer
#0 lore raw

PATCH 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
index 115065156016..e514391c5454 100755
@@ -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
maintainer Acked-by on v2 1/1
#1 lore raw
Quoted 6 lines · Song Liu

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.

M

maintainer Acked-by on v2 1/1
#2 lore raw
In reply to Song Liu
Quoted 21 lines · Song Liu

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 +0 -0
index 115065156016..e514391c5454 100755

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

maintainer
#3 lore raw
In reply to Song Liu
Quoted 6 lines · Song Liu

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.

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