android_kernel_samsung_sm8650/arch/arm64
Marc Zyngier 97856a9d77 KVM: arm64: GICv4.1: Fix race with doorbell on VPE activation/deactivation
commit ef3691683d7bfd0a2acf48812e4ffe894f10bfa8 upstream.

To save the vgic LPI pending state with GICv4.1, the VPEs must all be
unmapped from the ITSs so that the sGIC caches can be flushed.
The opposite is done once the state is saved.

This is all done by using the activate/deactivate irqdomain callbacks
directly from the vgic code. Crutially, this is done without holding
the irqdesc lock for the interrupts that represent the VPE. And these
callbacks are changing the state of the irqdesc. What could possibly
go wrong?

If a doorbell fires while we are messing with the irqdesc state,
it will acquire the lock and change the interrupt state concurrently.
Since we don't hole the lock, curruption occurs in on the interrupt
state. Oh well.

While acquiring the lock would fix this (and this was Shanker's
initial approach), this is still a layering violation we could do
without. A better approach is actually to free the VPE interrupt,
do what we have to do, and re-request it.

It is more work, but this usually happens only once in the lifetime
of the VM and we don't really care about this sort of overhead.

Fixes: f66b7b151e ("KVM: arm64: GICv4.1: Try to save VLPI state in save_pending_tables")
Reported-by: Shanker Donthineni <sdonthineni@nvidia.com>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/20230118022348.4137094-1-sdonthineni@nvidia.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-02-01 08:34:39 +01:00
..
boot arm64: dts: qcom: msm8992-libra: Fix the memory map 2023-02-01 08:34:08 +01:00
configs This update includes the following changes: 2022-10-10 13:04:25 -07:00
crypto crypto: arm64/sm3 - fix possible crash with CFI enabled 2022-12-31 13:32:34 +01:00
hyperv hyperv: simplify and rename generate_guest_id 2022-09-28 13:36:56 +00:00
include arm64: efi: Account for the EFI runtime stack in stack unwinder 2023-02-01 08:34:35 +01:00
kernel arm64: efi: Account for the EFI runtime stack in stack unwinder 2023-02-01 08:34:35 +01:00
kvm KVM: arm64: GICv4.1: Fix race with doorbell on VPE activation/deactivation 2023-02-01 08:34:39 +01:00
lib Networking changes for 6.0. 2022-08-03 16:29:08 -07:00
mm arm64: efi: Recover from synchronous exceptions occurring in firmware 2023-02-01 08:34:34 +01:00
net bpf: arm64: No support of struct argument in trampoline programs 2022-09-06 19:51:14 -07:00
tools arm64/sysreg: Fix typo in SCTR_EL1.SPINTMASK 2022-10-07 14:30:11 +01:00
xen xen: allow pv-only hypercalls only with CONFIG_XEN_PV 2021-11-02 08:11:01 -05:00
Kbuild kbuild: use more subdir- for visiting subdirectories while cleaning 2021-10-24 13:49:46 +09:00
Kconfig arm64 fixes: 2022-10-14 12:38:03 -07:00
Kconfig.debug
Kconfig.platforms ARM: SoC code changes for 6.1 2022-10-06 11:22:25 -07:00
Makefile Kbuild updates for v6.1 2022-10-10 12:00:45 -07:00