]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: s390: Honor storage keys when accessing guest memory
authorJanis Schoetterl-Glausch <scgl@linux.ibm.com>
Fri, 11 Feb 2022 18:22:07 +0000 (19:22 +0100)
committerChristian Borntraeger <borntraeger@linux.ibm.com>
Mon, 14 Feb 2022 15:12:57 +0000 (16:12 +0100)
commit39c8e4af1bec2f73787e14b40ff95b133360f849
tree4663749ab29ab83935804622a3b960f1a8b6ee48
parentf600eefd819ff9978c10997583640b55e8bc0ad2
KVM: s390: Honor storage keys when accessing guest memory

Storage key checking had not been implemented for instructions emulated
by KVM. Implement it by enhancing the functions used for guest access,
in particular those making use of access_guest which has been renamed
to access_guest_with_key.
Accesses via access_guest_real should not be key checked.

For actual accesses, key checking is done by
copy_from/to_user_key (which internally uses MVCOS/MVCP/MVCS).
In cases where accessibility is checked without an actual access,
this is performed by getting the storage key and checking if the access
key matches. In both cases, if applicable, storage and fetch protection
override are honored.

Signed-off-by: Janis Schoetterl-Glausch <scgl@linux.ibm.com>
Reviewed-by: Janosch Frank <frankja@linux.ibm.com>
Reviewed-by: Christian Borntraeger <borntraeger@linux.ibm.com>
Link: https://lore.kernel.org/r/20220211182215.ce6bbc0-3-scgl@linux.ibm.com
Signed-off-by: Christian Borntraeger <borntraeger@linux.ibm.com>
arch/s390/include/asm/ctl_reg.h
arch/s390/include/asm/page.h
arch/s390/kvm/gaccess.c
arch/s390/kvm/gaccess.h
arch/s390/kvm/intercept.c
arch/s390/kvm/kvm-s390.c