Skip to content

Commit

Permalink
selftests/powerpc: Detect taint change in mitigation patching test
Browse files Browse the repository at this point in the history
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 <[email protected]>
Link: https://patch.msgid.link/[email protected]
  • Loading branch information
mpe committed Nov 7, 2024
1 parent c6a7555 commit a8a54a6
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@ fi

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

mitigations="barrier_nospec stf_barrier count_cache_flush rfi_flush entry_flush uaccess_flush"
Expand Down Expand Up @@ -68,9 +67,10 @@ fi
echo "Waiting for timeout ..."
wait

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

Expand Down

0 comments on commit a8a54a6

Please sign in to comment.