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: <aBpjbtRgR1nK/LIm@nvidia.com>
Date: Tue, 6 May 2025 12:30:54 -0700
From: Nicolin Chen <nicolinc@...dia.com>
To: Jason Gunthorpe <jgg@...dia.com>
CC: Pranjal Shrivastava <praan@...gle.com>, <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>, <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>
Subject: Re: [PATCH v2 13/22] iommufd: Add mmap interface

On Tue, May 06, 2025 at 09:52:22AM -0300, Jason Gunthorpe wrote:
> On Mon, May 05, 2025 at 12:50:56PM -0700, Nicolin Chen wrote:
> 
> > I wanted to ask: what should we pass in to the "entry"? An mmap
> > structure that hold the pfn range? Or just pfn_start?
> 
> Some kind of struct telling you what is behind that pfn range so you
> can invoke the right driver callback and retun the right pfns..

I see.

> > With that being said, it seems that I have been misusing the
> > mtree data structure, treating it as an xarray. In your very
> > first email suggesting the mmap design, where you mentioned
> > "xarray" first and "maple tree" following. So, I thought they
> > can be used in the similar way, especially after reading this:
> > https://lwn.net/Articles/846175/
> 
> This job requires a range based datastructure. Meaning you insert PFNs
> A->B and then a lookup would search for any intersection with A->B.
> 
> In maple tree you can do this rather directly since it is inherently
> range based.
> 
> In xarray you can do it with the multi-order feature or you can do it
> by replicating the entry across the whole range.

So, if I understand it correctly, what we want to achieve is to
have maple tree to manage all PFN ranges. And each range holds
the same entry, a structure that we can use to verify the sanity
of an mmap? Let's say for PFNs A->B, the tree should store the
structure between index A and index B (inclusive)?

If this is correct, mtree_alloc_range() that is given a range of
[0, ULONG_MAX] would allocate the PFN range from the lowest index
(i.e. 0) instead of PFN A?

Thanks
Nicolin

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ