Skip to content

Commit 03b80ff

Browse files
eiffel-flmhiramat
authored andcommitted
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/20231020104250.9537-3-flaniel@linux.microsoft.com/ Cc: stable@vger.kernel.org Signed-off-by: Francis Laniel <flaniel@linux.microsoft.com> Acked-by: Masami Hiramatsu (Google) <mhiramat@kernel.org> Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
1 parent b022f0c commit 03b80ff

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/bin/sh
2+
# SPDX-License-Identifier: GPL-2.0
3+
# description: Test failure of registering kprobe on non unique symbol
4+
# requires: kprobe_events
5+
6+
SYMBOL='name_show'
7+
8+
# We skip this test on kernel where SYMBOL is unique or does not exist.
9+
if [ "$(grep -c -E "[[:alnum:]]+ t ${SYMBOL}" /proc/kallsyms)" -le '1' ]; then
10+
exit_unsupported
11+
fi
12+
13+
! echo "p:test_non_unique ${SYMBOL}" > kprobe_events

0 commit comments

Comments
 (0)