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: <ZqDGTnH8TCxEkkEV@google.com>
Date: Wed, 24 Jul 2024 09:15:58 +0000
From: Mostafa Saleh <smostafa@...gle.com>
To: Kunkun Jiang <jiangkunkun@...wei.com>
Cc: Lu Baolu <baolu.lu@...ux.intel.com>, Will Deacon <will@...nel.org>,
	Robin Murphy <robin.murphy@....com>, Joerg Roedel <joro@...tes.org>,
	Jason Gunthorpe <jgg@...pe.ca>, Nicolin Chen <nicolinc@...dia.com>,
	Michael Shavit <mshavit@...gle.com>,
	"moderated list:ARM SMMU DRIVERS" <linux-arm-kernel@...ts.infradead.org>,
	iommu@...ts.linux.dev, linux-kernel@...r.kernel.org,
	wanghaibin.wang@...wei.com, yuzenghui@...wei.com,
	tangnianyao@...wei.com
Subject: Re: [bug report] iommu/arm-smmu-v3: Event cannot be printed in some
 scenarios

Hi Kunkun,

On Wed, Jul 24, 2024 at 09:42:09AM +0800, Kunkun Jiang wrote:
> Hi all,
> 
> drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
> 1797                 while (!queue_remove_raw(q, evt)) {
> 1798                         u8 id = FIELD_GET(EVTQ_0_ID, evt[0]);
> 1799
> 1800                         ret = arm_smmu_handle_evt(smmu, evt);
> 1801                         if (!ret || !__ratelimit(&rs))
> 1802                                 continue;
> 1803
> 1804                         dev_info(smmu->dev, "event 0x%02x received:\n",
> id);
> 1805                         for (i = 0; i < ARRAY_SIZE(evt); ++i)
> 1806                                 dev_info(smmu->dev, "\t0x%016llx\n",
> 1807                                          (unsigned long long)evt[i]);
> 1808
> 1809                         cond_resched();
> 1810                 }
> 
> The smmu-v3 driver cannot print event information when "ret" is 0.
> Unfortunately due to commit 3dfa64aecbaf
> ("iommu: Make iommu_report_device_fault() return void"), the default
> return value in arm_smmu_handle_evt() is 0. Maybe a trace should
> be added here?

In my opinion this change should be reverted as it’s very useful to
print event faults (for debugging crashes) as not always tracing is
available and enabled, and as we don’t want to print paging events
we should know if a device handled it or not.

Otherwise, as best effort from the driver, we can only skip printing
for IOPF enabled devices something like this? (or may be use
arm_smmu_master_sva_enabled() as I see only SVA uses it)

diff --git a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
index a31460f9f3d4..57f3a7d0e40f 100644
--- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
+++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
@@ -1777,7 +1777,11 @@ static int arm_smmu_handle_evt(struct arm_smmu_device *smmu, u64 *evt)
 		goto out_unlock;
 	}

-	iommu_report_device_fault(master->dev, &fault_evt);
+	if (master->iopf_enabled)
+		iommu_report_device_fault(master->dev, &fault_evt);
+	else
+		ret = -ENODEV;
+
 out_unlock:
 	mutex_unlock(&smmu->streams_mutex);
 	return ret;

But let’s see what others think.

Thanks,
Mostafa

> 
> Thanks,
> Kunkun Jiang
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ