]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: s390: Fix lockdep issue in vm memop
authorJanis Schoetterl-Glausch <scgl@linux.ibm.com>
Fri, 11 Mar 2022 17:00:40 +0000 (18:00 +0100)
committerHeiko Carstens <hca@linux.ibm.com>
Mon, 2 May 2022 17:45:03 +0000 (19:45 +0200)
commitadcd6635796d7ee660b79cc94a3aed7b3e2aec91
tree625cd38eba44cc56d11b7360690ad83feed99af6
parentc7eea20247b18efcea95b5b9692f25b7ae62b62d
KVM: s390: Fix lockdep issue in vm memop

Issuing a memop on a protected vm does not make sense,
neither is the memory readable/writable, nor does it make sense to check
storage keys. This is why the ioctl will return -EINVAL when it detects
the vm to be protected. However, in order to ensure that the vm cannot
become protected during the memop, the kvm->lock would need to be taken
for the duration of the ioctl. This is also required because
kvm_s390_pv_is_protected asserts that the lock must be held.
Instead, don't try to prevent this. If user space enables secure
execution concurrently with a memop it must accecpt the possibility of
the memop failing.
Still check if the vm is currently protected, but without locking and
consider it a heuristic.

Fixes: 4f43b1a785ce ("KVM: s390: Add vm IOCTL for key checked guest absolute memory access")
Signed-off-by: Janis Schoetterl-Glausch <scgl@linux.ibm.com>
Reviewed-by: Janosch Frank <frankja@linux.ibm.com>
Reviewed-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
Link: https://lore.kernel.org/r/20220322153204.2637400-1-scgl@linux.ibm.com
Signed-off-by: Christian Borntraeger <borntraeger@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
arch/s390/kvm/kvm-s390.c