public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: "Moger, Babu" <babu.moger@amd.com>
To: Sean Christopherson <seanjc@google.com>,
	Paolo Bonzini <pbonzini@redhat.com>
Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] KVM: Fix Undefined Behavior Sanitizer(UBSAN) error
Date: Thu, 6 Jun 2024 09:50:57 -0500	[thread overview]
Message-ID: <a66d481c-6d09-40f9-944e-148aed9eede1@amd.com> (raw)
In-Reply-To: <Zl4px2yauHdvDUbR@google.com>



On 6/3/24 15:38, Sean Christopherson wrote:
> On Mon, Jun 03, 2024, Paolo Bonzini wrote:
>> On Mon, Jun 3, 2024 at 7:54 PM Sean Christopherson <seanjc@google.com> wrote:
>>>> However, VM boots up fine without any issues and operational.
>>
>> Yes, the caller uses kvm_handle_hva_range() as if it returned void.
>>
>>> Ah, the "break" will only break out of the memslot loop, it won't break out of
>>> the address space loop.  Stupid SMM.
>>>
>>> diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
>>> index b312d0cbe60b..70f5a39f8302 100644
>>> --- a/virt/kvm/kvm_main.c
>>> +++ b/virt/kvm/kvm_main.c
>>> @@ -651,7 +651,7 @@ static __always_inline kvm_mn_ret_t __kvm_handle_hva_range(struct kvm *kvm,
>>>                                         range->on_lock(kvm);
>>>
>>>                                 if (IS_KVM_NULL_FN(range->handler))
>>> -                                       break;
>>> +                                       goto mmu_unlock;
>>>                         }
>>>                         r.ret |= range->handler(kvm, &gfn_range);
>>>                 }
>>> @@ -660,6 +660,7 @@ static __always_inline kvm_mn_ret_t __kvm_handle_hva_range(struct kvm *kvm,
>>>         if (range->flush_on_ret && r.ret)
>>>                 kvm_flush_remote_tlbs(kvm);
>>>
>>> +mmu_unlock:
>>>         if (r.found_memslot)
>>>                 KVM_MMU_UNLOCK(kvm);
>>
>> Yep. If you want to just reply with Signed-off-by I'll mix the
>> original commit message and your patch.
> 
> Signed-off-by: Sean Christopherson <seanjc@google.com>

Thanks Sean, Paolo.

I will send v2 with Sean's patch.
-- 
Thanks
Babu Moger

  reply	other threads:[~2024-06-06 14:51 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-03 17:44 [PATCH] KVM: Fix Undefined Behavior Sanitizer(UBSAN) error Babu Moger
2024-06-03 17:54 ` Sean Christopherson
2024-06-03 17:56   ` Paolo Bonzini
2024-06-03 20:38     ` Sean Christopherson
2024-06-06 14:50       ` Moger, Babu [this message]
2024-06-12 14:41 ` [PATCH v2] " Babu Moger
2024-06-18 21:41   ` Sean Christopherson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a66d481c-6d09-40f9-944e-148aed9eede1@amd.com \
    --to=babu.moger@amd.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=seanjc@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox