Skip to content

Commit aca411a

Browse files
Julius Niedworokborntraeger
authored andcommitted
KVM: s390: reset KVM_REQ_MMU_RELOAD if mapping the prefix failed
When triggering KVM_RUN without a user memory region being mapped (KVM_SET_USER_MEMORY_REGION) a validity intercept occurs. This could happen, if the user memory region was not mapped initially or if it was unmapped after the vcpu is initialized. The function kvm_s390_handle_requests checks for the KVM_REQ_MMU_RELOAD bit. The check function always clears this bit. If gmap_mprotect_notify returns an error code, the mapping failed, but the KVM_REQ_MMU_RELOAD was not set anymore. So the next time kvm_s390_handle_requests is called, the execution would fall trough the check for KVM_REQ_MMU_RELOAD. The bit needs to be resetted, if gmap_mprotect_notify returns an error code. Resetting the bit with kvm_make_request(KVM_REQ_MMU_RELOAD, vcpu) fixes the bug. Reviewed-by: David Hildenbrand <dahi@linux.vnet.ibm.com> Signed-off-by: Julius Niedworok <jniedwor@linux.vnet.ibm.com> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
1 parent 75a4615 commit aca411a

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

arch/s390/kvm/kvm-s390.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2362,8 +2362,10 @@ static int kvm_s390_handle_requests(struct kvm_vcpu *vcpu)
23622362
rc = gmap_mprotect_notify(vcpu->arch.gmap,
23632363
kvm_s390_get_prefix(vcpu),
23642364
PAGE_SIZE * 2, PROT_WRITE);
2365-
if (rc)
2365+
if (rc) {
2366+
kvm_make_request(KVM_REQ_MMU_RELOAD, vcpu);
23662367
return rc;
2368+
}
23672369
goto retry;
23682370
}
23692371

0 commit comments

Comments
 (0)