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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aEsNY4X4AaxDVINo@nvidia.com>
Date: Thu, 12 Jun 2025 10:24:51 -0700
From: Nicolin Chen <nicolinc@...dia.com>
To: "Tian, Kevin" <kevin.tian@...el.com>
CC: "jgg@...dia.com" <jgg@...dia.com>, "will@...nel.org" <will@...nel.org>,
	"robin.murphy@....com" <robin.murphy@....com>, "joro@...tes.org"
	<joro@...tes.org>, "ddutile@...hat.com" <ddutile@...hat.com>, "Liu, Yi L"
	<yi.l.liu@...el.com>, "peterz@...radead.org" <peterz@...radead.org>,
	"jsnitsel@...hat.com" <jsnitsel@...hat.com>, "praan@...gle.com"
	<praan@...gle.com>, "linux-arm-kernel@...ts.infradead.org"
	<linux-arm-kernel@...ts.infradead.org>, "iommu@...ts.linux.dev"
	<iommu@...ts.linux.dev>, "linux-kernel@...r.kernel.org"
	<linux-kernel@...r.kernel.org>, "patches@...ts.linux.dev"
	<patches@...ts.linux.dev>, "baolu.lu@...ux.intel.com"
	<baolu.lu@...ux.intel.com>
Subject: Re: [PATCH v1 08/12] iommufd/viommu: Replace ops->viommu_alloc with
 ops->viommu_init

On Thu, Jun 12, 2025 at 08:27:12AM +0000, Tian, Kevin wrote:
> > From: Nicolin Chen <nicolinc@...dia.com>
> > Sent: Tuesday, June 10, 2025 1:14 AM
> > 
> > +	rc = ops->get_viommu_size(cmd->type, idev->dev, &viommu_size);
> > +	if (rc)
> > +		goto out_put_idev;
> > +
> > +	/*
> > +	 * It is a driver bug for providing a viommu_size smaller than the core
> > +	 * vIOMMU structure size
> > +	 */
> > +	if (WARN_ON_ONCE(viommu_size < sizeof(*viommu))) {
> > +		rc = -EINVAL;
> > +		goto out_put_idev;
> > +	}
> > +
> 
> It's not about user providing an invalid argument. Sounds cleaner
> to return NOSUPPORT in such case.

Yea, I think that's legit. The driver is broken to support vIOMMU
allocations.

Maybe we should change this one too?
226 static struct iommufd_hwpt_nested *
227 iommufd_hwpt_nested_alloc(struct iommufd_ctx *ictx,
228                           struct iommufd_hwpt_paging *parent,
229                           struct iommufd_device *idev, u32 flags,
230                           const struct iommu_user_data *user_data)
231 {
...
266         if (WARN_ON_ONCE(hwpt->domain->type != IOMMU_DOMAIN_NESTED)) {
267                 rc = -EINVAL;
268                 goto out_abort;
269         }

Similarly, the driver is broken to support nested HWPT allocations.

Thanks
Nicolin

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ