Skip to content

Commit

Permalink
KVM: s390: Fix possible host kernel bug on lctl(g) handling
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Christian Borntraeger authored and Avi Kivity committed Jul 27, 2008
1 parent f5e10b0 commit 5a00a5e
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions arch/s390/kvm/intercept.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ static int handle_lctlg(struct kvm_vcpu *vcpu)
if (base2)
useraddr += vcpu->arch.guest_gprs[base2];

if (useraddr & 7)
return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION);

reg = reg1;

VCPU_EVENT(vcpu, 5, "lctlg r1:%x, r3:%x,b2:%x,d2:%x", reg1, reg3, base2,
Expand Down Expand Up @@ -74,6 +77,9 @@ static int handle_lctl(struct kvm_vcpu *vcpu)
if (base2)
useraddr += vcpu->arch.guest_gprs[base2];

if (useraddr & 3)
return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION);

VCPU_EVENT(vcpu, 5, "lctl r1:%x, r3:%x,b2:%x,d2:%x", reg1, reg3, base2,
disp2);

Expand Down

0 comments on commit 5a00a5e

Please sign in to comment.