Skip to content

Commit f094a39

Browse files
borntraegerhcahca
authored andcommitted
s390/nmi: handle vector validity failures for KVM guests
The machine check validity bit tells about the context. If a KVM guest was running the bit tells about the guest validity and the host state is not affected. As a guest can disable the guest validity this might result in unwanted host errors on machine checks. Cc: [email protected] Fixes: c929500 ("s390/nmi: s390: New low level handling for machine check happening in guest") Signed-off-by: Christian Borntraeger <[email protected]> Reviewed-by: Heiko Carstens <[email protected]> Signed-off-by: Heiko Carstens <[email protected]>
1 parent 1ea1d6a commit f094a39

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

arch/s390/kernel/nmi.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,14 @@ static int notrace s390_validate_registers(union mci mci, int umode)
264264
/* Validate vector registers */
265265
union ctlreg0 cr0;
266266

267-
if (!mci.vr) {
267+
/*
268+
* The vector validity must only be checked if not running a
269+
* KVM guest. For KVM guests the machine check is forwarded by
270+
* KVM and it is the responsibility of the guest to take
271+
* appropriate actions. The host vector or FPU values have been
272+
* saved by KVM and will be restored by KVM.
273+
*/
274+
if (!mci.vr && !test_cpu_flag(CIF_MCCK_GUEST)) {
268275
/*
269276
* Vector registers can't be restored. If the kernel
270277
* currently uses vector registers the system is

0 commit comments

Comments
 (0)