* [PATCH] KVM/nSVM: properly map nested VMCB
@ 2019-06-04 16:09 Vitaly Kuznetsov
2019-06-04 16:48 ` Sean Christopherson
2019-06-04 17:27 ` Paolo Bonzini
0 siblings, 2 replies; 7+ messages in thread
From: Vitaly Kuznetsov @ 2019-06-04 16:09 UTC (permalink / raw)
To: kvm
Cc: linux-kernel, Paolo Bonzini, Radim Krčmář,
Joerg Roedel, KarimAllah Ahmed
Commit 8c5fbf1a7231 ("KVM/nSVM: Use the new mapping API for mapping guest
memory") broke nested SVM completely: kvm_vcpu_map()'s second parameter is
GFN so vmcb_gpa needs to be converted with gpa_to_gfn(), not the other way
around.
Fixes: 8c5fbf1a7231 ("KVM/nSVM: Use the new mapping API for mapping guest memory")
Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
---
arch/x86/kvm/svm.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
index 735b8c01895e..5beca1030c9a 100644
--- a/arch/x86/kvm/svm.c
+++ b/arch/x86/kvm/svm.c
@@ -3293,7 +3293,7 @@ static int nested_svm_vmexit(struct vcpu_svm *svm)
vmcb->control.exit_int_info_err,
KVM_ISA_SVM);
- rc = kvm_vcpu_map(&svm->vcpu, gfn_to_gpa(svm->nested.vmcb), &map);
+ rc = kvm_vcpu_map(&svm->vcpu, gpa_to_gfn(svm->nested.vmcb), &map);
if (rc) {
if (rc == -EINVAL)
kvm_inject_gp(&svm->vcpu, 0);
@@ -3583,7 +3583,7 @@ static bool nested_svm_vmrun(struct vcpu_svm *svm)
vmcb_gpa = svm->vmcb->save.rax;
- rc = kvm_vcpu_map(&svm->vcpu, gfn_to_gpa(vmcb_gpa), &map);
+ rc = kvm_vcpu_map(&svm->vcpu, gpa_to_gfn(vmcb_gpa), &map);
if (rc) {
if (rc == -EINVAL)
kvm_inject_gp(&svm->vcpu, 0);
--
2.20.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] KVM/nSVM: properly map nested VMCB
2019-06-04 16:09 [PATCH] KVM/nSVM: properly map nested VMCB Vitaly Kuznetsov
@ 2019-06-04 16:48 ` Sean Christopherson
2019-06-04 17:27 ` Paolo Bonzini
1 sibling, 0 replies; 7+ messages in thread
From: Sean Christopherson @ 2019-06-04 16:48 UTC (permalink / raw)
To: Vitaly Kuznetsov
Cc: kvm, linux-kernel, Paolo Bonzini, Radim Krčmář,
Joerg Roedel, KarimAllah Ahmed
On Tue, Jun 04, 2019 at 06:09:39PM +0200, Vitaly Kuznetsov wrote:
> Commit 8c5fbf1a7231 ("KVM/nSVM: Use the new mapping API for mapping guest
> memory") broke nested SVM completely: kvm_vcpu_map()'s second parameter is
> GFN so vmcb_gpa needs to be converted with gpa_to_gfn(), not the other way
> around.
>
> Fixes: 8c5fbf1a7231 ("KVM/nSVM: Use the new mapping API for mapping guest memory")
> Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Reviewed-by: Sean Christopherson <sean.j.christopherson@intel.com>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] KVM/nSVM: properly map nested VMCB
2019-06-04 16:09 [PATCH] KVM/nSVM: properly map nested VMCB Vitaly Kuznetsov
2019-06-04 16:48 ` Sean Christopherson
@ 2019-06-04 17:27 ` Paolo Bonzini
2019-08-10 18:35 ` Jiri Palecek
1 sibling, 1 reply; 7+ messages in thread
From: Paolo Bonzini @ 2019-06-04 17:27 UTC (permalink / raw)
To: Vitaly Kuznetsov, kvm
Cc: linux-kernel, Radim Krčmář,
Joerg Roedel, KarimAllah Ahmed
On 04/06/19 18:09, Vitaly Kuznetsov wrote:
> Commit 8c5fbf1a7231 ("KVM/nSVM: Use the new mapping API for mapping guest
> memory") broke nested SVM completely: kvm_vcpu_map()'s second parameter is
> GFN so vmcb_gpa needs to be converted with gpa_to_gfn(), not the other way
> around.
>
> Fixes: 8c5fbf1a7231 ("KVM/nSVM: Use the new mapping API for mapping guest memory")
> Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
> ---
> arch/x86/kvm/svm.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
> index 735b8c01895e..5beca1030c9a 100644
> --- a/arch/x86/kvm/svm.c
> +++ b/arch/x86/kvm/svm.c
> @@ -3293,7 +3293,7 @@ static int nested_svm_vmexit(struct vcpu_svm *svm)
> vmcb->control.exit_int_info_err,
> KVM_ISA_SVM);
>
> - rc = kvm_vcpu_map(&svm->vcpu, gfn_to_gpa(svm->nested.vmcb), &map);
> + rc = kvm_vcpu_map(&svm->vcpu, gpa_to_gfn(svm->nested.vmcb), &map);
> if (rc) {
> if (rc == -EINVAL)
> kvm_inject_gp(&svm->vcpu, 0);
> @@ -3583,7 +3583,7 @@ static bool nested_svm_vmrun(struct vcpu_svm *svm)
>
> vmcb_gpa = svm->vmcb->save.rax;
>
> - rc = kvm_vcpu_map(&svm->vcpu, gfn_to_gpa(vmcb_gpa), &map);
> + rc = kvm_vcpu_map(&svm->vcpu, gpa_to_gfn(vmcb_gpa), &map);
> if (rc) {
> if (rc == -EINVAL)
> kvm_inject_gp(&svm->vcpu, 0);
>
Oops. Queued, thanks.
Paolo
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Re: [PATCH] KVM/nSVM: properly map nested VMCB
2019-06-04 17:27 ` Paolo Bonzini
@ 2019-08-10 18:35 ` Jiri Palecek
2019-08-14 12:43 ` Paolo Bonzini
0 siblings, 1 reply; 7+ messages in thread
From: Jiri Palecek @ 2019-08-10 18:35 UTC (permalink / raw)
To: Paolo Bonzini, Vitaly Kuznetsov, kvm
Cc: linux-kernel, Radim Krčmář,
Joerg Roedel, KarimAllah Ahmed
Hello,
On 04. 06. 19 19:27, Paolo Bonzini wrote:
> On 04/06/19 18:09, Vitaly Kuznetsov wrote:
>> Commit 8c5fbf1a7231 ("KVM/nSVM: Use the new mapping API for mapping guest
>> memory") broke nested SVM completely: kvm_vcpu_map()'s second parameter is
>> GFN so vmcb_gpa needs to be converted with gpa_to_gfn(), not the other way
>> around.
>>
>> Fixes: 8c5fbf1a7231 ("KVM/nSVM: Use the new mapping API for mapping guest memory")
>> Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
>> ---
>> arch/x86/kvm/svm.c | 4 ++--
>> 1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
>> index 735b8c01895e..5beca1030c9a 100644
>> --- a/arch/x86/kvm/svm.c
>> +++ b/arch/x86/kvm/svm.c
>> @@ -3293,7 +3293,7 @@ static int nested_svm_vmexit(struct vcpu_svm *svm)
>> vmcb->control.exit_int_info_err,
>> KVM_ISA_SVM);
>>
>> - rc = kvm_vcpu_map(&svm->vcpu, gfn_to_gpa(svm->nested.vmcb), &map);
>> + rc = kvm_vcpu_map(&svm->vcpu, gpa_to_gfn(svm->nested.vmcb), &map);
>> if (rc) {
>> if (rc == -EINVAL)
>> kvm_inject_gp(&svm->vcpu, 0);
>> @@ -3583,7 +3583,7 @@ static bool nested_svm_vmrun(struct vcpu_svm *svm)
>>
>> vmcb_gpa = svm->vmcb->save.rax;
>>
>> - rc = kvm_vcpu_map(&svm->vcpu, gfn_to_gpa(vmcb_gpa), &map);
>> + rc = kvm_vcpu_map(&svm->vcpu, gpa_to_gfn(vmcb_gpa), &map);
>> if (rc) {
>> if (rc == -EINVAL)
>> kvm_inject_gp(&svm->vcpu, 0);
>>
> Oops. Queued, thanks.
Given that this fix didn't make it to 5.2, and its straightforwardness,
could you send it to stable for inclusion?
Regards
Jiri Palecek
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] KVM/nSVM: properly map nested VMCB
2019-08-10 18:35 ` Jiri Palecek
@ 2019-08-14 12:43 ` Paolo Bonzini
0 siblings, 0 replies; 7+ messages in thread
From: Paolo Bonzini @ 2019-08-14 12:43 UTC (permalink / raw)
To: Jiri Palecek, Vitaly Kuznetsov, kvm
Cc: linux-kernel, Radim Krčmář,
Joerg Roedel, KarimAllah Ahmed
On 10/08/19 20:35, Jiri Palecek wrote:
> Hello,
>
> On 04. 06. 19 19:27, Paolo Bonzini wrote:
>> On 04/06/19 18:09, Vitaly Kuznetsov wrote:
>>> Commit 8c5fbf1a7231 ("KVM/nSVM: Use the new mapping API for mapping
>>> guest
>>> memory") broke nested SVM completely: kvm_vcpu_map()'s second
>>> parameter is
>>> GFN so vmcb_gpa needs to be converted with gpa_to_gfn(), not the
>>> other way
>>> around.
>>>
>>> Fixes: 8c5fbf1a7231 ("KVM/nSVM: Use the new mapping API for mapping
>>> guest memory")
>>> Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
>>> ---
>>> arch/x86/kvm/svm.c | 4 ++--
>>> 1 file changed, 2 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
>>> index 735b8c01895e..5beca1030c9a 100644
>>> --- a/arch/x86/kvm/svm.c
>>> +++ b/arch/x86/kvm/svm.c
>>> @@ -3293,7 +3293,7 @@ static int nested_svm_vmexit(struct vcpu_svm *svm)
>>> vmcb->control.exit_int_info_err,
>>> KVM_ISA_SVM);
>>>
>>> - rc = kvm_vcpu_map(&svm->vcpu, gfn_to_gpa(svm->nested.vmcb), &map);
>>> + rc = kvm_vcpu_map(&svm->vcpu, gpa_to_gfn(svm->nested.vmcb), &map);
>>> if (rc) {
>>> if (rc == -EINVAL)
>>> kvm_inject_gp(&svm->vcpu, 0);
>>> @@ -3583,7 +3583,7 @@ static bool nested_svm_vmrun(struct vcpu_svm *svm)
>>>
>>> vmcb_gpa = svm->vmcb->save.rax;
>>>
>>> - rc = kvm_vcpu_map(&svm->vcpu, gfn_to_gpa(vmcb_gpa), &map);
>>> + rc = kvm_vcpu_map(&svm->vcpu, gpa_to_gfn(vmcb_gpa), &map);
>>> if (rc) {
>>> if (rc == -EINVAL)
>>> kvm_inject_gp(&svm->vcpu, 0);
>>>
>> Oops. Queued, thanks.
>
> Given that this fix didn't make it to 5.2, and its straightforwardness,
> could you send it to stable for inclusion?
Done, thanks for the reminder!
Paolo
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] KVM/nSVM: properly map nested VMCB
2019-08-14 12:47 Paolo Bonzini
@ 2019-08-14 14:49 ` Greg KH
0 siblings, 0 replies; 7+ messages in thread
From: Greg KH @ 2019-08-14 14:49 UTC (permalink / raw)
To: Paolo Bonzini; +Cc: stable, Vitaly Kuznetsov
On Wed, Aug 14, 2019 at 02:47:35PM +0200, Paolo Bonzini wrote:
> From: Vitaly Kuznetsov <vkuznets@redhat.com>
>
> [ upstream commit 8f38302c0be2d2daf3b40f7d2142ec77e35d209e ]
>
> Commit 8c5fbf1a7231 ("KVM/nSVM: Use the new mapping API for mapping guest
> memory") broke nested SVM completely: kvm_vcpu_map()'s second parameter is
> GFN so vmcb_gpa needs to be converted with gpa_to_gfn(), not the other way
> around.
>
> Fixes: 8c5fbf1a7231 ("KVM/nSVM: Use the new mapping API for mapping guest memory")
> Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
> Reviewed-by: Sean Christopherson <sean.j.christopherson@intel.com>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
> arch/x86/kvm/svm.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
Now queued up, thanks.
greg k-h
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH] KVM/nSVM: properly map nested VMCB
@ 2019-08-14 12:47 Paolo Bonzini
2019-08-14 14:49 ` Greg KH
0 siblings, 1 reply; 7+ messages in thread
From: Paolo Bonzini @ 2019-08-14 12:47 UTC (permalink / raw)
To: stable; +Cc: Vitaly Kuznetsov
From: Vitaly Kuznetsov <vkuznets@redhat.com>
[ upstream commit 8f38302c0be2d2daf3b40f7d2142ec77e35d209e ]
Commit 8c5fbf1a7231 ("KVM/nSVM: Use the new mapping API for mapping guest
memory") broke nested SVM completely: kvm_vcpu_map()'s second parameter is
GFN so vmcb_gpa needs to be converted with gpa_to_gfn(), not the other way
around.
Fixes: 8c5fbf1a7231 ("KVM/nSVM: Use the new mapping API for mapping guest memory")
Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Reviewed-by: Sean Christopherson <sean.j.christopherson@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
arch/x86/kvm/svm.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
index 735b8c01895e..5beca1030c9a 100644
--- a/arch/x86/kvm/svm.c
+++ b/arch/x86/kvm/svm.c
@@ -3293,7 +3293,7 @@ static int nested_svm_vmexit(struct vcpu_svm *svm)
vmcb->control.exit_int_info_err,
KVM_ISA_SVM);
- rc = kvm_vcpu_map(&svm->vcpu, gfn_to_gpa(svm->nested.vmcb), &map);
+ rc = kvm_vcpu_map(&svm->vcpu, gpa_to_gfn(svm->nested.vmcb), &map);
if (rc) {
if (rc == -EINVAL)
kvm_inject_gp(&svm->vcpu, 0);
@@ -3583,7 +3583,7 @@ static bool nested_svm_vmrun(struct vcpu_svm *svm)
vmcb_gpa = svm->vmcb->save.rax;
- rc = kvm_vcpu_map(&svm->vcpu, gfn_to_gpa(vmcb_gpa), &map);
+ rc = kvm_vcpu_map(&svm->vcpu, gpa_to_gfn(vmcb_gpa), &map);
if (rc) {
if (rc == -EINVAL)
kvm_inject_gp(&svm->vcpu, 0);
--
1.8.3.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
end of thread, other threads:[~2019-08-14 14:49 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-04 16:09 [PATCH] KVM/nSVM: properly map nested VMCB Vitaly Kuznetsov
2019-06-04 16:48 ` Sean Christopherson
2019-06-04 17:27 ` Paolo Bonzini
2019-08-10 18:35 ` Jiri Palecek
2019-08-14 12:43 ` Paolo Bonzini
2019-08-14 12:47 Paolo Bonzini
2019-08-14 14:49 ` Greg KH
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.