ftrace/selftests: Fix registering kprobe on non-unique symbol
PATCH 1/2 ftrace/selftests: Fix regex pattern to match vmlinux symbol names only
In reply to Alexander GordeevCommit 1870ddcd94b0 ("bpf: Prefer vmlinux symbols over module symbols for unqualified kprobes") changed unqualified kprobe lookup to prefer a unique vmlinux symbol even when modules export symbols with the same name.
Reflect this change in the test and anchor the grep pattern at the end of the line so it only counts vmlinux symbols and skips module ones.
--- .../selftests/ftrace/test.d/kprobe/kprobe_non_uniq_symbol.tc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/ftrace/test.d/kprobe/kprobe_non_uniq_symbol.tc +1 -1
@@ -6,7 +6,7 @@ SYMBOL='name_show' # We skip this test on kernel where SYMBOL is unique or does not exist. -if [ "$(grep -c -E "[[:alnum:]]+ t ${SYMBOL}" /proc/kallsyms)" -le '1' ]; then +if [ "$(grep -c -E "[[:alnum:]]+ t ${SYMBOL}$" /proc/kallsyms)" -le '1' ]; then exit_unsupported fi
Signature · 1 line
2.53.0
cover ftrace/selftests: Fix registering kprobe on non-unique symbol
Hi All!
Commit 1870ddcd94b0 ("bpf: Prefer vmlinux symbols over module symbols for unqualified kprobes") broke registering kprobe on non-unique symbol test - fix and improve it.
Thanks!
Alexander Gordeev (2):
ftrace/selftests: Fix regex pattern to match vmlinux symbol names only ftrace/selftests: Change non-unique test symbol to init_once
.../selftests/ftrace/test.d/kprobe/kprobe_non_uniq_symbol.tc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Signature · 1 line
2.53.0
PATCH 2/2 ftrace/selftests: Change non-unique test symbol to init_once
The name_show symbol is not the best choise, because it often appears only three times on s390 in kallsyms, with two of them having module annotations [mdev] and [i2c_core].
Switch to init_once which has many more duplicate instances all in vmlinux, making it a more reliable non-unique symbol for testing kprobe registration failure.
--- .../selftests/ftrace/test.d/kprobe/kprobe_non_uniq_symbol.tc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/ftrace/test.d/kprobe/kprobe_non_uniq_symbol.tc +1 -1
@@ -3,7 +3,7 @@ # description: Test failure of registering kprobe on non unique symbol # requires: kprobe_events -SYMBOL='name_show' +SYMBOL='init_once' # We skip this test on kernel where SYMBOL is unique or does not exist. if [ "$(grep -c -E "[[:alnum:]]+ t ${SYMBOL}$" /proc/kallsyms)" -le '1' ]; then
Signature · 1 line
2.53.0
Polite ping.
Masami Hiramatsu (Google)
maintainerRe: [PATCH 2/2] ftrace/selftests: Change non-unique test symbol to init_once
In reply to Alexander GordeevQuoted 9 lines · Alexander Gordeev
The
name_showsymbol is not the best choise, because it often appears only three times on s390 in kallsyms, with two of them having module annotations [mdev] and [i2c_core].Switch to
init_oncewhich has many more duplicate instances all in vmlinux, making it a more reliable non-unique symbol for testing kprobe registration failure.Signed-off-by Alexander Gordeev <[email protected]>
Looks good to me. Let me pick this to probes/for-next.
Thanks,
Signature · 1 line
Masami Hiramatsu (Google) <[email protected]>