Skip to content

Commit dad1613

Browse files
Maxim Levitskysean-jc
authored andcommitted
KVM: SVM: fix emulation of msr reads/writes of MSR_FS_BASE and MSR_GS_BASE
If these msrs are read by the emulator (e.g due to 'force emulation' prefix), SVM code currently fails to extract the corresponding segment bases, and return them to the emulator. Fix that. Cc: stable@vger.kernel.org Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com> Link: https://lore.kernel.org/r/20240802151608.72896-3-mlevitsk@redhat.com Signed-off-by: Sean Christopherson <seanjc@google.com>
1 parent 4bcdd83 commit dad1613

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

arch/x86/kvm/svm/svm.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2876,6 +2876,12 @@ static int svm_get_msr(struct kvm_vcpu *vcpu, struct msr_data *msr_info)
28762876
case MSR_CSTAR:
28772877
msr_info->data = svm->vmcb01.ptr->save.cstar;
28782878
break;
2879+
case MSR_GS_BASE:
2880+
msr_info->data = svm->vmcb01.ptr->save.gs.base;
2881+
break;
2882+
case MSR_FS_BASE:
2883+
msr_info->data = svm->vmcb01.ptr->save.fs.base;
2884+
break;
28792885
case MSR_KERNEL_GS_BASE:
28802886
msr_info->data = svm->vmcb01.ptr->save.kernel_gs_base;
28812887
break;
@@ -3101,6 +3107,12 @@ static int svm_set_msr(struct kvm_vcpu *vcpu, struct msr_data *msr)
31013107
case MSR_CSTAR:
31023108
svm->vmcb01.ptr->save.cstar = data;
31033109
break;
3110+
case MSR_GS_BASE:
3111+
svm->vmcb01.ptr->save.gs.base = data;
3112+
break;
3113+
case MSR_FS_BASE:
3114+
svm->vmcb01.ptr->save.fs.base = data;
3115+
break;
31043116
case MSR_KERNEL_GS_BASE:
31053117
svm->vmcb01.ptr->save.kernel_gs_base = data;
31063118
break;

0 commit comments

Comments
 (0)