diff options
Diffstat (limited to 'arch/x86/mm/fault_32.c')
-rw-r--r-- | arch/x86/mm/fault_32.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/arch/x86/mm/fault_32.c b/arch/x86/mm/fault_32.c index 6555c3d14371..503dfc05111b 100644 --- a/arch/x86/mm/fault_32.c +++ b/arch/x86/mm/fault_32.c | |||
@@ -354,7 +354,7 @@ fastcall void __kprobes do_page_fault(struct pt_regs *regs, | |||
354 | 354 | ||
355 | /* When running in the kernel we expect faults to occur only to | 355 | /* When running in the kernel we expect faults to occur only to |
356 | * addresses in user space. All other faults represent errors in the | 356 | * addresses in user space. All other faults represent errors in the |
357 | * kernel and should generate an OOPS. Unfortunatly, in the case of an | 357 | * kernel and should generate an OOPS. Unfortunately, in the case of an |
358 | * erroneous fault occurring in a code path which already holds mmap_sem | 358 | * erroneous fault occurring in a code path which already holds mmap_sem |
359 | * we will deadlock attempting to validate the fault against the | 359 | * we will deadlock attempting to validate the fault against the |
360 | * address space. Luckily the kernel only validly references user | 360 | * address space. Luckily the kernel only validly references user |
@@ -362,7 +362,7 @@ fastcall void __kprobes do_page_fault(struct pt_regs *regs, | |||
362 | * exceptions table. | 362 | * exceptions table. |
363 | * | 363 | * |
364 | * As the vast majority of faults will be valid we will only perform | 364 | * As the vast majority of faults will be valid we will only perform |
365 | * the source reference check when there is a possibilty of a deadlock. | 365 | * the source reference check when there is a possibility of a deadlock. |
366 | * Attempt to lock the address space, if we cannot we then validate the | 366 | * Attempt to lock the address space, if we cannot we then validate the |
367 | * source. If this is invalid we can skip the address space check, | 367 | * source. If this is invalid we can skip the address space check, |
368 | * thus avoiding the deadlock. | 368 | * thus avoiding the deadlock. |
@@ -471,8 +471,8 @@ bad_area_nosemaphore: | |||
471 | printk_ratelimit()) { | 471 | printk_ratelimit()) { |
472 | printk("%s%s[%d]: segfault at %08lx eip %08lx " | 472 | printk("%s%s[%d]: segfault at %08lx eip %08lx " |
473 | "esp %08lx error %lx\n", | 473 | "esp %08lx error %lx\n", |
474 | tsk->pid > 1 ? KERN_INFO : KERN_EMERG, | 474 | task_pid_nr(tsk) > 1 ? KERN_INFO : KERN_EMERG, |
475 | tsk->comm, tsk->pid, address, regs->eip, | 475 | tsk->comm, task_pid_nr(tsk), address, regs->eip, |
476 | regs->esp, error_code); | 476 | regs->esp, error_code); |
477 | } | 477 | } |
478 | tsk->thread.cr2 = address; | 478 | tsk->thread.cr2 = address; |
@@ -564,7 +564,8 @@ no_context: | |||
564 | * it's allocated already. | 564 | * it's allocated already. |
565 | */ | 565 | */ |
566 | if ((page >> PAGE_SHIFT) < max_low_pfn | 566 | if ((page >> PAGE_SHIFT) < max_low_pfn |
567 | && (page & _PAGE_PRESENT)) { | 567 | && (page & _PAGE_PRESENT) |
568 | && !(page & _PAGE_PSE)) { | ||
568 | page &= PAGE_MASK; | 569 | page &= PAGE_MASK; |
569 | page = ((__typeof__(page) *) __va(page))[(address >> PAGE_SHIFT) | 570 | page = ((__typeof__(page) *) __va(page))[(address >> PAGE_SHIFT) |
570 | & (PTRS_PER_PTE - 1)]; | 571 | & (PTRS_PER_PTE - 1)]; |
@@ -587,7 +588,7 @@ no_context: | |||
587 | */ | 588 | */ |
588 | out_of_memory: | 589 | out_of_memory: |
589 | up_read(&mm->mmap_sem); | 590 | up_read(&mm->mmap_sem); |
590 | if (is_init(tsk)) { | 591 | if (is_global_init(tsk)) { |
591 | yield(); | 592 | yield(); |
592 | down_read(&mm->mmap_sem); | 593 | down_read(&mm->mmap_sem); |
593 | goto survive; | 594 | goto survive; |