]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
KVM: arm64: Don't write junk to sysregs on reset
authorMarc Zyngier <maz@kernel.org>
Mon, 5 Aug 2019 09:34:51 +0000 (10:34 +0100)
committerKhalid Elmously <khalid.elmously@canonical.com>
Wed, 4 Sep 2019 06:16:38 +0000 (02:16 -0400)
commit28cab5026cd931f559eff50d394ffca92705fcf8
tree448f4ad13540bed039bf9721b54e17d1ae0e1c8f
parenta9692a62893fad78f41ecb9165f2f5e9381126ed
KVM: arm64: Don't write junk to sysregs on reset

BugLink: https://bugs.launchpad.net/bugs/1842114
[ Upstream commit 03fdfb2690099c19160a3f2c5b77db60b3afeded ]

At the moment, the way we reset system registers is mildly insane:
We write junk to them, call the reset functions, and then check that
we have something else in them.

The "fun" thing is that this can happen while the guest is running
(PSCI, for example). If anything in KVM has to evaluate the state
of a system register while junk is in there, bad thing may happen.

Let's stop doing that. Instead, we track that we have called a
reset function for that register, and assume that the reset
function has done something. This requires fixing a couple of
sysreg refinition in the trap table.

In the end, the very need of this reset check is pretty dubious,
as it doesn't check everything (a lot of the sysregs leave outside of
the sys_regs[] array). It may well be axed in the near future.

Tested-by: Zenghui Yu <yuzenghui@huawei.com>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
arch/arm64/kvm/sys_regs.c