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:   Wed, 7 Apr 2021 06:35:41 +0000
From:   "Longpeng (Mike, Cloud Infrastructure Service Product Dept.)" 
        <longpeng2@...wei.com>
To:     Lu Baolu <baolu.lu@...ux.intel.com>,
        "iommu@...ts.linux-foundation.org" <iommu@...ts.linux-foundation.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
CC:     David Woodhouse <dwmw2@...radead.org>,
        Nadav Amit <nadav.amit@...il.com>,
        Alex Williamson <alex.williamson@...hat.com>,
        Kevin Tian <kevin.tian@...el.com>,
        "Gonglei (Arei)" <arei.gonglei@...wei.com>,
        "stable@...r.kernel.org" <stable@...r.kernel.org>
Subject: RE: [PATCH] iommu/vt-d: Force to flush iotlb before creating
 superpage

Hi Baolu,

> -----Original Message-----
> From: Lu Baolu [mailto:baolu.lu@...ux.intel.com]
> Sent: Friday, April 2, 2021 12:44 PM
> To: Longpeng (Mike, Cloud Infrastructure Service Product Dept.)
> <longpeng2@...wei.com>; iommu@...ts.linux-foundation.org;
> linux-kernel@...r.kernel.org
> Cc: baolu.lu@...ux.intel.com; David Woodhouse <dwmw2@...radead.org>; Nadav
> Amit <nadav.amit@...il.com>; Alex Williamson <alex.williamson@...hat.com>;
> Kevin Tian <kevin.tian@...el.com>; Gonglei (Arei) <arei.gonglei@...wei.com>;
> stable@...r.kernel.org
> Subject: Re: [PATCH] iommu/vt-d: Force to flush iotlb before creating superpage
> 
> Hi Longpeng,
> 
> On 4/1/21 3:18 PM, Longpeng(Mike) wrote:
> > diff --git a/drivers/iommu/intel/iommu.c b/drivers/iommu/intel/iommu.c
> > index ee09323..cbcb434 100644
> > --- a/drivers/iommu/intel/iommu.c
> > +++ b/drivers/iommu/intel/iommu.c
> > @@ -2342,9 +2342,20 @@ static inline int hardware_largepage_caps(struct
> dmar_domain *domain,
> >   				 * removed to make room for superpage(s).
> >   				 * We're adding new large pages, so make sure
> >   				 * we don't remove their parent tables.
> > +				 *
> > +				 * We also need to flush the iotlb before creating
> > +				 * superpage to ensure it does not perserves any
> > +				 * obsolete info.
> >   				 */
> > -				dma_pte_free_pagetable(domain, iov_pfn, end_pfn,
> > -						       largepage_lvl + 1);
> > +				if (dma_pte_present(pte)) {
> 
> The dma_pte_free_pagetable() clears a batch of PTEs. So checking current PTE is
> insufficient. How about removing this check and always performing cache
> invalidation?
> 

Um...the PTE here may be present( e.g. 4K mapping --> superpage mapping ) or NOT-present ( e.g. create a totally new superpage mapping ), but we only need to call free_pagetable and flush_iotlb in the former case, right ?

> > +					int i;
> > +
> > +					dma_pte_free_pagetable(domain, iov_pfn, end_pfn,
> > +							       largepage_lvl + 1);
> > +					for_each_domain_iommu(i, domain)
> > +						iommu_flush_iotlb_psi(g_iommus[i], domain,
> > +								      iov_pfn, nr_pages, 0, 0);
> > +
> 
> Best regards,
> baolu

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ