Skip to content

Commit 1b0c58a

Browse files
committed
Merge tag 'kvm-s390-master-5.7-1' of git://git.kernel.org/pub/scm/linux/kernel/git/kvms390/linux into HEAD
KVM: s390: Fixes for vsie (nested hypervisors) - Several fixes for corner cases of nesting. Still relevant as it might crash host or first level guest or temporarily leak memory.
2 parents 5c8beb4 + 1493e0f commit 1b0c58a

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

arch/s390/kvm/vsie.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1202,6 +1202,7 @@ static int vsie_run(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page)
12021202
scb_s->iprcc = PGM_ADDRESSING;
12031203
scb_s->pgmilc = 4;
12041204
scb_s->gpsw.addr = __rewind_psw(scb_s->gpsw, 4);
1205+
rc = 1;
12051206
}
12061207
return rc;
12071208
}

arch/s390/mm/gmap.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -787,14 +787,18 @@ static void gmap_call_notifier(struct gmap *gmap, unsigned long start,
787787
static inline unsigned long *gmap_table_walk(struct gmap *gmap,
788788
unsigned long gaddr, int level)
789789
{
790+
const int asce_type = gmap->asce & _ASCE_TYPE_MASK;
790791
unsigned long *table;
791792

792793
if ((gmap->asce & _ASCE_TYPE_MASK) + 4 < (level * 4))
793794
return NULL;
794795
if (gmap_is_shadow(gmap) && gmap->removed)
795796
return NULL;
796-
if (gaddr & (-1UL << (31 + ((gmap->asce & _ASCE_TYPE_MASK) >> 2)*11)))
797+
798+
if (asce_type != _ASCE_TYPE_REGION1 &&
799+
gaddr & (-1UL << (31 + (asce_type >> 2) * 11)))
797800
return NULL;
801+
798802
table = gmap->table;
799803
switch (gmap->asce & _ASCE_TYPE_MASK) {
800804
case _ASCE_TYPE_REGION1:
@@ -1840,6 +1844,7 @@ int gmap_shadow_r3t(struct gmap *sg, unsigned long saddr, unsigned long r3t,
18401844
goto out_free;
18411845
} else if (*table & _REGION_ENTRY_ORIGIN) {
18421846
rc = -EAGAIN; /* Race with shadow */
1847+
goto out_free;
18431848
}
18441849
crst_table_init(s_r3t, _REGION3_ENTRY_EMPTY);
18451850
/* mark as invalid as long as the parent table is not protected */

0 commit comments

Comments
 (0)