]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
KVM: s390: vsie: Fix unshadowing logic
authorClaudio Imbrenda <imbrenda@linux.ibm.com>
Tue, 19 May 2026 15:01:12 +0000 (17:01 +0200)
committerClaudio Imbrenda <imbrenda@linux.ibm.com>
Fri, 22 May 2026 09:25:10 +0000 (11:25 +0200)
commit2d505c290667eba67352c5db303ec92b7de860ad
treedac1ad5d429e552dbd9642fedc01740cd51edba7
parent4df4b7cdf54620aa848e7d83d253bb944313f7bd
KVM: s390: vsie: Fix unshadowing logic

In some cases (i.e. under extreme memory pressure on the host),
attempting to shadow memory will result in the same memory being
unshadowed, causing a loop.

Add a PGSTE bit to distinguish between shadowed memory and shadowed DAT
tables, fix the unshadowing logic in _gmap_ptep_xchg() to prevent
unnecessary unshadowing and perform better checks.

Also fix the unshadowing logic in _gmap_crstep_xchg_atomic() which did
not unshadow properly when the large page would become unprotected.

Opportunistically add a check in gmap_protect_rmap() to make sure it
won't be called with level == TABLE_TYPE_PAGE_TABLE.

Signed-off-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
Fixes: a2c17f9270cc ("KVM: s390: New gmap code")
Reviewed-by: Christian Borntraeger <borntraeger@linux.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@linux.ibm.com>
arch/s390/kvm/dat.c
arch/s390/kvm/dat.h
arch/s390/kvm/gaccess.c
arch/s390/kvm/gmap.c
arch/s390/kvm/gmap.h