lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Mon, 20 Mar 2017 15:05:47 +0800
From:   Zhenyu Wang <zhenyuw@...ux.intel.com>
To:     Jike Song <jike.song@...el.com>
Cc:     Alex Williamson <alex.williamson@...hat.com>,
        intel-gvt-dev@...ts.freedesktop.org, kvm@...r.kernel.org,
        linux-kernel@...r.kernel.org, stable@...r.kernel.org#v4.10,
        Paolo Bonzini <pbonzini@...hat.com>,
        Zhi Wang <zhi.a.wang@...el.com>
Subject: Re: [PATCH] kvmgt: Hold struct kvm reference

On 2017.03.20 14:58:06 +0800, Jike Song wrote:
> On 03/20/2017 10:38 AM, Alex Williamson wrote:
> > The kvmgt code keeps a pointer to the struct kvm associated with the
> > device, but doesn't actually hold a reference to it.  If we do unclean
> > shutdown testing (ie. killing the user process), then we can see the
> > kvm association to the device unset, which causes kvmgt to trigger a
> > device release via a work queue.  Naturally we cannot guarantee that
> > the cached struct kvm pointer is still valid at this point without
> > holding a reference.  The observed failure in this case is a stuck
> > cpu trying to acquire the spinlock from the invalid reference, but
> > other failure modes are clearly possible.  Hold a reference to avoid
> > this.
> > 
> > Signed-off-by: Alex Williamson <alex.williamson@...hat.com>
> > Cc: stable@...r.kernel.org #v4.10
> > Cc: Jike Song <jike.song@...el.com>
> > Cc: Paolo Bonzini <pbonzini@...hat.com>
> > Cc: Zhenyu Wang <zhenyuw@...ux.intel.com>
> > Cc: Zhi Wang <zhi.a.wang@...el.com>
> > ---
> 
> Reviewed-by: Jike Song <jike.song@...el.com>
> 
> Thanks for the fix!
> 

queued in fixes tree, thanks!

> 
> >  drivers/gpu/drm/i915/gvt/kvmgt.c |    2 ++
> >  1 file changed, 2 insertions(+)
> > 
> > diff --git a/drivers/gpu/drm/i915/gvt/kvmgt.c b/drivers/gpu/drm/i915/gvt/kvmgt.c
> > index 84d801638ede..142b8bd4ba6b 100644
> > --- a/drivers/gpu/drm/i915/gvt/kvmgt.c
> > +++ b/drivers/gpu/drm/i915/gvt/kvmgt.c
> > @@ -1324,6 +1324,7 @@ static int kvmgt_guest_init(struct mdev_device *mdev)
> >  	vgpu->handle = (unsigned long)info;
> >  	info->vgpu = vgpu;
> >  	info->kvm = kvm;
> > +	kvm_get_kvm(info->kvm);
> >  
> >  	kvmgt_protect_table_init(info);
> >  	gvt_cache_init(vgpu);
> > @@ -1343,6 +1344,7 @@ static bool kvmgt_guest_exit(struct kvmgt_guest_info *info)
> >  	}
> >  
> >  	kvm_page_track_unregister_notifier(info->kvm, &info->track_node);
> > +	kvm_put_kvm(info->kvm);
> >  	kvmgt_protect_table_destroy(info);
> >  	gvt_cache_destroy(info->vgpu);
> >  	vfree(info);
> > 

-- 
Open Source Technology Center, Intel ltd.

$gpg --keyserver wwwkeys.pgp.net --recv-keys 4D781827

Download attachment "signature.asc" of type "application/pgp-signature" (164 bytes)

Powered by blists - more mailing lists