linux-stable/arch/arm64
Marc Zyngier 4f902f03ef KVM: arm64: Fix AArch32 register narrowing on userspace write
commit 947051e361 upstream.

When userspace writes to one of the core registers, we make
sure to narrow the corresponding GPRs if PSTATE indicates
an AArch32 context.

The code tries to check whether the context is EL0 or EL1 so
that it narrows the correct registers. But it does so by checking
the full PSTATE instead of PSTATE.M.

As a consequence, and if we are restoring an AArch32 EL0 context
in a 64bit guest, and that PSTATE has *any* bit set outside of
PSTATE.M, we narrow *all* registers instead of only the first 15,
destroying the 64bit state.

Obviously, this is not something the guest is likely to enjoy.

Correctly masking PSTATE to only evaluate PSTATE.M fixes it.

Fixes: 90c1f934ed ("KVM: arm64: Get rid of the AArch32 register mapping code")
Reported-by: Nina Schoetterl-Glausch <nsg@linux.ibm.com>
Cc: stable@vger.kernel.org
Reviewed-by: Nina Schoetterl-Glausch <nsg@linux.ibm.com>
Acked-by: Oliver Upton <oliver.upton@linux.dev>
Link: https://lore.kernel.org/r/20240524141956.1450304-2-maz@kernel.org
Signed-off-by: Marc Zyngier <maz@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-06-16 13:41:37 +02:00
..
boot arm64: dts: hi3798cv200: fix the size of GICR 2024-06-16 13:41:35 +02:00
configs arm64: defconfig: remove CONFIG_COMMON_CLK_NPCM8XX=y 2023-10-06 14:57:03 +02:00
crypto crypto: arm64/neonbs - fix out-of-bounds access on short input 2024-03-06 14:45:10 +00:00
hyperv hyperv: simplify and rename generate_guest_id 2022-09-28 13:36:56 +00:00
include arm64: asm-bug: Add .align 2 to the end of __BUG_ENTRY 2024-06-12 11:03:52 +02:00
kernel arm64/sve: Lower the maximum allocation for the SVE ptrace regset 2024-03-26 18:20:25 -04:00
kvm KVM: arm64: Fix AArch32 register narrowing on userspace write 2024-06-16 13:41:37 +02:00
lib arm64: csum: Fix OoB access in IP checksum code for negative lengths 2023-09-13 09:43:01 +02:00
mm arm64: hibernate: Fix level3 translation fault in swsusp_save() 2024-04-27 17:07:16 +02:00
net bpf, arm64: Fix incorrect runtime stats 2024-05-17 11:55:58 +02:00
tools arm64: Rename ARM64_WORKAROUND_2966298 2024-01-31 16:17:01 -08:00
xen
Kbuild
Kconfig arm64: atomics: lse: remove stale dependency on JUMP_LABEL 2024-05-25 16:21:34 +02:00
Kconfig.debug
Kconfig.platforms ARM: SoC code changes for 6.1 2022-10-06 11:22:25 -07:00
Makefile arm64: add dependency between vmlinuz.efi and Image 2023-12-20 17:00:24 +01:00