summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorMasami Hiramatsu (Google) <mhiramat@kernel.org>2025-03-27 21:19:54 +0900
committerMasami Hiramatsu (Google) <mhiramat@kernel.org>2025-03-27 21:19:54 +0900
commit581a7b26ab364410c260df1eb5941e70722d25fc (patch)
tree06c1d2dca4a4b890b2ad9d9400fc3f75fbb02b00 /tools
parent168ccc9b9938d07e71e6e25b82826f8ea11172fc (diff)
downloadlinux-581a7b26ab364410c260df1eb5941e70722d25fc.tar.gz
linux-581a7b26ab364410c260df1eb5941e70722d25fc.tar.bz2
linux-581a7b26ab364410c260df1eb5941e70722d25fc.zip
selftests/ftrace: Add dynamic events argument limitation test case
Add argument limitation test case for dynamic events. This is a boudary check for the maximum number of the probe event arguments. Link: https://lore.kernel.org/all/174055078295.4079315.14702008939511417359.stgit@mhiramat.tok.corp.google.com/ Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Diffstat (limited to 'tools')
-rw-r--r--tools/testing/selftests/ftrace/test.d/dynevent/dynevent_limitations.tc42
1 files changed, 42 insertions, 0 deletions
diff --git a/tools/testing/selftests/ftrace/test.d/dynevent/dynevent_limitations.tc b/tools/testing/selftests/ftrace/test.d/dynevent/dynevent_limitations.tc
new file mode 100644
index 000000000000..6b94b678741a
--- /dev/null
+++ b/tools/testing/selftests/ftrace/test.d/dynevent/dynevent_limitations.tc
@@ -0,0 +1,42 @@
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0
+# description: Checking dynamic events limitations
+# requires: dynamic_events "imm-value":README
+
+# Max arguments limitation
+MAX_ARGS=128
+EXCEED_ARGS=$((MAX_ARGS + 1))
+
+check_max_args() { # event_header
+ TEST_STRING=$1
+ # Acceptable
+ for i in `seq 1 $MAX_ARGS`; do
+ TEST_STRING="$TEST_STRING \\$i"
+ done
+ echo "$TEST_STRING" >> dynamic_events
+ echo > dynamic_events
+ # Error
+ TEST_STRING="$TEST_STRING \\$EXCEED_ARGS"
+ ! echo "$TEST_STRING" >> dynamic_events
+ return 0
+}
+
+# Kprobe max args limitation
+if grep -q "kprobe_events" README; then
+ check_max_args "p vfs_read"
+fi
+
+# Fprobe max args limitation
+if grep -q "f[:[<group>/][<event>]] <func-name>[%return] [<args>]" README; then
+ check_max_args "f vfs_read"
+fi
+
+# Tprobe max args limitation
+if grep -q "t[:[<group>/][<event>]] <tracepoint> [<args>]" README; then
+ check_max_args "t kfree"
+fi
+
+# Uprobe max args limitation
+if grep -q "uprobe_events" README; then
+ check_max_args "p /bin/sh:10"
+fi