diff options
author | Francis Laniel <[email protected]> | 2023-10-20 13:42:50 +0300 |
---|---|---|
committer | Masami Hiramatsu (Google) <[email protected]> | 2023-10-20 22:11:49 +0900 |
commit | 03b80ff8023adae6780e491f66e932df8165e3a0 (patch) | |
tree | 11d1458c483eea77ea3c511b52c41ac0b37ab5fa | |
parent | b022f0c7e404887a7c5229788fc99eff9f9a80d5 (diff) |
selftests/ftrace: Add new test case which checks non unique symbol
If name_show() is non unique, this test will try to install a kprobe on this
function which should fail returning EADDRNOTAVAIL.
On kernel where name_show() is not unique, this test is skipped.
Link: https://lore.kernel.org/all/[email protected]/
Cc: [email protected]
Signed-off-by: Francis Laniel <[email protected]>
Acked-by: Masami Hiramatsu (Google) <[email protected]>
Signed-off-by: Masami Hiramatsu (Google) <[email protected]>
-rw-r--r-- | tools/testing/selftests/ftrace/test.d/kprobe/kprobe_non_uniq_symbol.tc | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_non_uniq_symbol.tc b/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_non_uniq_symbol.tc new file mode 100644 index 000000000000..bc9514428dba --- /dev/null +++ b/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_non_uniq_symbol.tc @@ -0,0 +1,13 @@ +#!/bin/sh +# SPDX-License-Identifier: GPL-2.0 +# description: Test failure of registering kprobe on non unique symbol +# requires: kprobe_events + +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 + exit_unsupported +fi + +! echo "p:test_non_unique ${SYMBOL}" > kprobe_events |