Skip to content

Commit

Permalink
MIPS: Don't corrupt page tables on vmalloc fault.
Browse files Browse the repository at this point in the history
The code after the vmalloc_fault: label in do_page_fault() modifies
user page tables, this is not correct for 64-bit kernels.

For 64-bit kernels we should go straight to the no_context handler
skipping vmalloc_fault.

Signed-off-by: David Daney <ddaney@caviumnetworks.com>
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
  • Loading branch information
David Daney authored and Ralf Baechle committed Sep 17, 2009
1 parent e0cc87f commit 2ca2ebf
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions arch/mips/mm/fault.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,17 @@ asmlinkage void do_page_fault(struct pt_regs *regs, unsigned long write,
* only copy the information from the master page table,
* nothing more.
*/
#ifdef CONFIG_64BIT
# define VMALLOC_FAULT_TARGET no_context
#else
# define VMALLOC_FAULT_TARGET vmalloc_fault
#endif

if (unlikely(address >= VMALLOC_START && address <= VMALLOC_END))
goto vmalloc_fault;
goto VMALLOC_FAULT_TARGET;
#ifdef MODULE_START
if (unlikely(address >= MODULE_START && address < MODULE_END))
goto vmalloc_fault;
goto VMALLOC_FAULT_TARGET;
#endif

/*
Expand Down Expand Up @@ -203,6 +209,7 @@ asmlinkage void do_page_fault(struct pt_regs *regs, unsigned long write,
force_sig_info(SIGBUS, &info, tsk);

return;
#ifndef CONFIG_64BIT
vmalloc_fault:
{
/*
Expand Down Expand Up @@ -241,4 +248,5 @@ asmlinkage void do_page_fault(struct pt_regs *regs, unsigned long write,
goto no_context;
return;
}
#endif
}

0 comments on commit 2ca2ebf

Please sign in to comment.