If a guest of size exactly 2G is being backed with a 2G page by userspace, gmap will try to use a 2G page (large pud). But due to the address space being <= 2G, a segment-type ASCE is used, which means that there are no puds. This causes some checks to fail and ultimately kill the VM. Fix by disallowing 2G large pages for guests with a segment-type ASCE. Fixes: 46756c086310 ("KVM: s390: Allow for 2G hugepages") Cc: stable@vger.kernel.org Signed-off-by: Claudio Imbrenda --- arch/s390/kvm/gmap/gmap.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/s390/kvm/gmap/gmap.c b/arch/s390/kvm/gmap/gmap.c index 410226cf4dd0..6a6376a840fe 100644 --- a/arch/s390/kvm/gmap/gmap.c +++ b/arch/s390/kvm/gmap/gmap.c @@ -798,7 +798,8 @@ static inline bool gmap_2g_allowed(struct gmap *gmap, struct guest_fault *f, return test_bit(GMAP_FLAG_ALLOW_HPAGE_2G, &gmap->flags) && !((f->gfn ^ f->pfn) & ~_REGION3_FR_MASK) && slot->base_gfn <= ALIGN_DOWN(f->gfn, _PAGES_PER_REGION3) && - slot->base_gfn + slot->npages >= ALIGN(f->gfn + 1, _PAGES_PER_REGION3); + slot->base_gfn + slot->npages >= ALIGN(f->gfn + 1, _PAGES_PER_REGION3) && + gmap->asce.dt > ASCE_TYPE_SEGMENT; } /** -- 2.56.1