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]
Message-ID: <BN9PR11MB52768ACA721898D5C43CBE9B8C27A@BN9PR11MB5276.namprd11.prod.outlook.com>
Date:   Tue, 27 Jun 2023 07:54:02 +0000
From:   "Tian, Kevin" <kevin.tian@...el.com>
To:     Baolu Lu <baolu.lu@...ux.intel.com>,
        "Liu, Jingqi" <jingqi.liu@...el.com>,
        Jason Gunthorpe <jgg@...pe.ca>, Joerg Roedel <joro@...tes.org>,
        Will Deacon <will@...nel.org>,
        Robin Murphy <robin.murphy@....com>,
        Alex Williamson <alex.williamson@...hat.com>,
        Nicolin Chen <nicolinc@...dia.com>
CC:     "iommu@...ts.linux.dev" <iommu@...ts.linux.dev>,
        "kvm@...r.kernel.org" <kvm@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        Jason Gunthorpe <jgg@...dia.com>
Subject: RE: [PATCH 1/2] iommu: Prevent RESV_DIRECT devices from blocking
 domains

> From: Baolu Lu <baolu.lu@...ux.intel.com>
> Sent: Tuesday, June 13, 2023 11:15 AM
> 
> On 6/12/23 4:28 PM, Liu, Jingqi wrote:
> > On 6/7/2023 11:51 AM, Lu Baolu wrote:
> >> -
> >> -    BUG_ON(!domain->pgsize_bitmap);
> >> -
> >> -    pg_size = 1UL << __ffs(domain->pgsize_bitmap);
> >> +    pg_size = domain->pgsize_bitmap ? 1UL <<
> >> __ffs(domain->pgsize_bitmap) : 0;
> > Would it be better to add the following check here?
> >      if (WARN_ON(!pg_size))
> >              return -EINVAL;
> >
> > Instead of checking latter in the loop as follows.
> >      if (WARN_ON_ONCE(!pg_size)) {
> >              ret = -EINVAL;
> >              goto out;
> >      }
> 
> I am afraid no. Only the paging domains need a valid pg_size. That's the
> reason why I put it after the iommu_is_dma_domain() check. The previous
> code has the same behavior too.
> 

You could also add the dma domain check here. pg_size is static
then it makes more sense to verify it once instead of in a loop.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ