kvm: s390: Reject memory region operations for ucontrol VMs
Subsystems (4)
PATCH 1/1 kvm: s390: Reject memory region operations for ucontrol VMs
From: Christoph Schlameuss <[email protected]>
[ Upstream commit 7816e58967d0e6cadce05c8540b47ed027dc2499 ]
This change rejects the KVM_SET_USER_MEMORY_REGION and KVM_SET_USER_MEMORY_REGION2 ioctls when called on a ucontrol VM. This is necessary since ucontrol VMs have kvm->arch.gmap set to 0 and would thus result in a null pointer dereference further in. Memory management needs to be performed in userspace and using the ioctls KVM_S390_UCAS_MAP and KVM_S390_UCAS_UNMAP.
Also improve s390 specific documentation for KVM_SET_USER_MEMORY_REGION and KVM_SET_USER_MEMORY_REGION2.
[ Backport to 6.6.y: omitted KVM_SET_USER_MEMORY_REGION2 documentation
because that ioctl is absent from 6.6.y. ]
Message-ID: <[email protected]>
---
Hi Greg, Sasha, and kvm s390 maintainers,
I am working through the small CVE backports still missing from 6.6.y. This one addresses CVE-2024-43819. It rejects memory-region ioctls before a ucontrol VM can dereference its NULL gmap.
I (sadly) do not have an s390 to run the fix, but it built and the adaptation makes sense.
The fix is already present in 6.12.y, 6.18.y, and 7.2.y, but not in 6.6.y. This fix also affects 6.1.y, which will need a separate backport; this submission contains only the 6.6.y patch.
The target-specific adjustment is recorded in the bracketed note above.
Could you please queue it for 6.6.y?
CVE: CVE-2024-43819
Upstream: 7816e58967d0e6cadce05c8540b47ed027dc2499
AI assistance: An LLM helped identify, adapt, and validate this backport; I reviewed the resulting code and validation evidence.
Thanks,
Artem Dinaburg
Documentation/virt/kvm/api.rst | 6 ++++++ arch/s390/kvm/kvm-s390.c | 3 +++ 2 files changed, 9 insertions(+)
Documentation/virt/kvm/api.rst +6 -0
@@ -1363,6 +1363,12 @@ Instead, an abort (data abort if the cause of the page-table update was a load or a store, instruction abort if it was an instruction fetch) is injected in the guest. +S390: +^^^^^ + +Returns -EINVAL if the VM has the KVM_VM_S390_UCONTROL flag set. +Returns -EINVAL if called on a protected VM. + 4.36 KVM_SET_TSS_ADDR ---------------------
arch/s390/kvm/kvm-s390.c +3 -0
@@ -5769,6 +5769,9 @@ int kvm_arch_prepare_memory_region(struct kvm *kvm, {gpa_t size; +if (kvm_is_ucontrol (kvm)) +return -EINVAL ; +/* When we are protected, we should not change the memory slots */ if (kvm_s390_pv_get_handle (kvm))return -EINVAL ;
Signature · 1 line
2.39.5
[email protected]
AI reviewSashiko has reviewed this patch and found no issues. It looks great!
Quoted 23 lines
From: Christoph Schlameuss <[email protected]>
[ Upstream commit
7816e58967d0e6cadce05c8540b47ed027dc2499]This change rejects the
KVM_SET_USER_MEMORY_REGIONandKVM_SET_USER_MEMORY_REGION2ioctls when called on a ucontrol VM. This is necessary since ucontrol VMs havekvm->arch.gmapset to 0 and would thus result in a null pointer dereference further in. Memory management needs to be performed in userspace and using the ioctlsKVM_S390_UCAS_MAPandKVM_S390_UCAS_UNMAP.Also improve s390 specific documentation for
KVM_SET_USER_MEMORY_REGIONandKVM_SET_USER_MEMORY_REGION2.[ Backport to 6.6.y: omitted
KVM_SET_USER_MEMORY_REGION2documentation
because that ioctl is absent from 6.6.y. ]Signed-off-by Christoph Schlameuss <[email protected]>Fixes 27e0393f15fc ("KVM: s390: ucontrol: per vcpu address spaces")Reviewed-by Claudio Imbrenda <[email protected]>Signed-off-by Janosch Frank <[email protected]>[[email protected]: commit message spelling fix, subject prefix fix]
Quoted 3 lines
Message-ID: <[email protected]>
Assisted-by LLMSigned-off-by Artem Dinaburg <[email protected]>
Sashiko has reviewed this patch and found no issues. It looks great!
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
Quoted 2 lines
This one addresses CVE-2024-43819. It rejects memory-region ioctls before a ucontrol VM can dereference its NULL gmap.
Queued for 6.6, thanks.
Signature · 2 lines
Thanks, Sasha