linux/arch
Fuad Tabba ec197dca87 KVM: arm64: Revert accidental drop of kvm_uninit_stage2_mmu() for non-NV VMs
Commit 0c4762e268 ("KVM: arm64: nv: Avoid NV stage-2 code when NV is
not supported") added an early return to several functions in
arch/arm64/kvm/nested.c to prevent a UBSAN shift-out-of-bounds error
when accessing the pgt union for non-nested VMs.

However, this early return was inadvertently applied to
kvm_arch_flush_shadow_all() as well, causing it to skip the call to
kvm_uninit_stage2_mmu(kvm) for all non-nested VMs.

For pKVM, skipping this teardown means the host never unshares the
guest's memory with the EL2 hypervisor. When the host kernel later
recycles these leaked pages for a new VM, it attempts to re-share them.
The hypervisor correctly rejects this with -EPERM, triggering a host
WARN_ON and hanging the guest.

Fix this by dropping the early return from kvm_arch_flush_shadow_all().
The for-loop guarding the nested MMU cleanup already bounds itself when
nested_mmus_size == 0, allowing execution to proceed to
kvm_uninit_stage2_mmu() as intended.

Reported-by: Mark Brown <broonie@kernel.org>
Closes: https://lore.kernel.org/all/60916cb6-f460-4751-b910-f63c58700ad0@sirena.org.uk/
Fixes: 0c4762e268 ("KVM: arm64: nv: Avoid NV stage-2 code when NV is not supported")
Signed-off-by: Fuad Tabba <tabba@google.com>
Tested-by: Mark Brown <broonie@kernel.org>
Link: https://patch.msgid.link/20260222083352.89503-1-tabba@google.com
Signed-off-by: Marc Zyngier <maz@kernel.org>
2026-02-23 16:26:08 +00:00
..
alpha alpha updates for v6.19 2025-12-11 08:01:52 +09:00
arc Ext4 bug fixes for 6.18-rc2, including 2025-10-15 07:51:57 -07:00
arm sound fixes for 6.19-rc1 2025-12-13 16:09:10 +12:00
arm64 KVM: arm64: Revert accidental drop of kvm_uninit_stage2_mmu() for non-NV VMs 2026-02-23 16:26:08 +00:00
csky csky 6.19 Release Notes 2025-12-10 12:17:29 +09:00
hexagon This update includes the following changes: 2025-12-03 11:28:38 -08:00
loongarch LoongArch: BPF: Enhance the bpf_arch_text_poke() function 2025-12-31 15:19:21 +08:00
m68k Networking changes for 6.19. 2025-12-03 17:24:33 -08:00
microblaze arch: hookup listns() system call 2025-11-03 17:41:18 +01:00
mips MIPS: Fix a reference leak bug in ip22_check_gio() 2025-12-15 16:11:14 +01:00
nios2 arch/nios2: replace "__auto_type" and adjacent equivalent with "auto" 2025-12-08 15:32:15 -08:00
openrisc Ext4 bug fixes for 6.18-rc2, including 2025-10-15 07:51:57 -07:00
parisc TTY/Serial changes for 6.19-rc1 2025-12-06 18:38:19 -08:00
powerpc powerpc/32: Restore disabling of interrupts at interrupt/syscall exit 2025-12-22 18:25:07 +05:30
riscv riscv: Add SBI debug trigger extension and function ids 2025-12-19 00:22:30 -07:00
s390 s390/stacktrace: Do not fallback to RA register 2025-12-14 11:03:58 +01:00
sh sound fixes for 6.19-rc1 2025-12-13 16:09:10 +12:00
sparc dma-mapping updates for Linux 6.19: 2025-12-06 09:25:05 -08:00
um Address various objtool scalability bugs/inefficiencies exposed by 2025-12-06 11:56:51 -08:00
x86 x86/microcode/AMD: Fix Entrysign revision check for Zen5/Strix Halo 2025-12-29 20:08:02 +01:00
xtensa TTY/Serial changes for 6.19-rc1 2025-12-06 18:38:19 -08:00
.gitignore
Kconfig treewide: drop outdated compiler version remarks in Kconfig help texts 2025-11-12 10:00:14 -08:00