Skip to content

Commit 1ea1d6a

Browse files
borntraegerhcahca
authored andcommitted
s390/nmi: handle guarded storage validity failures for KVM guests
machine check validity bits reflect the state of the machine check. If a guest does not make use of guarded storage, the validity bit might be off. We can not use the host CR bit to decide if the validity bit must be on. So ignore "invalid" guarded storage controls for KVM guests in the host and rely on the machine check being forwarded to the guest. If no other errors happen from a host perspective everything is fine and no process must be killed and the host can continue to run. Cc: [email protected] Fixes: c929500 ("s390/nmi: s390: New low level handling for machine check happening in guest") Reported-by: Carsten Otte <[email protected]> Signed-off-by: Christian Borntraeger <[email protected]> Tested-by: Carsten Otte <[email protected]> Reviewed-by: Heiko Carstens <[email protected]> Signed-off-by: Heiko Carstens <[email protected]>
1 parent e783362 commit 1ea1d6a

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

arch/s390/kernel/nmi.c

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -307,11 +307,21 @@ static int notrace s390_validate_registers(union mci mci, int umode)
307307
if (cr2.gse) {
308308
if (!mci.gs) {
309309
/*
310-
* Guarded storage register can't be restored and
311-
* the current processes uses guarded storage.
312-
* It has to be terminated.
310+
* 2 cases:
311+
* - machine check in kernel or userspace
312+
* - machine check while running SIE (KVM guest)
313+
* For kernel or userspace the userspace values of
314+
* guarded storage control can not be recreated, the
315+
* process must be terminated.
316+
* For SIE the guest values of guarded storage can not
317+
* be recreated. This is either due to a bug or due to
318+
* GS being disabled in the guest. The guest will be
319+
* notified by KVM code and the guests machine check
320+
* handling must take care of this. The host values
321+
* are saved by KVM and are not affected.
313322
*/
314-
kill_task = 1;
323+
if (!test_cpu_flag(CIF_MCCK_GUEST))
324+
kill_task = 1;
315325
} else {
316326
load_gs_cb((struct gs_cb *)mcesa->guarded_storage_save_area);
317327
}

0 commit comments

Comments
 (0)