From: Li Yang <leoli@freescale.com>
To: galak@kernel.crashing.org, linuxppc-dev@ozlabs.org
Cc: Jin Qing <b24347@freescale.com>
Subject: [PATCH] pte_fsl_booke: fix instruction TLB error permission check
Date: Fri, 7 May 2010 16:38:34 +0800 [thread overview]
Message-ID: <1273221514-8683-1-git-send-email-leoli@freescale.com> (raw)
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
next reply other threads:[~2010-05-07 8:00 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-07 8:38 Li Yang [this message]
2010-05-13 19:14 ` [PATCH] pte_fsl_booke: fix instruction TLB error permission check 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1273221514-8683-1-git-send-email-leoli@freescale.com \
--to=leoli@freescale.com \
--cc=b24347@freescale.com \
--cc=galak@kernel.crashing.org \
--cc=linuxppc-dev@ozlabs.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).