linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] pte_fsl_booke: fix instruction TLB error permission check
@ 2010-05-07  8:38 Li Yang
  2010-05-13 19:14 ` Kumar Gala
  0 siblings, 1 reply; 11+ messages in thread
From: Li Yang @ 2010-05-07  8:38 UTC (permalink / raw)
  To: galak, linuxppc-dev; +Cc: Jin Qing

Check the user/supervisor execution permission base on the code address.
This fixes the following oops on module loading or removing.

Unable to handle kernel paging request for instruction fetch
Faulting instruction address: 0xf938d040
Oops: Kernel access of bad area, sig: 11 [#1]

Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Jin Qing <b24347@freescale.com>
---
 arch/powerpc/kernel/head_fsl_booke.S |   13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/arch/powerpc/kernel/head_fsl_booke.S b/arch/powerpc/kernel/head_fsl_booke.S
index 78aac7b..61b6687 100644
--- a/arch/powerpc/kernel/head_fsl_booke.S
+++ b/arch/powerpc/kernel/head_fsl_booke.S
@@ -684,6 +684,13 @@ interrupt_base:
 	rlwinm	r12,r12,0,16,1
 	mtspr	SPRN_MAS1,r12
 
+	/* Make up the required permissions for kernel code */
+#ifdef CONFIG_PTE_64BIT
+	li	r13,_PAGE_PRESENT | _PAGE_BAP_SX
+	oris	r13,r13,_PAGE_ACCESSED@h
+#else
+	li	r13,_PAGE_PRESENT | _PAGE_ACCESSED | _PAGE_EXEC
+#endif
 	b	4f
 
 	/* Get the PGD for the current thread */
@@ -691,15 +698,15 @@ interrupt_base:
 	mfspr	r11,SPRN_SPRG_THREAD
 	lwz	r11,PGDIR(r11)
 
-4:
-	/* Make up the required permissions */
+	/* Make up the required permissions for user code */
 #ifdef CONFIG_PTE_64BIT
-	li	r13,_PAGE_PRESENT | _PAGE_EXEC
+	li	r13,_PAGE_PRESENT | _PAGE_BAP_UX
 	oris	r13,r13,_PAGE_ACCESSED@h
 #else
 	li	r13,_PAGE_PRESENT | _PAGE_ACCESSED | _PAGE_EXEC
 #endif
 
+4:
 	FIND_PTE
 	andc.	r13,r13,r11		/* Check permission */
 
-- 
1.6.6-rc1.GIT

^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2010-05-14  9:25 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-07  8:38 [PATCH] pte_fsl_booke: fix instruction TLB error permission check Li Yang
2010-05-13 19:14 ` Kumar Gala
2010-05-13 21:46   ` Benjamin Herrenschmidt
2010-05-14  2:16     ` Liu Dave-R63238
2010-05-14  9:08       ` Benjamin Herrenschmidt
2010-05-14  9:14         ` Liu Dave-R63238
2010-05-14  9:25           ` Benjamin Herrenschmidt
2010-05-14  0:53   ` Liu Dave-R63238
2010-05-14  3:42     ` Benjamin Herrenschmidt
2010-05-14  3:36   ` Benjamin Herrenschmidt
2010-05-14  4:19     ` Kumar Gala

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).