[PATCH] powerpc/radix/mm: Fixup storage key mm fault

Balbir Singh bsingharora at gmail.com
Wed Nov 30 11:35:36 AEDT 2016


Aneesh/Ben reported that the change to do_page_fault() needs
to handle the case where CPU_FTR_COHERENT_ICACHE is missing
but we have CPU_FTR_NOEXECUTE. In those cases the check
added for SRR1_ISI_N_OR_G might trigger a false positive.

This patch checks for CPU_FTR_COHERENT_ICACHE in addition
to the MSR value

Reported-by: Aneesh Kumar K.V <aneesh.kumar at linux.vnet.ibm.com>
Signed-off-by: Balbir Singh <bsingharora at gmail.com>
---

 Applies on top of powerpc/next and I've not added a fixes tag

 arch/powerpc/mm/fault.c | 9 ++++++++-
 drivers/crypto/Makefile | 1 -
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/mm/fault.c b/arch/powerpc/mm/fault.c
index a17029aa..eab3ded 100644
--- a/arch/powerpc/mm/fault.c
+++ b/arch/powerpc/mm/fault.c
@@ -392,8 +392,15 @@ int do_page_fault(struct pt_regs *regs, unsigned long address,
 	if (is_exec) {
 		/*
 		 * An execution fault + no execute ?
+		 * We need to check for CPU_FTR_COHERENT_ICACHE, since
+		 * on some variants, an NX fault is taken and
+		 * hash_page_do_lazy_icache() does the fixup. Without the
+		 * check for CPU_FTR_COHERENT_ICACHE we could have a false
+		 * positive if we have !CPU_FTR_COHERENT_ICACHE and
+		 * CPU_FTR_NOEXECUTE
 		 */
-		if (regs->msr & SRR1_ISI_N_OR_G)
+		if (cpu_has_feature(CPU_FTR_COHERENT_ICACHE) &&
+			(regs->msr & SRR1_ISI_N_OR_G))
 			goto bad_area;
 
 		/*
diff --git a/drivers/crypto/Makefile b/drivers/crypto/Makefile
index ad7250f..3c6432d 100644
--- a/drivers/crypto/Makefile
+++ b/drivers/crypto/Makefile
@@ -31,4 +31,3 @@ obj-$(CONFIG_CRYPTO_DEV_QCE) += qce/
 obj-$(CONFIG_CRYPTO_DEV_VMX) += vmx/
 obj-$(CONFIG_CRYPTO_DEV_SUN4I_SS) += sunxi-ss/
 obj-$(CONFIG_CRYPTO_DEV_ROCKCHIP) += rockchip/
-obj-$(CONFIG_CRYPTO_DEV_CHELSIO) += chelsio/
-- 
2.5.5



More information about the Linuxppc-dev mailing list