]> git.ipfire.org Git - thirdparty/linux.git/commit
KVM: arm64: Block cacheable PFNMAP mapping
authorAnkit Agrawal <ankita@nvidia.com>
Sat, 5 Jul 2025 07:17:14 +0000 (07:17 +0000)
committerOliver Upton <oliver.upton@linux.dev>
Mon, 7 Jul 2025 23:43:27 +0000 (16:43 -0700)
commit2a8dfab26677ae37243a40d170704588f791cfd3
treeecd29128a8b937c7fdfa8303ede22d37d0da1d10
parent216887f79d9878d9cb169729fea3bb16c56db465
KVM: arm64: Block cacheable PFNMAP mapping

Fixes a security bug due to mismatched attributes between S1 and
S2 mapping.

Currently, it is possible for a region to be cacheable in the userspace
VMA, but mapped non cached in S2. This creates a potential issue where
the VMM may sanitize cacheable memory across VMs using cacheable stores,
ensuring it is zeroed. However, if KVM subsequently assigns this memory
to a VM as uncached, the VM could end up accessing stale, non-zeroed data
from a previous VM, leading to unintended data exposure. This is a security
risk.

Block such mismatch attributes case by returning EINVAL when userspace
try to map PFNMAP cacheable. Only allow NORMAL_NC and DEVICE_*.

CC: Oliver Upton <oliver.upton@linux.dev>
CC: Catalin Marinas <catalin.marinas@arm.com>
CC: Sean Christopherson <seanjc@google.com>
Suggested-by: Jason Gunthorpe <jgg@nvidia.com>
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
Reviewed-by: David Hildenbrand <david@redhat.com>
Tested-by: Donald Dutile <ddutile@redhat.com>
Signed-off-by: Ankit Agrawal <ankita@nvidia.com>
Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
Link: https://lore.kernel.org/r/20250705071717.5062-4-ankita@nvidia.com
Signed-off-by: Oliver Upton <oliver.upton@linux.dev>
arch/arm64/kvm/mmu.c