]> www.infradead.org Git - nvme.git/commit
KVM: s390: fix access register usage in ioctls
authorEric Farman <farman@linux.ibm.com>
Tue, 20 Feb 2024 21:12:10 +0000 (22:12 +0100)
committerHeiko Carstens <hca@linux.ibm.com>
Thu, 22 Feb 2024 15:06:56 +0000 (16:06 +0100)
commit01be7f53dfc29e0a362f3d05e5ab2c8dfcc171c8
tree50621901f71ea37531847dee2c7c4418381f7679
parent4a5993287467d2d0401503256dc9d2690c7f2020
KVM: s390: fix access register usage in ioctls

The routine ar_translation() can be reached by both the instruction
intercept path (where the access registers had been loaded with the
guest register contents), and the MEM_OP ioctls (which hadn't).
Since this routine saves the current registers to vcpu->run,
this routine erroneously saves host registers into the guest space.

Introduce a boolean in the kvm_vcpu_arch struct to indicate whether
the registers contain guest contents. If they do (the instruction
intercept path), the save can be performed and the AR translation
is done just as it is today. If they don't (the MEM_OP path), the
AR can be read from vcpu->run without stashing the current contents.

Reviewed-by: Heiko Carstens <hca@linux.ibm.com>
Reviewed-by: Nina Schoetterl-Glausch <nsg@linux.ibm.com>
Reviewed-by: Christian Borntraeger <borntraeger@linux.ibm.com>
Signed-off-by: Eric Farman <farman@linux.ibm.com>
Link: https://lore.kernel.org/r/20240220211211.3102609-2-farman@linux.ibm.com
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
arch/s390/include/asm/kvm_host.h
arch/s390/kvm/gaccess.c
arch/s390/kvm/kvm-s390.c