From: Francis Laniel <flaniel@linux.microsoft.com>
To: linux-trace-kernel@vger.kernel.org
Cc: Masami Hiramatsu <mhiramat@kernel.org>,
stable@vger.kernel.org,
Francis Laniel <flaniel@linux.microsoft.com>,
Steven Rostedt <rostedt@goodmis.org>,
Shuah Khan <shuah@kernel.org>,
linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org
Subject: [PATCH v5 2/2] selftests/ftrace: Add new test case which checks non unique symbol
Date: Wed, 18 Oct 2023 17:40:30 +0300 [thread overview]
Message-ID: <20231018144030.86885-3-flaniel@linux.microsoft.com> (raw)
In-Reply-To: <20231018144030.86885-1-flaniel@linux.microsoft.com>
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.
Signed-off-by: Francis Laniel <flaniel@linux.microsoft.com>
---
.../ftrace/test.d/kprobe/kprobe_non_uniq_symbol.tc | 13 +++++++++++++
1 file changed, 13 insertions(+)
create mode 100644 tools/testing/selftests/ftrace/test.d/kprobe/kprobe_non_uniq_symbol.tc
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
--
2.34.1
next prev parent reply other threads:[~2023-10-18 14:41 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-18 14:40 [PATCH v5 0/2] Return EADDRNOTAVAIL when func matches several symbols during kprobe creation Francis Laniel
2023-10-18 14:40 ` [PATCH v5 1/2] tracing/kprobes: Return EADDRNOTAVAIL when func matches several symbols Francis Laniel
2023-10-18 14:42 ` kernel test robot
2023-10-18 14:40 ` Francis Laniel [this message]
2023-10-18 16:55 ` [PATCH v5 2/2] selftests/ftrace: Add new test case which checks non unique symbol Greg KH
2023-10-18 17:00 ` [PATCH v5 0/2] Return EADDRNOTAVAIL when func matches several symbols during kprobe creation Steven Rostedt
2023-10-19 9:25 ` Francis Laniel
2023-10-19 12:18 ` Masami Hiramatsu
2023-10-19 13:51 ` Steven Rostedt
2023-10-19 15:07 ` Masami Hiramatsu
2023-10-20 10:42 ` Francis Laniel
2023-10-20 10:41 ` Francis Laniel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20231018144030.86885-3-flaniel@linux.microsoft.com \
--to=flaniel@linux.microsoft.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=mhiramat@kernel.org \
--cc=rostedt@goodmis.org \
--cc=shuah@kernel.org \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.