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]
Message-ID: <BN9PR11MB5276546B8657FB468F5BA33F8CDC2@BN9PR11MB5276.namprd11.prod.outlook.com>
Date: Tue, 2 Jul 2024 00:17:02 +0000
From: "Tian, Kevin" <kevin.tian@...el.com>
To: "Zhao, Yan Y" <yan.y.zhao@...el.com>, "Liu, Yi L" <yi.l.liu@...el.com>
CC: "kvm@...r.kernel.org" <kvm@...r.kernel.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	"alex.williamson@...hat.com" <alex.williamson@...hat.com>, "jgg@...dia.com"
	<jgg@...dia.com>
Subject: RE: [PATCH] vfio: Get/put KVM only for the first/last
 vfio_df_open/close in cdev path

> From: Zhao, Yan Y <yan.y.zhao@...el.com>
> Sent: Monday, July 1, 2024 8:02 PM
> 
> On Mon, Jul 01, 2024 at 06:30:05PM +0800, Yi Liu wrote:
> > On 2024/7/1 16:43, Tian, Kevin wrote:
> > >
> > > what about extending vfio_df_open() to unify the get/put_kvm()
> > > and open_count trick in one place?
> > >
> > > int vfio_df_open(struct vfio_device_file *df, struct kvm *kvm,
> > > 	spinlock_t *kvm_ref_lock)
> > > {
> >
> > this should work. But need a comment to note why need pass in both kvm
> > and kvm_ref_lock given df has both of them. :)
> So why to pass them?

hmm actually passing them is wrong especially for the group path.
We have to get kvm upon the first reference to the pointer otherwise
it is prone to use-after-free issue.

> 
> What about making vfio_device_group_get_kvm_safe() or
> vfio_df_get_kvm_safe()
> not static and calling one of them in vfio_df_open() according to the df-
> >group
> ?
> 

yeah, this sounds better.


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ