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] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 10 Aug 2021 09:04:02 -0600
From:   Alex Williamson <alex.williamson@...hat.com>
To:     Christoph Hellwig <hch@...radead.org>
Cc:     Jason Gunthorpe <jgg@...dia.com>, linux-kernel@...r.kernel.org,
        kvm@...r.kernel.org, peterx@...hat.com
Subject: Re: [PATCH 7/7] vfio/pci: Remove map-on-fault behavior

On Tue, 10 Aug 2021 11:11:49 +0200
Christoph Hellwig <hch@...radead.org> wrote:

> On Thu, Aug 05, 2021 at 11:08:21AM -0600, Alex Williamson wrote:
> > +void vfio_pci_test_and_up_write_memory_lock(struct vfio_pci_device *vdev)
> > +{
> > +	if (vdev->zapped_bars && __vfio_pci_memory_enabled(vdev)) {
> > +		WARN_ON(vfio_device_io_remap_mapping_range(&vdev->vdev,
> > +			VFIO_PCI_INDEX_TO_OFFSET(VFIO_PCI_BAR0_REGION_INDEX),
> > +			VFIO_PCI_INDEX_TO_OFFSET(VFIO_PCI_ROM_REGION_INDEX) -
> > +			VFIO_PCI_INDEX_TO_OFFSET(VFIO_PCI_BAR0_REGION_INDEX)));
> > +		vdev->zapped_bars = false;  
> 
> Doing actual work inside a WARN_ON is pretty nasty.  Also the non-ONCE
> version here will lead to massive log splatter if it actually hits.
> 
> I'd prefer something like:
> 
> 	loff_t start = VFIO_PCI_INDEX_TO_OFFSET(VFIO_PCI_BAR0_REGION_INDEX);
> 	loff_t end = VFIO_PCI_INDEX_TO_OFFSET(VFIO_PCI_ROM_REGION_INDEX);
> 
> 	if (vdev->zapped_bars && __vfio_pci_memory_enabled(vdev)) {
> 		if (!vfio_device_io_remap_mapping_range(&vdev->vdev, start,
> 				end - start))
> 			vdev->zapped_bars = false;
> 		WARN_ON_ONCE(vdev->zapped_bars);
> 
> >  	vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
> > -	vma->vm_page_prot = pgprot_decrypted(vma->vm_page_prot);  
> 
> What is the story with this appearing earlier and disappearing here
> again?

We switched from io_remap_pfn_range() which includes this flag
implicitly, to vmf_insert_pfn() which does not, and back to
io_remap_pfn_range() when the fault handler is removed.

> > +extern void vfio_pci_test_and_up_write_memory_lock(struct vfio_pci_device
> > +						   *vdev);  
> 
> No need for the extern.

Thanks much for the reviews!

Alex

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ