fault.c (aeb8f932080d62cdc305a7ccca9d60de34908b30) fault.c (7fb08eca45270d0ae86e1ad9d39c40b7a55d0190)
1/*
2 * Copyright (C) 1995 Linus Torvalds
3 * Copyright (C) 2001, 2002 Andi Kleen, SuSE Labs.
4 * Copyright (C) 2008-2009, Red Hat Inc., Ingo Molnar
5 */
6#include <linux/sched.h> /* test_thread_flag(), ... */
7#include <linux/kdebug.h> /* oops_begin/end, ... */
8#include <linux/module.h> /* search_exception_table */

--- 830 unchanged lines hidden (view full) ---

839 __bad_area(regs, error_code, address, SEGV_ACCERR);
840}
841
842static void
843do_sigbus(struct pt_regs *regs, unsigned long error_code, unsigned long address,
844 unsigned int fault)
845{
846 struct task_struct *tsk = current;
1/*
2 * Copyright (C) 1995 Linus Torvalds
3 * Copyright (C) 2001, 2002 Andi Kleen, SuSE Labs.
4 * Copyright (C) 2008-2009, Red Hat Inc., Ingo Molnar
5 */
6#include <linux/sched.h> /* test_thread_flag(), ... */
7#include <linux/kdebug.h> /* oops_begin/end, ... */
8#include <linux/module.h> /* search_exception_table */

--- 830 unchanged lines hidden (view full) ---

839 __bad_area(regs, error_code, address, SEGV_ACCERR);
840}
841
842static void
843do_sigbus(struct pt_regs *regs, unsigned long error_code, unsigned long address,
844 unsigned int fault)
845{
846 struct task_struct *tsk = current;
847 struct mm_struct *mm = tsk->mm;
848 int code = BUS_ADRERR;
849
847 int code = BUS_ADRERR;
848
850 up_read(&mm->mmap_sem);
851
852 /* Kernel mode? Handle exceptions or die: */
853 if (!(error_code & PF_USER)) {
854 no_context(regs, error_code, address, SIGBUS, BUS_ADRERR);
855 return;
856 }
857
858 /* User-space => ok to do another page fault: */
859 if (is_prefetch(regs, error_code, address))

--- 14 unchanged lines hidden (view full) ---

874 force_sig_info_fault(SIGBUS, code, address, tsk, fault);
875}
876
877static noinline void
878mm_fault_error(struct pt_regs *regs, unsigned long error_code,
879 unsigned long address, unsigned int fault)
880{
881 if (fatal_signal_pending(current) && !(error_code & PF_USER)) {
849 /* Kernel mode? Handle exceptions or die: */
850 if (!(error_code & PF_USER)) {
851 no_context(regs, error_code, address, SIGBUS, BUS_ADRERR);
852 return;
853 }
854
855 /* User-space => ok to do another page fault: */
856 if (is_prefetch(regs, error_code, address))

--- 14 unchanged lines hidden (view full) ---

871 force_sig_info_fault(SIGBUS, code, address, tsk, fault);
872}
873
874static noinline void
875mm_fault_error(struct pt_regs *regs, unsigned long error_code,
876 unsigned long address, unsigned int fault)
877{
878 if (fatal_signal_pending(current) && !(error_code & PF_USER)) {
882 up_read(&current->mm->mmap_sem);
883 no_context(regs, error_code, address, 0, 0);
884 return;
885 }
886
887 if (fault & VM_FAULT_OOM) {
888 /* Kernel mode? Handle exceptions or die: */
889 if (!(error_code & PF_USER)) {
879 no_context(regs, error_code, address, 0, 0);
880 return;
881 }
882
883 if (fault & VM_FAULT_OOM) {
884 /* Kernel mode? Handle exceptions or die: */
885 if (!(error_code & PF_USER)) {
890 up_read(&current->mm->mmap_sem);
891 no_context(regs, error_code, address,
892 SIGSEGV, SEGV_MAPERR);
893 return;
894 }
895
886 no_context(regs, error_code, address,
887 SIGSEGV, SEGV_MAPERR);
888 return;
889 }
890
896 up_read(&current->mm->mmap_sem);
897
898 /*
899 * We ran out of memory, call the OOM killer, and return the
900 * userspace (which will retry the fault, or kill us if we got
901 * oom-killed):
902 */
903 pagefault_out_of_memory();
904 } else {
905 if (fault & (VM_FAULT_SIGBUS|VM_FAULT_HWPOISON|

--- 336 unchanged lines hidden (view full) ---

1242 * If we need to retry but a fatal signal is pending, handle the
1243 * signal first. We do not need to release the mmap_sem because it
1244 * would already be released in __lock_page_or_retry in mm/filemap.c.
1245 */
1246 if (unlikely((fault & VM_FAULT_RETRY) && fatal_signal_pending(current)))
1247 return;
1248
1249 if (unlikely(fault & VM_FAULT_ERROR)) {
891 /*
892 * We ran out of memory, call the OOM killer, and return the
893 * userspace (which will retry the fault, or kill us if we got
894 * oom-killed):
895 */
896 pagefault_out_of_memory();
897 } else {
898 if (fault & (VM_FAULT_SIGBUS|VM_FAULT_HWPOISON|

--- 336 unchanged lines hidden (view full) ---

1235 * If we need to retry but a fatal signal is pending, handle the
1236 * signal first. We do not need to release the mmap_sem because it
1237 * would already be released in __lock_page_or_retry in mm/filemap.c.
1238 */
1239 if (unlikely((fault & VM_FAULT_RETRY) && fatal_signal_pending(current)))
1240 return;
1241
1242 if (unlikely(fault & VM_FAULT_ERROR)) {
1243 up_read(&mm->mmap_sem);
1250 mm_fault_error(regs, error_code, address, fault);
1251 return;
1252 }
1253
1254 /*
1255 * Major/minor page fault accounting is only done on the
1256 * initial attempt. If we go through a retry, it is extremely
1257 * likely that the page will be found in page cache at that point.

--- 76 unchanged lines hidden ---
1244 mm_fault_error(regs, error_code, address, fault);
1245 return;
1246 }
1247
1248 /*
1249 * Major/minor page fault accounting is only done on the
1250 * initial attempt. If we go through a retry, it is extremely
1251 * likely that the page will be found in page cache at that point.

--- 76 unchanged lines hidden ---