lkml.org 
[lkml]   [2020]   [Mar]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: slab-out-of-bounds due to "KVM: Dynamically size memslot array based on number of used slots"
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

\
 
 \ /
  Last update: 2020-03-20 17:09    [W:0.052 / U:1.368 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site