Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

KVM: s390: vsie: Check alignment of BSCA header

The VSIE code currently checks that the BSCA struct fits within
a page, and returns a validity exception 0x003b if it doesn't.
The BSCA is pinned in memory rather than shadowed (see block
comment at end of kvm_s390_cpu_feat_init()), so enforcing the
CPU entries to be on the same pinned page makes sense.

Except those entries aren't going to be used below the guest,
and according to the definition of that validity exception only
the header of the BSCA (everything but the CPU entries) needs to
be within a page. Adjust the alignment check to account for that.

Signed-off-by: Eric Farman <farman@linux.ibm.com>
Reviewed-by: Christian Borntraeger <borntraeger@linux.ibm.com>
Reviewed-by: Christoph Schlameuss <schlameuss@linux.ibm.com>
Signed-off-by: Janosch Frank <frankja@linux.ibm.com>

authored by

Eric Farman and committed by
Janosch Frank
44acac00 8e8678e7

+1 -1
+1 -1
arch/s390/kvm/vsie.c
··· 782 782 else if ((gpa & ~0x1fffUL) == kvm_s390_get_prefix(vcpu)) 783 783 rc = set_validity_icpt(scb_s, 0x0011U); 784 784 else if ((gpa & PAGE_MASK) != 785 - ((gpa + sizeof(struct bsca_block) - 1) & PAGE_MASK)) 785 + ((gpa + offsetof(struct bsca_block, cpu[0]) - 1) & PAGE_MASK)) 786 786 rc = set_validity_icpt(scb_s, 0x003bU); 787 787 if (!rc) { 788 788 rc = pin_guest_page(vcpu->kvm, gpa, &hpa);