OpenCloudOS-Kernel/virt/kvm/arm
Oliver Upton 91ccae1327 KVM: arm64: vgic-v2: Check for non-NULL vCPU in vgic_v2_parse_attr()
[ Upstream commit 6ddb4f372fc63210034b903d96ebbeb3c7195adb ]

Fix CVE: CVE-2024-36953

vgic_v2_parse_attr() is responsible for finding the vCPU that matches
the user-provided CPUID, which (of course) may not be valid. If the ID
is invalid, kvm_get_vcpu_by_id() returns NULL, which isn't handled
gracefully.

Similar to the GICv3 uaccess flow, check that kvm_get_vcpu_by_id()
actually returns something and fail the ioctl if not.

Cc: stable@vger.kernel.org
Fixes: 7d450e2821 ("KVM: arm/arm64: vgic-new: Add userland access to VGIC dist registers")
Reported-by: Alexander Potapenko <glider@google.com>
Tested-by: Alexander Potapenko <glider@google.com>
Reviewed-by: Alexander Potapenko <glider@google.com>
Reviewed-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20240424173959.3776798-2-oliver.upton@linux.dev
Signed-off-by: Oliver Upton <oliver.upton@linux.dev>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Jianping Liu <frankjpliu@tencent.com>
2024-11-28 15:09:43 +08:00
..
hyp ock: sync codes to ock 5.4.119-20.0009.21 2024-06-11 20:27:38 +08:00
vgic KVM: arm64: vgic-v2: Check for non-NULL vCPU in vgic_v2_parse_attr() 2024-11-28 15:09:43 +08:00
aarch32.c ock: sync codes to ock 5.4.119-20.0009.21 2024-06-11 20:27:38 +08:00
arch_timer.c tkernel: add base tlinux kernel interfaces 2024-06-11 20:09:33 +08:00
arm.c tkernel: sync code to the same with tk4 pub/lts/0017-kabi 2024-06-12 13:13:20 +08:00
mmio.c ock: sync codes to ock 5.4.119-20.0009.21 2024-06-11 20:27:38 +08:00
mmu.c KVM: arm64: Add support for FEAT_TLBIRANGE 2024-10-29 22:16:01 +08:00
perf.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 234 2019-06-19 17:09:07 +02:00
pmu.c KVM: arm64: pmu: Make overflow handler NMI safe 2024-11-05 17:04:08 +08:00
psci.c tkernel: sync code to the same with tk4 pub/lts/0017-kabi 2024-06-12 13:13:20 +08:00
trace.h KVM: arm/arm64: Fix TRACE_INCLUDE_PATH 2019-02-19 21:05:51 +00:00