Kernel KVM virtualization development
 help / color / mirror / Atom feed
From: Peter Xu <peterx@redhat.com>
To: Sean Christopherson <sean.j.christopherson@intel.com>
Cc: Qian Cai <cai@lca.pw>, Paolo Bonzini <pbonzini@redhat.com>,
	kvm@vger.kernel.org, LKML <linux-kernel@vger.kernel.org>,
	Marc Zyngier <maz@kernel.org>,
	Christoffer Dall <christoffer.dall@arm.com>
Subject: Re: slab-out-of-bounds due to "KVM: Dynamically size memslot array based on number of used slots"
Date: Fri, 20 Mar 2020 12:08:42 -0400	[thread overview]
Message-ID: <20200320160842.GE127076@xz-x1> (raw)
In-Reply-To: <20200320135346.GA16533@linux.intel.com>

On Fri, Mar 20, 2020 at 06:53:46AM -0700, Sean Christopherson wrote:
> On Fri, Mar 20, 2020 at 09:49:03AM -0400, Qian Cai wrote:
> > 
> > 
> > > On Mar 20, 2020, at 12:34 AM, Sean Christopherson <sean.j.christopherson@intel.com> wrote:
> > > 
> > > On Thu, Mar 19, 2020 at 11:59:23PM -0400, Qian Cai wrote:
> > >> Reverted the linux-next commit 36947254e5f98 (“KVM: Dynamically size memslot array based on number of used slots”)
> > >> fixed illegal slab object redzone accesses.
> > >> 
> > >> [6727.939776][ T1818] BUG: KASAN: slab-out-of-bounds in gfn_to_hva+0xc1/0x2b0 [kvm]
> > >> search_memslots at include/linux/kvm_host.h:1035
> > > 
> > > Drat.  I'm guessing lru_slot is out of range after a memslot is deleted.
> > > This should fix the issue, though it may not be the most proper fix, e.g.
> > > it might be better to reset lru_slot when deleting a memslot.  I'll try and
> > > reproduce tomorrow, unless you can confirm this does the trick.
> > 
> > It works fine.
> 
> Thanks!  I'll send a proper patch in a bit, tweaking a selftest to try and
> hit this as well.

Would resetting lru_slot be better?  So to avoid other potential
references to an obsolete lru_slot outside search_memslots().  E.g., I
see that s390 has another function (gfn_to_memslot_approx) used it.

Thanks,

-- 
Peter Xu


      reply	other threads:[~2020-03-20 16:08 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-20  3:59 slab-out-of-bounds due to "KVM: Dynamically size memslot array based on number of used slots" Qian Cai
2020-03-20  4:34 ` Sean Christopherson
2020-03-20 13:49   ` Qian Cai
2020-03-20 13:53     ` Sean Christopherson
2020-03-20 16:08       ` Peter Xu [this message]

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=20200320160842.GE127076@xz-x1 \
    --to=peterx@redhat.com \
    --cc=cai@lca.pw \
    --cc=christoffer.dall@arm.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maz@kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=sean.j.christopherson@intel.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