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: <aDn3hueUhGKWFIkn@Asurada-Nvidia>
Date: Fri, 30 May 2025 11:23:02 -0700
From: Nicolin Chen <nicolinc@...dia.com>
To: Jason Gunthorpe <jgg@...dia.com>
CC: <kevin.tian@...el.com>, <corbet@....net>, <will@...nel.org>,
	<bagasdotme@...il.com>, <robin.murphy@....com>, <joro@...tes.org>,
	<thierry.reding@...il.com>, <vdumpa@...dia.com>, <jonathanh@...dia.com>,
	<shuah@...nel.org>, <jsnitsel@...hat.com>, <nathan@...nel.org>,
	<peterz@...radead.org>, <yi.l.liu@...el.com>, <mshavit@...gle.com>,
	<praan@...gle.com>, <zhangzekun11@...wei.com>, <iommu@...ts.linux.dev>,
	<linux-doc@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
	<linux-arm-kernel@...ts.infradead.org>, <linux-tegra@...r.kernel.org>,
	<linux-kselftest@...r.kernel.org>, <patches@...ts.linux.dev>,
	<mochs@...dia.com>, <alok.a.tiwari@...cle.com>, <vasant.hegde@....com>,
	<dwmw2@...radead.org>, <baolu.lu@...ux.intel.com>
Subject: Re: [PATCH v5 14/29] iommufd/viommu: Add IOMMUFD_CMD_HW_QUEUE_ALLOC
 ioctl

On Fri, May 30, 2025 at 02:40:37PM -0300, Jason Gunthorpe wrote:
> On Fri, May 30, 2025 at 10:38:24AM -0700, Nicolin Chen wrote:
> > On Fri, May 30, 2025 at 01:14:55PM -0300, Jason Gunthorpe wrote:
> > > On Sat, May 17, 2025 at 08:21:31PM -0700, Nicolin Chen wrote:
> > > > +	offset =
> > > > +		cmd->nesting_parent_iova - PAGE_ALIGN(cmd->nesting_parent_iova);
> > > > +	max_npages = DIV_ROUND_UP(offset + cmd->length, PAGE_SIZE);
> > > 
> > > This should probably be capped to PAGE_SIZE/sizeof(void *), return
> > > EINVAL if not
> > 
> > Hmm, mind elaborating where this PAGE_SIZE/sizeof comes from?
> 
> We can usually allocate up to a PAGE_SIZE without too much
> trouble. Beyond that it gets more likely to fail.

If PAGE_SIZE=4096, the upper limit for max_npages is 512, i.e. the
max size of a guest queue is 2MB? It seems to be too small, as the
VMM can use a larger huge page size to back the guest queue?

> > > > +	hw_queue->viommu = viommu;
> > > > +	refcount_inc(&viommu->obj.users);
> > > > +	hw_queue->length = cmd->length;
> > > > +	hw_queue->base_addr = cmd->nesting_parent_iova;
> > > 
> > > When the driver is running, which can be a source of bugs.
> > 
> > Hmm, I don't quite follow the "bugs" here. Any example?
> 
> Like if the driver thinks that hw_queue->length should be valid during
> init, it turns out it isn't.

Ah, I see. Yes.

Nicolin

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ