Commit 387cb8e8 authored by Paolo Bonzini's avatar Paolo Bonzini

Merge tag 'kvm-s390-next-5.13-2' of...

Merge tag 'kvm-s390-next-5.13-2' of git://git.kernel.org/pub/scm/linux/kernel/git/kvms390/linux into HEAD

KVM: s390: Fix potential crash in preemptible kernels

There is a potential race for preemptible kernels, where
the host kernel would get a fault when it is preempted as
the wrong point in time.
parents 6c377b02 44bada28
...@@ -4313,16 +4313,16 @@ static void store_regs_fmt2(struct kvm_vcpu *vcpu) ...@@ -4313,16 +4313,16 @@ static void store_regs_fmt2(struct kvm_vcpu *vcpu)
kvm_run->s.regs.bpbc = (vcpu->arch.sie_block->fpf & FPF_BPBC) == FPF_BPBC; kvm_run->s.regs.bpbc = (vcpu->arch.sie_block->fpf & FPF_BPBC) == FPF_BPBC;
kvm_run->s.regs.diag318 = vcpu->arch.diag318_info.val; kvm_run->s.regs.diag318 = vcpu->arch.diag318_info.val;
if (MACHINE_HAS_GS) { if (MACHINE_HAS_GS) {
preempt_disable();
__ctl_set_bit(2, 4); __ctl_set_bit(2, 4);
if (vcpu->arch.gs_enabled) if (vcpu->arch.gs_enabled)
save_gs_cb(current->thread.gs_cb); save_gs_cb(current->thread.gs_cb);
preempt_disable();
current->thread.gs_cb = vcpu->arch.host_gscb; current->thread.gs_cb = vcpu->arch.host_gscb;
restore_gs_cb(vcpu->arch.host_gscb); restore_gs_cb(vcpu->arch.host_gscb);
preempt_enable();
if (!vcpu->arch.host_gscb) if (!vcpu->arch.host_gscb)
__ctl_clear_bit(2, 4); __ctl_clear_bit(2, 4);
vcpu->arch.host_gscb = NULL; vcpu->arch.host_gscb = NULL;
preempt_enable();
} }
/* SIE will save etoken directly into SDNX and therefore kvm_run */ /* SIE will save etoken directly into SDNX and therefore kvm_run */
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment