Skip to content

Commit

Permalink
[POWERPC] PowerPC: Prevent data exception in kernel space (32-bit)
Browse files Browse the repository at this point in the history
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.

This fixes it.

Signed-off-by: Segher Boessenkool <segher@kernel.crashing.org>
Cc: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: Paul Mackerras <paulus@samba.org>
  • Loading branch information
Segher Boessenkool authored and Paul Mackerras committed Jun 20, 2007
1 parent 7c8545e commit 9ba4ace
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions arch/powerpc/mm/fault.c
Original file line number Diff line number Diff line change
Expand Up @@ -279,14 +279,13 @@ int __kprobes do_page_fault(struct pt_regs *regs, unsigned long address,
#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;

Expand Down

0 comments on commit 9ba4ace

Please sign in to comment.