Re: [PATCH v4 2/4] ftrace: Add support for function argument to graph tracer
From: Steven Rostedt
Date: Fri Apr 11 2025 - 15:24:58 EST
Replying to my email as it appears gmail blocked it. Probably due to all
the escape characters my output had. Resending with that cut out.
Masami, I was sent a message from gmail that it blocked this from you.
If you want to see the original email:
https://lore.kernel.org/all/20250411151358.1d4fd8c7@xxxxxxxxxxxxxxxxxx/
-- Steve
On Fri, 11 Apr 2025 15:13:58 -0400
Steven Rostedt <rostedt@xxxxxxxxxxx> wrote:
> On Fri, 11 Apr 2025 14:31:32 -0400
> Steven Rostedt <rostedt@xxxxxxxxxxx> wrote:
>
> > Hmm, I just tested this, and it fails on my box too (I test on a debian VM).
> >
> > It fails with and without setting it to bash. I'll take a look too.
>
> Hmm, maybe it is a bashism.
>
> The test has this:
>
> # 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
>
> So I tried manually executing this in bash:
>
> --------------------------8<--------------------------
> # TEST_STRING='p vfs_read'
> # for i in `seq 1 128`; do TEST_STRING="$TEST_STRING \\$i" ; done
> # echo $TEST_STRING
> p vfs_read \1 \2
[ This is cut out to see if it doesn't trigger gmail blocking it again! ]
> # echo "$TEST_STRING" >> /sys/kernel/tracing/dynamic_events
> # echo $?
> 0
> # cat /sys/kernel/tracing/dynamic_events
> p:kprobes/p_vfs_read_0 vfs_read arg1=\1
[ This is cut out to see if it doesn't trigger gmail blocking it again! ]
> -------------------------->8--------------------------
>
> Doing the same in dash:
>
> --------------------------8<--------------------------
> # dash
> # TEST_STRING='p vfs_read'
> # for i in `seq 1 128`; do TEST_STRING="$TEST_STRING \\$i" ; done
> # echo $TEST_STRING
> p vfs_read \8 \9
[ This is cut out to see if it doesn't trigger gmail blocking it again! ]
> # echo "$TEST_STRING" >> /sys/kernel/tracing/dynamic_events
> dash: 8: echo: echo: I/O error
> -------------------------->8--------------------------
>
> Looks like dash will translate those "\#" into the ASCII equivalent,
> whereas bash does not.
>
> This patch seems to fix it:
>
> diff --git a/tools/testing/selftests/ftrace/test.d/dynevent/dynevent_limitations.tc b/tools/testing/selftests/ftrace/test.d/dynevent/dynevent_limitations.tc
> index 6b94b678741a..ebe2a34cbf92 100644
> --- a/tools/testing/selftests/ftrace/test.d/dynevent/dynevent_limitations.tc
> +++ b/tools/testing/selftests/ftrace/test.d/dynevent/dynevent_limitations.tc
> @@ -11,7 +11,7 @@ check_max_args() { # event_header
> TEST_STRING=$1
> # Acceptable
> for i in `seq 1 $MAX_ARGS`; do
> - TEST_STRING="$TEST_STRING \\$i"
> + TEST_STRING="$TEST_STRING \\\\$i"
> done
> echo "$TEST_STRING" >> dynamic_events
> echo > dynamic_events
>
>
> Masami, you just recently added this test (it's dated March 27th 2025), did
> you mean to write in the ASCII characters? Why the backslash?
>
> -- Steve