Commit 9f536487 authored by James Morse's avatar James Morse Committed by Yongqiang Liu
Browse files

arm64: errata: Fix KVM Spectre-v2 mitigation selection for Cortex-A57/A72

stable inclusion
from stable-v4.19.268
commit 51febca41ae0333c29b4b12778f045a705d89370
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I69KBO


CVE: NA

--------------------------------

Both the Spectre-v2 and Spectre-BHB mitigations involve running a sequence
immediately after exiting a guest, before any branches. In the stable
kernels these sequences are built by copying templates into an empty vector
slot.

For Spectre-BHB, Cortex-A57 and A72 require the branchy loop with k=8.
If Spectre-v2 needs mitigating at the same time, a firmware call to EL3 is
needed. The work EL3 does at this point is also enough to mitigate
Spectre-BHB.

When enabling the Spectre-BHB mitigation, spectre_bhb_enable_mitigation()
should check if a slot has already been allocated for Spectre-v2, meaning
no work is needed for Spectre-BHB.

This check was missed in the earlier backport, add it.

Fixes: c20d55174479 ("arm64: Mitigate spectre style branch history side channels")
Signed-off-by: default avatarJames Morse <james.morse@arm.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarYongqiang Liu <liuyongqiang13@huawei.com>
parent 62fb1cde
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment