Skip to contentSkip to conversation

Patch "KVM: s390: sthyi: fix specification exception detection" has been added to the 4.12-stable tree

PATCH [email protected] 1 participant 1 message Aug 27, 2017

Subsystems (3)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

KVM: s390: sthyi: fix specification exception detection

to the 4.12-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
kvm-s390-sthyi-fix-specification-exception-detection.patch
and it can be found in the queue-4.12 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From 857b8de96795646c5891cf44ae6fb19b9ff74bf9 Mon Sep 17 00:00:00 2001

From: Heiko Carstens <[email protected]>
Date: Thu, 3 Aug 2017 14:27:30 +0200
Subject: KVM: s390: sthyi: fix specification exception detection

From: Heiko Carstens <[email protected]>

commit 857b8de96795646c5891cf44ae6fb19b9ff74bf9 upstream.

sthyi should only generate a specification exception if the function code is zero and the response buffer is not on a 4k boundary.

The current code would also test for unknown function codes if the response buffer, that is currently only defined for function code 0, is not on a 4k boundary and incorrectly inject a specification exception instead of returning with condition code 3 and return code 4 (unsupported function code).

Fix this by moving the boundary check.

---
 arch/s390/kvm/sthyi.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
arch/s390/kvm/sthyi.c +4 -1
@@ -425,7 +425,7 @@ int handle_sthyi(struct kvm_vcpu *vcpu)
 	VCPU_EVENT(vcpu, 3, "STHYI: fc: %llu addr: 0x%016llx", code, addr);
 	trace_kvm_s390_handle_sthyi(vcpu, code, addr);
 
-	if (reg1 == reg2 || reg1 & 1 || reg2 & 1 || addr & ~PAGE_MASK)
+	if (reg1 == reg2 || reg1 & 1 || reg2 & 1)
 		return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION);
 
 	if (code & 0xffff) {
@@ -433,6 +433,9 @@ int handle_sthyi(struct kvm_vcpu *vcpu)
 		goto out;
 	}
 
+	if (addr & ~PAGE_MASK)
+		return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION);
+
 	/*
 	 * If the page has not yet been faulted in, we want to do that
 	 * now and not after all the expensive calculations.

Patches currently in stable-queue which might be from [email protected] are

queue-4.12/kvm-s390-sthyi-fix-specification-exception-detection.patch queue-4.12/kvm-s390-sthyi-fix-sthyi-inline-assembly.patch