Skip to content

Commit

Permalink
Merge branch 'x86/mm' into x86/core
Browse files Browse the repository at this point in the history
  • Loading branch information
Ingo Molnar committed Feb 13, 2009
2 parents a56cdcb + 0464ac9 commit f268fe7
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions arch/x86/mm/fault.c
Original file line number Diff line number Diff line change
Expand Up @@ -782,6 +782,15 @@ static inline int access_error(unsigned long error_code, int write,
return 0;
}

static int fault_in_kernel_space(unsigned long address)
{
#ifdef CONFIG_X86_32
return address >= TASK_SIZE;
#else /* !CONFIG_X86_32 */
return address >= TASK_SIZE64;
#endif /* CONFIG_X86_32 */
}

/*
* This routine handles page faults. It determines the address,
* and the problem, and then passes it off to one of the appropriate
Expand Down Expand Up @@ -822,11 +831,7 @@ void __kprobes do_page_fault(struct pt_regs *regs, unsigned long error_code)
* (error_code & 4) == 0, and that the fault was not a
* protection error (error_code & 9) == 0.
*/
#ifdef CONFIG_X86_32
if (unlikely(address >= TASK_SIZE)) {
#else
if (unlikely(address >= TASK_SIZE64)) {
#endif
if (unlikely(fault_in_kernel_space(address))) {
if (!(error_code & (PF_RSVD|PF_USER|PF_PROT)) &&
vmalloc_fault(address) >= 0)
return;
Expand Down Expand Up @@ -898,6 +903,12 @@ void __kprobes do_page_fault(struct pt_regs *regs, unsigned long error_code)
return;
}
down_read(&mm->mmap_sem);
} else {
/*
* The above down_read_trylock() might have succeeded in which
* case we'll have missed the might_sleep() from down_read().
*/
might_sleep();
}

vma = find_vma(mm, address);
Expand Down

0 comments on commit f268fe7

Please sign in to comment.