Skip to contentSkip to conversation

perf test: Skip for paranoid 3

PATCH In review Ian Rogers 2 participants 5 messages Jun 29, 2022 – Jul 1, 2022 perf events

lore
Share & tools
lore

Ian Rogers

author reviewer
#0 lore raw

PATCH 1/1 perf test: Skip for paranoid 3

Add skip tests for paranoid level being 3.
Rather than skipping lines starting "Failed", skip lines containing "failed" - making the behavior consistent with the previous python version.

Fixes ec906102e5b7 ("perf test: Fix "perf stat CSV output linter" test on s390")
---
 tools/perf/tests/shell/stat+csv_output.sh | 20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)
tools/perf/tests/shell/stat+csv_output.sh +17 -3
index 38c26f3ef4c1..b165c81fccb4 100755
@@ -26,9 +26,8 @@ function commachecker()
 
 	while read line
 	do
-		# Check for lines beginning with Failed
-		x=${line:0:6}
-		[ "$x" = "Failed" ] && continue
+		# Skip lines containing failed.
+		(echo "$line" | grep -q "failed") && continue
 
 		# Count the number of commas
 		x=$(echo $line | tr -d -c ',')
@@ -51,6 +50,11 @@ function ParanoidAndNotRoot()
 check_no_args()
 {
 	echo -n "Checking CSV output: no args "
+	if ParanoidAndNotRoot 2
+	then
+		echo "[Skip] paranoid and not root"
+		return
+	fi
 	perf stat -x, true 2>&1 | commachecker --no-args
 	echo "[Success]"
 }
@@ -83,6 +87,11 @@ check_system_wide_no_aggr()
 check_interval()
 {
 	echo -n "Checking CSV output: interval "
+	if ParanoidAndNotRoot 2
+	then
+		echo "[Skip] paranoid and not root"
+		return
+	fi
 	perf stat -x, -I 1000 true 2>&1 | commachecker --interval
 	echo "[Success]"
 }
@@ -91,6 +100,11 @@ check_interval()
 check_event()
 {
 	echo -n "Checking CSV output: event "
+	if ParanoidAndNotRoot 2
+	then
+		echo "[Skip] paranoid and not root"
+		return
+	fi
 	perf stat -x, -e cpu-clock true 2>&1 | commachecker --event
 	echo "[Success]"
 }
Signature · 1 line
2.37.0.rc0.161.g10f37bed90-goog
maintainer
#1 lore raw
Quoted 4 lines · Ian Rogers

Add skip tests for paranoid level being 3.
Rather than skipping lines starting "Failed", skip lines containing "failed" - making the behavior consistent with the previous python version.

paranoid 3 is an out of tree patch.

author reviewer
#2 lore raw
Quoted 8 lines · Peter Zijlstra
Quoted 4 lines · Ian Rogers

Add skip tests for paranoid level being 3.
Rather than skipping lines starting "Failed", skip lines containing "failed" - making the behavior consistent with the previous python version.

paranoid 3 is an out of tree patch.

Thanks, what is the right way to resolve this? My desktop appears to be carrying the patch and I'd like the tests to be as green as possible.

Thanks,
Ian

maintainer
#3 lore raw
Quoted 8 lines · Ian Rogers
Quoted 7 lines · Peter Zijlstra
Quoted 4 lines · Ian Rogers

Add skip tests for paranoid level being 3.
Rather than skipping lines starting "Failed", skip lines containing "failed" - making the behavior consistent with the previous python version.

Quoted 5 lines
Quoted 1 line

paranoid 3 is an out of tree patch.

Thanks, what is the right way to resolve this? My desktop appears to be carrying the patch and I'd like the tests to be as green as possible.

Then you desktop is probably running a Debian or derivative distro kernel. You can run your own kernel, or ask the Debian team to ditch their hack and use the LSM hooks to further limit perf usage if they feel this is required.

The big advantage of the LSM hooks is that they can explicitly white-list the perf binary while dis-allowing random users access to the syscall. That way perf will still work but the possible exploit potential is much reduced.

author reviewer
#4 lore raw
Quoted 21 lines · Peter Zijlstra
Quoted 8 lines · Ian Rogers
Quoted 7 lines · Peter Zijlstra
Quoted 4 lines · Ian Rogers

Add skip tests for paranoid level being 3.
Rather than skipping lines starting "Failed", skip lines containing "failed" - making the behavior consistent with the previous python version.

Quoted 5 lines
Quoted 1 line

paranoid 3 is an out of tree patch.

Thanks, what is the right way to resolve this? My desktop appears to be carrying the patch and I'd like the tests to be as green as possible.

Then you desktop is probably running a Debian or derivative distro kernel. You can run your own kernel, or ask the Debian team to ditch their hack and use the LSM hooks to further limit perf usage if they feel this is required.

Quoted 4 lines

The big advantage of the LSM hooks is that they can explicitly white-list the perf binary while dis-allowing random users access to the syscall. That way perf will still work but the possible exploit potential is much reduced.

Thanks, neither rewriting Debian's security to use LSM or running a custom kernel are going to work in the environment I have. Presumably it is going to be a matter of policy not to allow this test fix to land, meaning Debian kernels are going to show failing tests? I can carry the patch privately but that's a tech-debt, merge-conflict mess.

Thanks,
Ian