lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250710130134.591066-1-wutengda@huaweicloud.com>
Date: Thu, 10 Jul 2025 13:01:34 +0000
From: Tengda Wu <wutengda@...weicloud.com>
To: Steven Rostedt <rostedt@...dmis.org>,
	Masami Hiramatsu <mhiramat@...nel.org>
Cc: Mathieu Desnoyers <mathieu.desnoyers@...icios.com>,
	Shuah Khan <shuah@...nel.org>,
	Yuanhe Shu <xiangzao@...ux.alibaba.com>,
	linux-trace-kernel@...r.kernel.org,
	linux-kernel@...r.kernel.org,
	linux-kselftest@...r.kernel.org,
	Tengda Wu <wutengda@...weicloud.com>
Subject: [PATCH -next] selftests/ftrace: Prevent potential failure in subsystem-enable test case

The first 100 lines of trace output don't always contain 3 or more
distinct events. In busy systems, they may be dominated by repetitive
events like sched_stat_runtime, causing the `$count -lt 3` check to
fail. Example trace:

$ head -n 100 trace | grep -v ^#
 systemd-timesyn-266     [006] d.h2.   738.778482: sched_stat_runtime: comm=systemd-timesyn pid=266 runtime=976854 [ns]
      ftracetest-8751    [001] d.h2.   738.778512: sched_stat_runtime: comm=ftracetest pid=8751 runtime=938335 [ns]
 systemd-timesyn-266     [006] d.h1.   738.779531: sched_stat_runtime: comm=systemd-timesyn pid=266 runtime=1044284 [ns]
      ftracetest-8751    [001] d.h2.   738.779541: sched_stat_runtime: comm=ftracetest pid=8751 runtime=1028575 [ns]
         systemd-1       [007] d.h5.   738.779657: sched_stat_runtime: comm=systemd pid=1 runtime=642624 [ns]
[...]

With trace cleared, simply check `$count -eq 0` to confirm subsystem
enablement, just like toplevel-enable.tc does.

Fixes: 1a4ea83a6e67 ("selftests/ftrace: Limit length in subsystem-enable tests")
Signed-off-by: Tengda Wu <wutengda@...weicloud.com>
---
 .../selftests/ftrace/test.d/event/subsystem-enable.tc     | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/tools/testing/selftests/ftrace/test.d/event/subsystem-enable.tc b/tools/testing/selftests/ftrace/test.d/event/subsystem-enable.tc
index b7c8f29c09a9..3a28adc7b727 100644
--- a/tools/testing/selftests/ftrace/test.d/event/subsystem-enable.tc
+++ b/tools/testing/selftests/ftrace/test.d/event/subsystem-enable.tc
@@ -19,8 +19,8 @@ echo 'sched:*' > set_event
 yield
 
 count=`head -n 100 trace | grep -v ^# | awk '{ print $5 }' | sort -u | wc -l`
-if [ $count -lt 3 ]; then
-    fail "at least fork, exec and exit events should be recorded"
+if [ $count -eq 0 ]; then
+    fail "none of scheduler events are recorded"
 fi
 
 do_reset
@@ -30,8 +30,8 @@ echo 1 > events/sched/enable
 yield
 
 count=`head -n 100 trace | grep -v ^# | awk '{ print $5 }' | sort -u | wc -l`
-if [ $count -lt 3 ]; then
-    fail "at least fork, exec and exit events should be recorded"
+if [ $count -eq 0 ]; then
+    fail "none of scheduler events are recorded"
 fi
 
 do_reset
-- 
2.34.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ