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: Sat, 29 Jun 2024 11:58:01 +0800
From: Baolu Lu <baolu.lu@...ux.intel.com>
To: Jason Gunthorpe <jgg@...pe.ca>
Cc: baolu.lu@...ux.intel.com, Kevin Tian <kevin.tian@...el.com>,
 Joerg Roedel <joro@...tes.org>, Will Deacon <will@...nel.org>,
 Robin Murphy <robin.murphy@....com>,
 Jean-Philippe Brucker <jean-philippe@...aro.org>,
 Nicolin Chen <nicolinc@...dia.com>, Yi Liu <yi.l.liu@...el.com>,
 Jacob Pan <jacob.jun.pan@...ux.intel.com>,
 Joel Granados <j.granados@...sung.com>, iommu@...ts.linux.dev,
 virtualization@...ts.linux-foundation.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v7 04/10] iommu: Extend domain attach group with handle
 support

On 2024/6/29 5:06, Jason Gunthorpe wrote:
> On Sun, Jun 16, 2024 at 02:11:49PM +0800, Lu Baolu wrote:
> 
>> +int iommu_replace_group_handle(struct iommu_group *group,
>> +			       struct iommu_domain *new_domain,
>> +			       struct iommu_attach_handle *handle)
>> +{
>> +	struct iommu_domain *old_domain = group->domain;
>> +	void *curr;
>> +	int ret;
>> +
>> +	if (!new_domain)
>> +		return -EINVAL;
>> +
>> +	mutex_lock(&group->mutex);
>> +	ret = __iommu_group_set_domain(group, new_domain);
>> +	if (ret)
>> +		goto err_unlock;
>> +	xa_erase(&group->pasid_array, IOMMU_NO_PASID);
>> +	if (handle) {
>> +		curr = xa_store(&group->pasid_array, IOMMU_NO_PASID, handle, GFP_KERNEL);
>> +		if (xa_err(curr)) {
>> +			ret = xa_err(curr);
>> +			goto err_restore;
> But this error unwind doesn't work because the xa_erase() already
> happened and there may have been a handle there that we don't put
> back.

Yes, you are right.

> 
> Something like this - store to a reserved entry cannot fail:

This code looks good to me. Thanks!

Best regards,
baolu

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ