From: Segher Boessenkool <segher@kernel.crashing.org>
To: linuxppc-dev@ozlabs.org
Cc: Johannes Berg <johannes@sipsolutions.net>,
Paul Mackerras <paulus@samba.org>
Subject: [PATCH] PowerPC: Prevent data exception in kernel space (32-bit)
Date: Tue, 19 Jun 2007 17:07:04 +0200 [thread overview]
Message-ID: <1182265624255-git-send-email-segher@kernel.crashing.org> (raw)
Message-ID: <9051d9387cad9fa7d8143dc1816949cbc80696b7.1182264776.git.segher@kernel.crashing.org> (raw)
In-Reply-To: <1182171859.21013.3.camel@johannes.berg>
The "is_exec" branch of the protection check in do_page_fault()
didn't do anything on 32-bit PowerPC. So if a userland program
jumps to a page with Linux protection flags "---p", all the tests
happily fall through, and handle_mm_fault() is called, which in
turn calls handle_pte_fault(), which calls update_mmu_cache(),
which goes flush the dcache to a page with no access rights.
Boom.
Signed-off-by: Segher Boessenkool <segher@kernel.crashing.org>
Cc: Johannes Berg <johannes@sipsolutions.net>
Cc: Paul Mackerras <paulus@samba.org>
---
Johannes, please test. Paul, I think you'll want this for .22 still?
If the patch is correct, anyway ;-)
arch/powerpc/mm/fault.c | 5 ++---
1 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/arch/powerpc/mm/fault.c b/arch/powerpc/mm/fault.c
index bfe9013..115b25f 100644
--- a/arch/powerpc/mm/fault.c
+++ b/arch/powerpc/mm/fault.c
@@ -279,14 +279,13 @@ good_area:
#endif /* CONFIG_8xx */
if (is_exec) {
-#ifdef CONFIG_PPC64
+#if !(defined(CONFIG_4xx) || defined(CONFIG_BOOKE))
/* protection fault */
if (error_code & DSISR_PROTFAULT)
goto bad_area;
if (!(vma->vm_flags & VM_EXEC))
goto bad_area;
-#endif
-#if defined(CONFIG_4xx) || defined(CONFIG_BOOKE)
+#else
pte_t *ptep;
pmd_t *pmdp;
--
1.5.2.1.144.gabc40-dirty
next prev parent reply other threads:[~2007-06-19 15:21 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-06-18 13:04 random code execution - kernel oops Johannes Berg
2007-06-19 15:07 ` Segher Boessenkool [this message]
2007-06-19 15:07 ` [PATCH] PowerPC: Prevent data exception in kernel space (32-bit) Segher Boessenkool
2007-06-19 16:06 ` random code execution - kernel oops Johannes Berg
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=1182265624255-git-send-email-segher@kernel.crashing.org \
--to=segher@kernel.crashing.org \
--cc=johannes@sipsolutions.net \
--cc=linuxppc-dev@ozlabs.org \
--cc=paulus@samba.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.