Linux Perf Users
 help / color / mirror / Atom feed
* [PATCH V2 linux-next] perf test: Skip failing 'perf test aslr' test case
@ 2026-06-29 11:05 Thomas Richter
  2026-06-29 11:12 ` sashiko-bot
  0 siblings, 1 reply; 2+ messages in thread
From: Thomas Richter @ 2026-06-29 11:05 UTC (permalink / raw)
  To: linux-kernel, linux-s390, linux-perf-users, acme, namhyung,
	irogers
  Cc: agordeev, gor, sumanthk, hca, japo, Thomas Richter

V2: In response to sashiko:
  > [Severity: Medium]
  > Does unconditionally setting err=2 here mask prior test failures?
  >
  Do not change the return code when skipping the test. The failure
  is printed on stdout anyway and does not hide any previouly
  failed tests.

  Added correct commit-id as suggested by Namhyung Kim

The test case 'perf test aslr' fails on s390. The root cause of the
failure is subtest test_callchain_aslr. This test invokes command

 # ./perf record -g -e task-clock:u -o /tmp/perf-test-aslr \
	-- perf test -w noploop 3

to generate a call stack using event task-clock:u. On s390 this defaults
to '--call-graph dwarf' whereas on x86_64 this defaults to framepointer
(fp) format. The command

 # ./perf inject --aslr -i /tmp/perf-test-aslr

now scans all SAMPLE entries recorded in the perf.data file to convert
possible addresses. This is done in aslr_tool__process_sample() looking
at sample_type bits PERF_SAMPLE_IP, PERF_SAMPLE_TID,
PERF_SAMPLE_TIME, PERF_SAMPLE_PERIOD, PERF_SAMPLE_CALLCHAIN,
PERF_SAMPLE_REGS_USER and PERF_SAMPLE_STACK_USER.
On s390 the samples do not contain FP entries
of type PERF_SAMPLE_CALLCHAIN (the bit is set in sample_type, but the
number of FP entries is 0).
The processing enters the PERF_SAMPLE_STACK_USER portion where the
data is copied to the newly constructed sample and then aborted with
this warning:

 /* TODO: can this be less conservative? */
 pr_debug("Dropping stack user sample as possible ASLR leak\n");

With command line option '--call-graph dwarf' the new output file
does not contain any samples at all. This leads to a missing $new_addr
value in the shell script and a failure.

Fix this and skip this subtest. Emit a hint that this subtest is
currently unsupported on all platform when option --call-graph dwarf
is selected.
Since one subtest is skipped, the complete test is reported as
skipped.

Fixes: 190c45463844 ("perf test: Add inject ASLR test")
Signed-off-by: Thomas Richter <tmricht@linux.ibm.com>
Reviewed-by: Ian Rogers <irogers@google.com>
Suggusted-by: Sumanth Korikkar <sumanthk@linux.ibm.com>
---
 tools/perf/tests/shell/inject_aslr.sh | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/tools/perf/tests/shell/inject_aslr.sh b/tools/perf/tests/shell/inject_aslr.sh
index c00461828ea7..d83c2591db8f 100755
--- a/tools/perf/tests/shell/inject_aslr.sh
+++ b/tools/perf/tests/shell/inject_aslr.sh
@@ -135,8 +135,14 @@ test_callchain_aslr() {
     echo "Callchain ASLR test [Failed - no noploop samples in original file]"
     err=1
   elif [ -z "$new_addr" ]; then
-    echo "Callchain ASLR test [Failed - could not find remapped address]"
-    err=1
+    if perf evlist -v -i "${data}" | grep -q 'sample_type:.*STACK_USER'; then
+      echo "Dropping stack user sample as possible ASLR leak"
+      echo "Call-graph dwarf not supported with 'perf inject --aslr'"
+      echo "Callchain ASLR test [Skip]"
+    else
+      echo "Callchain ASLR test [Failed - could not find remapped address]"
+      err=1
+    fi
   elif [ "$orig_addr" = "$new_addr" ]; then
     echo "Callchain ASLR test [Failed - addresses are not remapped]"
     err=1
-- 
2.54.0


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

* Re: [PATCH V2 linux-next] perf test: Skip failing 'perf test aslr' test case
  2026-06-29 11:05 [PATCH V2 linux-next] perf test: Skip failing 'perf test aslr' test case Thomas Richter
@ 2026-06-29 11:12 ` sashiko-bot
  0 siblings, 0 replies; 2+ messages in thread
From: sashiko-bot @ 2026-06-29 11:12 UTC (permalink / raw)
  To: Thomas Richter
  Cc: Alexander Gordeev, linux-s390, Vasily Gorbik, Heiko Carstens,
	linux-perf-users

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] Commit message contradicts script behavior regarding test skip exit code, hiding skipped status from the test runner.
--

commit 0ec9bd8ca22ab0ece501382558440bfde5e6fdd0
Author: Thomas Richter <tmricht@linux.ibm.com>

perf test: Skip failing 'perf test aslr' test case

This commit addresses a failure in the 'perf test aslr' test case on s390
due to missing dwarf call-graph support in perf inject. It modifies
the script to drop the stack user sample and emit a skip message instead of
failing.

> diff --git a/tools/perf/tests/shell/inject_aslr.sh b/tools/perf/tests/shell/inject_aslr.sh
> index c00461828ea79..d83c2591db8f6 100755
> --- a/tools/perf/tests/shell/inject_aslr.sh
> +++ b/tools/perf/tests/shell/inject_aslr.sh
> @@ -135,8 +135,14 @@ test_callchain_aslr() {
>      echo "Callchain ASLR test [Failed - no noploop samples in original file]"
>      err=1
>    elif [ -z "$new_addr" ]; then
> -    echo "Callchain ASLR test [Failed - could not find remapped address]"
> -    err=1
> +    if perf evlist -v -i "${data}" | grep -q 'sample_type:.*STACK_USER'; then
> +      echo "Dropping stack user sample as possible ASLR leak"
> +      echo "Call-graph dwarf not supported with 'perf inject --aslr'"
> +      echo "Callchain ASLR test [Skip]"

[Severity: Medium]
The commit message states "Since one subtest is skipped, the complete test is
reported as skipped." However, it appears err is not set to 2 (the standard skip
code) here, meaning the script will exit with 0 (Ok) rather than being reported
as skipped by the test runner.

If setting err=2 was intentionally avoided because the script's cleanup
function currently assumes any non-zero exit code is a failure and leaves
temporary directories behind, would it be better to redesign the error
handling to support returning 2 without leaking temp files, or should the
commit message be corrected to reflect the actual exit status?

> +    else
> +      echo "Callchain ASLR test [Failed - could not find remapped address]"
> +      err=1
> +    fi
>    elif [ "$orig_addr" = "$new_addr" ]; then
>      echo "Callchain ASLR test [Failed - addresses are not remapped]"
>      err=1

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

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

end of thread, other threads:[~2026-06-29 11:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-29 11:05 [PATCH V2 linux-next] perf test: Skip failing 'perf test aslr' test case Thomas Richter
2026-06-29 11:12 ` sashiko-bot

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