Linux Perf Users
 help / color / mirror / Atom feed
* [PATCH v2] perf test: perftool-testsuite-report fails on s390
@ 2026-07-09  7:30 Thomas Richter
  2026-07-09  7:42 ` sashiko-bot
  0 siblings, 1 reply; 2+ messages in thread
From: Thomas Richter @ 2026-07-09  7:30 UTC (permalink / raw)
  To: linux-kernel, linux-s390, linux-perf-users, acme, namhyung
  Cc: agordeev, iii, sumanthk, hca, japo, Thomas Richter

V1 --> V2: Add finding from sashiko
   Add check for non-zero string length to avoid 'rm -f'
   command without file name.

Test case perftool-testsuite-report.sh always fails on s390.
Root cause is a default timeout for addr2line command which is too
short for s390. Function cmd_addr2line() invokes addr2line command
and reads via pipe the function name on stdout, after writing
an address to stdin. There is a default timeout for the expected
reply, but very often this timeout is too short and nothing is
returned. This leads to the error message listed in
util/addr2line.c:

   switch (read_addr2line_record(&io, cmd_a2l_style, dso_name, ..) {
   case -1:
          if (!symbol_conf.addr2line_disable_warn)
                 pr_warning("%s %s: could not read first record\n",
				   ...)
          goto out;
   ...

As the test case emits warnings, it is reported as failed.
Fix this for s390 and create a temporary perf configuration file to
suppress these warnings. (An alternative would be to increase
the default timeout to a larger value).

Output before:
 # bash perftool-testsuite_report.sh
 -- [ PASS ] -- perf_report :: setup :: prepare the perf.data file
 ==================
 [ perf record: Woken up 1 times to write data ]
 [ perf record: Captured and wrote 0.087 MB (402 samples) ]
 ==================
 -- [ PASS ] -- perf_report :: setup :: prepare the perf.data.1 file
 ## [ PASS ] ## perf_report :: setup SUMMARY
 -- [ SKIP ] -- perf_report :: test_basic :: help message :: \
 		testcase skipped
 Line did not match any pattern: "cmd__addr2line <file> could not \
	read first record"
 -- [ FAIL ] -- perf_report :: test_basic :: basic execution \
	 (output regexp parsing)
 Line did not match any pattern: "cmd__addr2line <file> could not \
	read first record"
 ...
 ## [ FAIL ] ## perf_report :: test_basic SUMMARY :: 6 failures found

All six tests fail for the same reason, addr2line did not respond in
time.

Output after:
 # bash perftool-testsuite_report.sh
 -- [ PASS ] -- perf_report :: setup :: prepare the perf.data file
 ==================
 [ perf record: Woken up 1 times to write data ]
 [ perf record: Captured and wrote 0.086 MB .... (380 samples) ]
 ==================
 -- [ PASS ] -- perf_report :: setup :: prepare the perf.data.1 file
 ## [ PASS ] ## perf_report :: setup SUMMARY
 -- [ SKIP ] -- perf_report :: test_basic :: help message :: \
 				testcase skipped
 -- [ PASS ] -- perf_report :: test_basic :: basic execution
 -- [ PASS ] -- perf_report :: test_basic :: number of samples
 -- [ PASS ] -- perf_report :: test_basic :: header
 -- [ PASS ] -- perf_report :: test_basic :: header timestamp
 -- [ PASS ] -- perf_report :: test_basic :: show CPU utilization
 -- [ PASS ] -- perf_report :: test_basic :: pid
 -- [ PASS ] -- perf_report :: test_basic :: non-existing symbol
 -- [ PASS ] -- perf_report :: test_basic :: symbol filter
 -- [ PASS ] -- perf_report :: test_basic :: latency header
 -- [ PASS ] -- perf_report :: test_basic :: default report for \
						 latency profile
 -- [ PASS ] -- perf_report :: test_basic :: latency report for \
 						latency profile
 -- [ PASS ] -- perf_report :: test_basic :: parallelism histogram
 ## [ PASS ] ## perf_report :: test_basic SUMMARY
 #

Signed-off-by: Thomas Richter <tmricht@linux.ibm.com>
Reviewed-by: Jan Polensky <japo@linux.ibm.com>
---
 tools/perf/tests/shell/perftool-testsuite_report.sh | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/tools/perf/tests/shell/perftool-testsuite_report.sh b/tools/perf/tests/shell/perftool-testsuite_report.sh
index a8cf75b4e77e..3c4d0d268d80 100755
--- a/tools/perf/tests/shell/perftool-testsuite_report.sh
+++ b/tools/perf/tests/shell/perftool-testsuite_report.sh
@@ -6,6 +6,14 @@ test -d "$(dirname "$0")/base_report" || exit 2
 cd "$(dirname "$0")/base_report" || exit 2
 status=0
 
+# On s390 the default timeout for addr2line is too short, disable warnings
+if [ $(uname -m) = s390x ]
+then
+	perf_config_tmp=$(mktemp /tmp/.perfconfig_XXXXX)
+	export PERF_CONFIG="${perf_config_tmp}"
+	perf config 'core.addr2line-disable-warn = true'
+fi
+
 PERFSUITE_RUN_DIR=$(mktemp -d /tmp/"$(basename "$0" .sh)".XXX)
 export PERFSUITE_RUN_DIR
 
@@ -19,5 +27,6 @@ if ! [ "$PERFTEST_KEEP_LOGS" = "y" ]; then
 	rm -rf "$PERFSUITE_RUN_DIR"
 fi
 
+[ -n "${perf_config_tmp}" ] && rm -f "${perf_config_tmp}"
 test $status -ne 0 && exit 1
 exit 0
-- 
2.55.0


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

* Re: [PATCH v2] perf test: perftool-testsuite-report fails on s390
  2026-07-09  7:30 [PATCH v2] perf test: perftool-testsuite-report fails on s390 Thomas Richter
@ 2026-07-09  7:42 ` sashiko-bot
  0 siblings, 0 replies; 2+ messages in thread
From: sashiko-bot @ 2026-07-09  7:42 UTC (permalink / raw)
  To: Thomas Richter
  Cc: linux-s390, Vasily Gorbik, linux-perf-users, Heiko Carstens,
	Alexander Gordeev

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Uninitialized `perf_config_tmp` leads to arbitrary file deletion via environment injection on non-s390x architectures.
--

--- Patch [1]: [PATCH v2] perf test: perftool-testsuite-report fails on s390 ---
commit f7fabccf09a26131ccc43cc43ec7cc1971402aa3
Author: Thomas Richter <tmricht@linux.ibm.com>

perf test: perftool-testsuite-report fails on s390

This commit addresses a timeout failure in the perftool-testsuite-report
test on s390 architectures. It creates a temporary perf configuration file
to suppress addr2line warnings specifically for s390x systems.

> diff --git a/tools/perf/tests/shell/perftool-testsuite_report.sh b/tools/perf/tests/shell/perftool-testsuite_report.sh
> --- a/tools/perf/tests/shell/perftool-testsuite_report.sh
> +++ b/tools/perf/tests/shell/perftool-testsuite_report.sh
> @@ -6,6 +6,14 @@ test -d "$(dirname "$0")/base_report" || exit 2
>  cd "$(dirname "$0")/base_report" || exit 2
>  status=0
>  
> +# On s390 the default timeout for addr2line is too short, disable warnings
> +if [ $(uname -m) = s390x ]
> +then
> +	perf_config_tmp=$(mktemp /tmp/.perfconfig_XXXXX)
> +	export PERF_CONFIG="${perf_config_tmp}"
> +	perf config 'core.addr2line-disable-warn = true'
> +fi
> +
>  PERFSUITE_RUN_DIR=$(mktemp -d /tmp/"$(basename "$0" .sh)".XXX)

[ ... ]

> @@ -19,5 +27,6 @@ if ! [ "$PERFTEST_KEEP_LOGS" = "y" ]; then
>  	rm -rf "$PERFSUITE_RUN_DIR"
>  fi
>  
> +[ -n "${perf_config_tmp}" ] && rm -f "${perf_config_tmp}"

[Severity: High]
Could this lead to unintended file deletion on non-s390x architectures?

Since perf_config_tmp is only conditionally initialized if the architecture
is s390x, any value passed in via the environment will be retained on other
systems.

If a user or orchestration environment sets perf_config_tmp before running
the script, this cleanup path will execute rm -f against that arbitrary
file path.

Would it be safer to explicitly initialize perf_config_tmp to an empty
string at the start of the script?

>  test $status -ne 0 && exit 1
>  exit 0

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260709073024.3778237-1-tmricht@linux.ibm.com?part=1

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

end of thread, other threads:[~2026-07-09  7:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-09  7:30 [PATCH v2] perf test: perftool-testsuite-report fails on s390 Thomas Richter
2026-07-09  7:42 ` sashiko-bot

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