KVM: s390: Fix possible host kernel bug on lctl(g) handling

The lctl(g) instructions require a specific alignment for the parameters.
The architecture requires a specification program check if these alignments
are not used. Enforcing this alignment also removes a possible host BUG,
since the get_guest functions check for proper alignment and emits a BUG.

Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>

authored by

Christian Borntraeger and committed by
Avi Kivity
5a00a5e7 f5e10b09

+6
+6
arch/s390/kvm/intercept.c
··· 38 38 if (base2) 39 39 useraddr += vcpu->arch.guest_gprs[base2]; 40 40 41 + if (useraddr & 7) 42 + return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION); 43 + 41 44 reg = reg1; 42 45 43 46 VCPU_EVENT(vcpu, 5, "lctlg r1:%x, r3:%x,b2:%x,d2:%x", reg1, reg3, base2, ··· 76 73 useraddr = disp2; 77 74 if (base2) 78 75 useraddr += vcpu->arch.guest_gprs[base2]; 76 + 77 + if (useraddr & 3) 78 + return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION); 79 79 80 80 VCPU_EVENT(vcpu, 5, "lctl r1:%x, r3:%x,b2:%x,d2:%x", reg1, reg3, base2, 81 81 disp2);