]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: arm64: vgic-v3: Drop the reporting of GICR_TYPER.Last for userspace
authorZenghui Yu <yuzenghui@huawei.com>
Tue, 17 Nov 2020 15:16:29 +0000 (23:16 +0800)
committerMarc Zyngier <maz@kernel.org>
Tue, 17 Nov 2020 18:51:09 +0000 (18:51 +0000)
commit4f7227a8580636e8c4e0918ed4212e1adf89d987
treeafc51fc60460b2d1bcc3ecea4d8bd9e580650ecc
parent53e6c79c0718b9eafc61d887c6f846aeb1cedeec
KVM: arm64: vgic-v3: Drop the reporting of GICR_TYPER.Last for userspace

It was recently reported that if GICR_TYPER is accessed before the RD base
address is set, we'll suffer from the unset @rdreg dereferencing. Oops...

gpa_t last_rdist_typer = rdreg->base + GICR_TYPER +
(rdreg->free_index - 1) * KVM_VGIC_V3_REDIST_SIZE;

It's "expected" that users will access registers in the redistributor if
the RD has been properly configured (e.g., the RD base address is set). But
it hasn't yet been covered by the existing documentation.

Per discussion on the list [1], the reporting of the GICR_TYPER.Last bit
for userspace never actually worked. And it's difficult for us to emulate
it correctly given that userspace has the flexibility to access it any
time. Let's just drop the reporting of the Last bit for userspace for now
(userspace should have full knowledge about it anyway) and it at least
prevents kernel from panic ;-)

[1] https://lore.kernel.org/kvmarm/c20865a267e44d1e2c0d52ce4e012263@kernel.org/

Fixes: 715347ab428d ("KVM: arm/arm64: Revisit Redistributor TYPER last bit computation")
Reported-by: Keqian Zhu <zhukeqian1@huawei.com>
Signed-off-by: Zenghui Yu <yuzenghui@huawei.com>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Reviewed-by: Eric Auger <eric.auger@redhat.com>
Link: https://lore.kernel.org/r/20201117151629.1738-1-yuzenghui@huawei.com
Cc: stable@vger.kernel.org
arch/arm64/kvm/vgic/vgic-mmio-v3.c