public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Sean Christopherson <seanjc@google.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: Babu Moger <babu.moger@amd.com>,
	kvm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] KVM: Fix Undefined Behavior Sanitizer(UBSAN) error
Date: Mon, 3 Jun 2024 13:38:31 -0700	[thread overview]
Message-ID: <Zl4px2yauHdvDUbR@google.com> (raw)
In-Reply-To: <CABgObfY5athiQKdV8LQt3b=yKEgydOXRdfXeLz1C8Ho=ZrqOaQ@mail.gmail.com>

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>

  reply	other threads:[~2024-06-03 20:38 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 [this message]
2024-06-06 14:50       ` Moger, Babu
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=Zl4px2yauHdvDUbR@google.com \
    --to=seanjc@google.com \
    --cc=babu.moger@amd.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pbonzini@redhat.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