Re: [PATCH 2/2] iommu/sva: Remove mm parameter from SVA bind API

2021-04-15 Thread Jason Gunthorpe
On Thu, Apr 15, 2021 at 01:33:24PM +0800, Lu Baolu wrote: > Hi Jason, > > On 4/14/21 7:26 PM, Jason Gunthorpe wrote: > > On Wed, Apr 14, 2021 at 02:22:09PM +0800, Lu Baolu wrote: > > > > > I still worry about supervisor pasid allocation. > > > > > > If we use iommu_sva_alloc_pasid() to allocate

Re: [PATCH 2/2] iommu/sva: Remove mm parameter from SVA bind API

2021-04-14 Thread Lu Baolu
Hi Jason, On 4/14/21 7:26 PM, Jason Gunthorpe wrote: On Wed, Apr 14, 2021 at 02:22:09PM +0800, Lu Baolu wrote: I still worry about supervisor pasid allocation. If we use iommu_sva_alloc_pasid() to allocate a supervisor pasid, which mm should the pasid be set? I've ever thought about passing &

Re: [PATCH 2/2] iommu/sva: Remove mm parameter from SVA bind API

2021-04-14 Thread Jason Gunthorpe
On Wed, Apr 14, 2021 at 02:22:09PM +0800, Lu Baolu wrote: > I still worry about supervisor pasid allocation. > > If we use iommu_sva_alloc_pasid() to allocate a supervisor pasid, which > mm should the pasid be set? I've ever thought about passing &init_mm to > iommu_sva_alloc_pasid(). But if you

Re: [PATCH 2/2] iommu/sva: Remove mm parameter from SVA bind API

2021-04-13 Thread Lu Baolu
Hi Jacob, On 4/14/21 8:09 AM, Jacob Pan wrote: Hi Jean, On Fri, 9 Apr 2021 11:03:05 -0700, Jacob Pan wrote: problems: * We don't have a use-case for binding the mm of a remote process (and it's supposedly difficult for device drivers to do it securely). So OK, we remove the mm argument f

Re: [PATCH 2/2] iommu/sva: Remove mm parameter from SVA bind API

2021-04-13 Thread Jacob Pan
Hi Jean, On Fri, 9 Apr 2021 11:03:05 -0700, Jacob Pan wrote: > > problems: > > > > * We don't have a use-case for binding the mm of a remote process (and > > it's supposedly difficult for device drivers to do it securely). So > > OK, we remove the mm argument from iommu_sva_bind_device() and

Re: [PATCH 2/2] iommu/sva: Remove mm parameter from SVA bind API

2021-04-09 Thread Jacob Pan
Hi Lu, On Fri, 9 Apr 2021 20:45:22 +0800, Lu Baolu wrote: > > -int iommu_sva_alloc_pasid(struct mm_struct *mm, ioasid_t min, ioasid_t > > max) +int iommu_sva_alloc_pasid(ioasid_t min, ioasid_t max) > > { > > int ret = 0; > > ioasid_t pasid; > > + struct mm_struct *mm; > > > >

Re: [PATCH 2/2] iommu/sva: Remove mm parameter from SVA bind API

2021-04-09 Thread Jacob Pan
Hi Jean-Philippe, On Fri, 9 Apr 2021 12:11:47 +0200, Jean-Philippe Brucker wrote: > On Thu, Apr 08, 2021 at 10:08:56AM -0700, Jacob Pan wrote: > > diff --git a/drivers/iommu/iommu-sva-lib.c > > b/drivers/iommu/iommu-sva-lib.c index bd41405..bd99f6b 100644 > > --- a/drivers/iommu/iommu-sva-lib.c

Re: [PATCH 2/2] iommu/sva: Remove mm parameter from SVA bind API

2021-04-09 Thread Lu Baolu
Hi, On 2021/4/9 1:08, Jacob Pan wrote: /** * iommu_sva_alloc_pasid - Allocate a PASID for the mm - * @mm: the mm * @min: minimum PASID value (inclusive) * @max: maximum PASID value (inclusive) * - * Try to allocate a PASID for this mm, or take a reference to the existing one - * pr

Re: [PATCH 2/2] iommu/sva: Remove mm parameter from SVA bind API

2021-04-09 Thread Jean-Philippe Brucker
On Thu, Apr 08, 2021 at 10:08:56AM -0700, Jacob Pan wrote: > diff --git a/drivers/iommu/iommu-sva-lib.c b/drivers/iommu/iommu-sva-lib.c > index bd41405..bd99f6b 100644 > --- a/drivers/iommu/iommu-sva-lib.c > +++ b/drivers/iommu/iommu-sva-lib.c > @@ -12,27 +12,33 @@ static DECLARE_IOASID_SET(iommu_s

[PATCH 2/2] iommu/sva: Remove mm parameter from SVA bind API

2021-04-08 Thread Jacob Pan
The mm parameter in iommu_sva_bind_device() is intended for privileged process perform bind() on behalf of other processes. This use case has yet to be materialized, let alone potential security implications of adding kernel hooks without explicit user consent. In addition, with the agreement that