mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-23 17:30:02 +00:00
selftests/powerpc: Return skip code for spectre_v2
When running under older versions of qemu of under newer versions with old machine types, some security features will not be reported to the guest. This will lead the guest OS to consider itself Vulnerable to spectre_v2. So, spectre_v2 test fails in such cases when the host is mitigated and miss predictions cannot be detected as expected by the test. Make it return the skip code instead, for this particular case. We don't want to miss the case when the test fails and the system reports as mitigated or not affected. But it is not a problem to miss failures when the system reports as Vulnerable. Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://lore.kernel.org/r/20200728155039.401445-1-cascardo@canonical.com
This commit is contained in:
parent
b859c95cf4
commit
f3054ffd71
1 changed files with 10 additions and 0 deletions
|
@ -183,6 +183,16 @@ int spectre_v2_test(void)
|
|||
if (miss_percent > 15) {
|
||||
printf("Branch misses > 15%% unexpected in this configuration!\n");
|
||||
printf("Possible mis-match between reported & actual mitigation\n");
|
||||
/*
|
||||
* Such a mismatch may be caused by a guest system
|
||||
* reporting as vulnerable when the host is mitigated.
|
||||
* Return skip code to avoid detecting this as an error.
|
||||
* We are not vulnerable and reporting otherwise, so
|
||||
* missing such a mismatch is safe.
|
||||
*/
|
||||
if (state == VULNERABLE)
|
||||
return 4;
|
||||
|
||||
return 1;
|
||||
}
|
||||
break;
|
||||
|
|
Loading…
Reference in a new issue