Skip to content

Commit 581a7b2

Browse files
committed
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>
1 parent 168ccc9 commit 581a7b2

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#!/bin/sh
2+
# SPDX-License-Identifier: GPL-2.0
3+
# description: Checking dynamic events limitations
4+
# requires: dynamic_events "imm-value":README
5+
6+
# Max arguments limitation
7+
MAX_ARGS=128
8+
EXCEED_ARGS=$((MAX_ARGS + 1))
9+
10+
check_max_args() { # event_header
11+
TEST_STRING=$1
12+
# Acceptable
13+
for i in `seq 1 $MAX_ARGS`; do
14+
TEST_STRING="$TEST_STRING \\$i"
15+
done
16+
echo "$TEST_STRING" >> dynamic_events
17+
echo > dynamic_events
18+
# Error
19+
TEST_STRING="$TEST_STRING \\$EXCEED_ARGS"
20+
! echo "$TEST_STRING" >> dynamic_events
21+
return 0
22+
}
23+
24+
# Kprobe max args limitation
25+
if grep -q "kprobe_events" README; then
26+
check_max_args "p vfs_read"
27+
fi
28+
29+
# Fprobe max args limitation
30+
if grep -q "f[:[<group>/][<event>]] <func-name>[%return] [<args>]" README; then
31+
check_max_args "f vfs_read"
32+
fi
33+
34+
# Tprobe max args limitation
35+
if grep -q "t[:[<group>/][<event>]] <tracepoint> [<args>]" README; then
36+
check_max_args "t kfree"
37+
fi
38+
39+
# Uprobe max args limitation
40+
if grep -q "uprobe_events" README; then
41+
check_max_args "p /bin/sh:10"
42+
fi

0 commit comments

Comments
 (0)