Linux Trace Kernel
 help / color / mirror / Atom feed
* [PATCH v2] tracing: selftests: Add testing a user string to filters
@ 2025-04-18 14:12 Steven Rostedt
  2025-04-22 16:59 ` Shuah Khan
  0 siblings, 1 reply; 3+ messages in thread
From: Steven Rostedt @ 2025-04-18 14:12 UTC (permalink / raw)
  To: LKML, Linux Trace Kernel
  Cc: Masami Hiramatsu, Mathieu Desnoyers, Andrew Morton, Shuah Khan,
	linux-kselftest

From: Steven Rostedt <rostedt@goodmis.org>

Running the following commands was broken:

  # cd /sys/kernel/tracing
  # echo "filename.ustring ~ \"/proc*\"" > events/syscalls/sys_enter_openat/filter
  # echo 1 > events/syscalls/sys_enter_openat/enable
  # ls /proc/$$/maps
  # cat trace

And would produce nothing when it should have produced something like:

      ls-1192    [007] .....  8169.828333: sys_openat(dfd: ffffffffffffff9c, filename: 7efc18359904, flags: 80000, mode: 0)

Add a test to check this case so that it will be caught if it breaks
again.

Link: https://lore.kernel.org/linux-trace-kernel/20250417183003.505835fb@gandalf.local.home/

Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
---
Changes since v1: https://lore.kernel.org/20250417223323.3edb4f6c@batman.local.home

- Use $TMPDIR instead of $TESTDIR as test file (Masami Hiramatsu)

 .../test.d/filter/event-filter-function.tc    | 20 +++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/tools/testing/selftests/ftrace/test.d/filter/event-filter-function.tc b/tools/testing/selftests/ftrace/test.d/filter/event-filter-function.tc
index 118247b8dd84..c62165fabd0c 100644
--- a/tools/testing/selftests/ftrace/test.d/filter/event-filter-function.tc
+++ b/tools/testing/selftests/ftrace/test.d/filter/event-filter-function.tc
@@ -80,6 +80,26 @@ if [ $misscnt -gt 0 ]; then
 	exit_fail
 fi
 
+# Check strings too
+if [ -f events/syscalls/sys_enter_openat/filter ]; then
+	DIRNAME=`basename $TMPDIR`
+	echo "filename.ustring ~ \"*$DIRNAME*\"" > events/syscalls/sys_enter_openat/filter
+	echo 1 > events/syscalls/sys_enter_openat/enable
+	echo 1 > tracing_on
+	ls /bin/sh
+	nocnt=`grep openat trace | wc -l`
+	ls $TMPDIR
+	echo 0 > tracing_on
+	hitcnt=`grep openat trace | wc -l`;
+	echo 0 > events/syscalls/sys_enter_openat/enable
+	if [ $nocnt -gt 0 ]; then
+		exit_fail
+	fi
+	if [ $hitcnt -eq 0 ]; then
+		exit_fail
+	fi
+fi
+
 reset_events_filter
 
 exit 0
-- 
2.47.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] tracing: selftests: Add testing a user string to filters
  2025-04-18 14:12 [PATCH v2] tracing: selftests: Add testing a user string to filters Steven Rostedt
@ 2025-04-22 16:59 ` Shuah Khan
  2025-04-22 18:08   ` Steven Rostedt
  0 siblings, 1 reply; 3+ messages in thread
From: Shuah Khan @ 2025-04-22 16:59 UTC (permalink / raw)
  To: Steven Rostedt, LKML, Linux Trace Kernel
  Cc: Masami Hiramatsu, Mathieu Desnoyers, Andrew Morton,
	linux-kselftest, Shuah Khan

On 4/18/25 08:12, Steven Rostedt wrote:
> From: Steven Rostedt <rostedt@goodmis.org>
> 
> Running the following commands was broken:
> 
>    # cd /sys/kernel/tracing
>    # echo "filename.ustring ~ \"/proc*\"" > events/syscalls/sys_enter_openat/filter
>    # echo 1 > events/syscalls/sys_enter_openat/enable
>    # ls /proc/$$/maps
>    # cat trace
> 
> And would produce nothing when it should have produced something like:
> 
>        ls-1192    [007] .....  8169.828333: sys_openat(dfd: ffffffffffffff9c, filename: 7efc18359904, flags: 80000, mode: 0)
> 
> Add a test to check this case so that it will be caught if it breaks
> again.
> 
> Link: https://lore.kernel.org/linux-trace-kernel/20250417183003.505835fb@gandalf.local.home/
> 
> Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
> ---
> Changes since v1: https://lore.kernel.org/20250417223323.3edb4f6c@batman.local.home
> 
> - Use $TMPDIR instead of $TESTDIR as test file (Masami Hiramatsu)
> 

Steve, Masami

Do you want me to take this for rc4?

thanks,
-- Shuah

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] tracing: selftests: Add testing a user string to filters
  2025-04-22 16:59 ` Shuah Khan
@ 2025-04-22 18:08   ` Steven Rostedt
  0 siblings, 0 replies; 3+ messages in thread
From: Steven Rostedt @ 2025-04-22 18:08 UTC (permalink / raw)
  To: Shuah Khan
  Cc: LKML, Linux Trace Kernel, Masami Hiramatsu, Mathieu Desnoyers,
	Andrew Morton, linux-kselftest

On Tue, 22 Apr 2025 10:59:03 -0600
Shuah Khan <skhan@linuxfoundation.org> wrote:

> > Link: https://lore.kernel.org/linux-trace-kernel/20250417183003.505835fb@gandalf.local.home/
> > 
> > Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
> > ---
> > Changes since v1: https://lore.kernel.org/20250417223323.3edb4f6c@batman.local.home
> > 
> > - Use $TMPDIR instead of $TESTDIR as test file (Masami Hiramatsu)
> >   
> 
> Steve, Masami
> 
> Do you want me to take this for rc4?

Hi Shuah,

Sorry, I didn't copy the comment from v1 to v2, but it still applies:

    Shuah, I'm Cc'ing you on this for your information, but I'll take it
    through my tree as it will be attached with the fix, as it will fail
    without it.

It's already been accepted.

Thanks,

-- Steve

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-04-22 18:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-18 14:12 [PATCH v2] tracing: selftests: Add testing a user string to filters Steven Rostedt
2025-04-22 16:59 ` Shuah Khan
2025-04-22 18:08   ` Steven Rostedt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox