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: <682b5b61-e556-479e-b641-3c987360d87b@linux.intel.com>
Date: Sat, 22 Feb 2025 15:25:43 +0800
From: Baolu Lu <baolu.lu@...ux.intel.com>
To: Jason Gunthorpe <jgg@...pe.ca>
Cc: Joerg Roedel <joro@...tes.org>, Will Deacon <will@...nel.org>,
 Robin Murphy <robin.murphy@....com>, Kevin Tian <kevin.tian@...el.com>,
 Dave Jiang <dave.jiang@...el.com>, Vinod Koul <vkoul@...nel.org>,
 Zhangfei Gao <zhangfei.gao@...aro.org>, Zhou Wang <wangzhou1@...ilicon.com>,
 iommu@...ts.linux.dev, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 08/12] iommufd/selftest: Put iopf enablement in domain
 attach path

On 2/21/25 23:04, Jason Gunthorpe wrote:
>> -       return mock_dev_enable_iopf(dev, domain);
>> +       if (mdev->domain)
>> +               mock_dev_disable_iopf(dev, mdev->domain);
>> +
>> +       ret = mock_dev_enable_iopf(dev, domain);
>> +       if (ret)
> Though here the domain is disabled but not removed from mdev->domain,
> is it OK?

That's not okay. I can make it like below:

static int mock_domain_nop_attach(struct iommu_domain *domain,
                                   struct device *dev)
{
         struct mock_dev *mdev = to_mock_dev(dev);
         int ret;

         if (domain->dirty_ops && (mdev->flags & 
MOCK_FLAGS_DEVICE_NO_DIRTY))
                 return -EINVAL;

         ret = mock_dev_enable_iopf(dev, domain);
         if (ret)
                 return ret;

         mock_dev_disable_iopf(dev, mdev->domain);
         mdev->domain = domain;

         return 0;
}

Both mock_dev_enable/disable_iopf() will be a no-op if domain or
domain's iopf handler is empty:

         if (!domain || !domain->iopf_handler)
                 return;

Does it work for you?

Thanks,
baolu

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ