Skip to content

Commit a8a54a6

Browse files
committed
selftests/powerpc: Detect taint change in mitigation patching test
Currently the mitigation patching test errors out if the kernel is tainted prior to the test running. That causes the test to fail unnecessarily if some other test has caused the kernel to be tainted, or if a proprietary or force module is loaded for example. Instead just warn if the kernel is tainted to begin with, and only report a change in the taint state as an error in the test. Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://patch.msgid.link/20241106130453.1741013-5-mpe@ellerman.id.au
1 parent c6a7555 commit a8a54a6

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

tools/testing/selftests/powerpc/security/mitigation-patching.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,7 @@ fi
3636

3737
tainted=$(cat /proc/sys/kernel/tainted)
3838
if [[ "$tainted" -ne 0 ]]; then
39-
echo "Error: kernel already tainted!" >&2
40-
exit 1
39+
echo "Warning: kernel already tainted! ($tainted)" >&2
4140
fi
4241

4342
mitigations="barrier_nospec stf_barrier count_cache_flush rfi_flush entry_flush uaccess_flush"
@@ -68,9 +67,10 @@ fi
6867
echo "Waiting for timeout ..."
6968
wait
7069

70+
orig_tainted=$tainted
7171
tainted=$(cat /proc/sys/kernel/tainted)
72-
if [[ "$tainted" -ne 0 ]]; then
73-
echo "Error: kernel became tainted!" >&2
72+
if [[ "$tainted" != "$orig_tainted" ]]; then
73+
echo "Error: kernel newly tainted, before ($orig_tainted) after ($tainted)" >&2
7474
exit 1
7575
fi
7676

0 commit comments

Comments
 (0)