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]
Date:   Wed, 25 Oct 2023 00:14:51 +0800
From:   Yi Liu <yi.l.liu@...el.com>
To:     Joao Martins <joao.m.martins@...cle.com>
CC:     <cohuck@...hat.com>, <eric.auger@...hat.com>,
        <nicolinc@...dia.com>, <kvm@...r.kernel.org>,
        <mjrosato@...ux.ibm.com>, <chao.p.peng@...ux.intel.com>,
        <yi.y.sun@...ux.intel.com>, <peterx@...hat.com>,
        <jasowang@...hat.com>, <shameerali.kolothum.thodi@...wei.com>,
        <lulu@...hat.com>, <suravee.suthikulpanit@....com>,
        <iommu@...ts.linux.dev>, <linux-kernel@...r.kernel.org>,
        <linux-kselftest@...r.kernel.org>, <zhenzhong.duan@...el.com>,
        <baolu.lu@...ux.intel.com>, <joro@...tes.org>,
        <alex.williamson@...hat.com>, <kevin.tian@...el.com>,
        <jgg@...dia.com>, <robin.murphy@....com>
Subject: Re: [PATCH v6 02/10] iommu: Pass in parent domain with user_data to
 domain_alloc_user op

On 2023/10/24 23:56, Joao Martins wrote:
> On 24/10/2023 16:06, Yi Liu wrote:
>> domain_alloc_user op already accepts user flags for domain allocation, add
>> a parent domain pointer and a driver specific user data support as well.
>>
>> Add a struct iommu_user_data as a bundle of data_ptr/data_len/type from an
>> iommufd core uAPI structure. Make the user data opaque to the core, since
>> a userspace driver must match the kernel driver. In the future, if drivers
>> share some common parameter, there would be a generic parameter as well.
>>
>> Define an enum iommu_hwpt_data_type (with IOMMU_HWPT_DATA_NONE type) for
>> iommu drivers to add their own driver specific user data per hw_pagetable.
>>
>> Signed-off-by: Lu Baolu <baolu.lu@...ux.intel.com>
>> Co-developed-by: Nicolin Chen <nicolinc@...dia.com>
>> Signed-off-by: Nicolin Chen <nicolinc@...dia.com>
>> Signed-off-by: Yi Liu <yi.l.liu@...el.com>
>> ---
>>   drivers/iommu/intel/iommu.c          |  7 ++++++-
> 
> You are sadly missing AMD IOMMU

good catch.

> 
> This would fix the build and nack the op should parent or user_data be passed:
> 
> diff --git a/drivers/iommu/amd/iommu.c b/drivers/iommu/amd/iommu.c
> index caad10f9cee3..bc747513afcb 100644
> --- a/drivers/iommu/amd/iommu.c
> +++ b/drivers/iommu/amd/iommu.c
> @@ -2220,13 +2220,17 @@ static struct iommu_domain
> *amd_iommu_domain_alloc(unsigned int type)
>   }
> 
>   static struct iommu_domain *amd_iommu_domain_alloc_user(struct device *dev,
> -                                                       u32 flags)
> +                                       u32 flags, struct iommu_domain *parent,
> +                                       const struct iommu_user_data *user_data)
>   {
>          unsigned int type = IOMMU_DOMAIN_UNMANAGED;
> 
>          if (flags & ~IOMMU_HWPT_ALLOC_DIRTY_TRACKING)
>                  return ERR_PTR(-EOPNOTSUPP);
> 
> +       if (parent || user_data)
> +               return ERR_PTR(-EOPNOTSUPP);
> +
>          return do_iommu_domain_alloc(type, dev, flags);
>   }

yes, this should work. @Jason, one more version or just this one with the
above diff from Joao?

-- 
Regards,
Yi Liu

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ