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: <CAK=Wgbbf2XbDrp6q5G3_7og+0wsmFmqpCsx_nDYTyRTa0-YBmg@mail.gmail.com>
Date:	Tue, 27 Sep 2011 11:48:07 +0300
From:	Ohad Ben-Cohen <ohad@...ery.com>
To:	KyongHo Cho <pullip.cho@...sung.com>
Cc:	"linux-arm-kernel@...ts.infradead.org" 
	<linux-arm-kernel@...ts.infradead.org>,
	"linux-samsung-soc@...r.kernel.org" 
	<linux-samsung-soc@...r.kernel.org>,
	"iommu@...ts.linux-foundation.org" <iommu@...ts.linux-foundation.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	"joerg.roedel@....com" <joerg.roedel@....com>,
	이상현 <sanghyun75.lee@...sung.com>,
	김국진 <kgene.kim@...sung.com>,
	김영락 <younglak1004.kim@...sung.com>
Subject: Re: [PATCH 3/4] iommu/exynos: Add iommu driver for Exynos4 Platforms

On Tue, Sep 27, 2011 at 3:56 AM, KyongHo Cho <pullip.cho@...sung.com> wrote:
> I wanted the IOMMU driver to provide default fault handler to its users
> that does not provide fault handler for debugging purpose.
> If a user want to handle MMU fault, IOMMU driver welcomes to overwrite
> the existing 'default' fault handler.

Ok, this one patch below should allow you to do that.
report_iommu_fault() will now reliably tell you if a fault handler
failed or not, or if one isn't even installed.

This way your IOMMU driver doesn't need to define a fault handler of
its own, and instead, can do everything directly in
exynos_sysmmu_irq() where all the required information is now
available.

Thanks,
Ohad.

>From 0f2287abe5761e40d25f0da0c8e7964d18ebb3ef Mon Sep 17 00:00:00 2001
From: Ohad Ben-Cohen <ohad@...ery.com>
Date: Tue, 27 Sep 2011 11:14:22 +0300
Subject: [PATCH] iommu/core: let drivers know if an iommu fault
handler isn't installed

Let report_iommu_fault() return -ENOSYS whenever an iommu fault
handler isn't installed, so IOMMU drivers can then do their own
platform-specific default behavior if they want.

Clarify that -ENOSYS is reserved for this purpose, and that fault
handlers are prohibited from using it.

Signed-off-by: Ohad Ben-Cohen <ohad@...ery.com>
---
 drivers/iommu/iommu.c |    7 +++++++
 include/linux/iommu.h |    3 ++-
 2 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c
index 3a07259..c41a6a1 100644
--- a/drivers/iommu/iommu.c
+++ b/drivers/iommu/iommu.c
@@ -43,6 +43,13 @@ EXPORT_SYMBOL_GPL(iommu_found);
  * iommu_set_fault_handler() - set a fault handler for an iommu domain
  * @domain: iommu domain
  * @handler: fault handler
+ *
+ * This function should be used by IOMMU users which want to be notified
+ * whenever an IOMMU fault happens.
+ *
+ * The fault handler itself should return 0 on success, and an appropriate
+ * error code otherwise. It should never return -ENOSYS though, as this is
+ * reserved for the IOMMU core to return when no handler is installed.
  */
 void iommu_set_fault_handler(struct iommu_domain *domain,
 					iommu_fault_handler_t handler)
diff --git a/include/linux/iommu.h b/include/linux/iommu.h
index d084e87..2987199 100644
--- a/include/linux/iommu.h
+++ b/include/linux/iommu.h
@@ -98,11 +98,12 @@ extern void iommu_set_fault_handler(struct
iommu_domain *domain,
  * Returns 0 on success and an appropriate error code otherwise (if dynamic
  * PTE/TLB loading will one day be supported, implementations will be able
  * to tell whether it succeeded or not according to this return value).
+ * If a fault handler isn't installed, -ENOSYS is returned.
  */
 static inline int report_iommu_fault(struct iommu_domain *domain,
 		struct device *dev, unsigned long iova, int flags)
 {
-	int ret = 0;
+	int ret = -ENOSYS;

 	/*
 	 * if upper layers showed interest and installed a fault handler,
-- 
1.7.4.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ