aboutsummaryrefslogtreecommitdiffstats
path: root/mm/memory.c
diff options
context:
space:
mode:
authorHugh Dickins <hugh.dickins@tiscali.co.uk>2009-12-14 20:59:04 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2009-12-15 11:53:17 -0500
commitd99be1a8ecf377c2c9b3372d36411ad6547bbd4c (patch)
tree844a156da951783a46f9cfd0e66858eae12e5f54 /mm/memory.c
parenta70caa8ba48f21f46d3b4e71b6b8d14080bbd57a (diff)
mm: sigbus instead of abusing oom
When do_nonlinear_fault() realizes that the page table must have been corrupted for it to have been called, it does print_bad_pte() and returns ... VM_FAULT_OOM, which is hard to understand. It made some sense when I did it for 2.6.15, when do_page_fault() just killed the current process; but nowadays it lets the OOM killer decide who to kill - so page table corruption in one process would be liable to kill another. Change it to return VM_FAULT_SIGBUS instead: that doesn't guarantee that the process will be killed, but is good enough for such a rare abnormality, accompanied as it is by the "BUG: Bad page map" message. And recent HWPOISON work has copied that code into do_swap_page(), when it finds an impossible swap entry: fix that to VM_FAULT_SIGBUS too. Signed-off-by: Hugh Dickins <hugh.dickins@tiscali.co.uk> Cc: Izik Eidus <ieidus@redhat.com> Cc: Andrea Arcangeli <aarcange@redhat.com> Cc: Nick Piggin <npiggin@suse.de> Reviewed-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com> Cc: Rik van Riel <riel@redhat.com> Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com> Cc: Andi Kleen <andi@firstfloor.org> Reviewed-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> Reviewed-by: Wu Fengguang <fengguang.wu@intel.com> Reviewed-by: Minchan Kim <minchan.kim@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/memory.c')
-rw-r--r--mm/memory.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/mm/memory.c b/mm/memory.c
index 543c446bf4ed..1c9dc46da3db 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -2527,7 +2527,7 @@ static int do_swap_page(struct mm_struct *mm, struct vm_area_struct *vma,
2527 ret = VM_FAULT_HWPOISON; 2527 ret = VM_FAULT_HWPOISON;
2528 } else { 2528 } else {
2529 print_bad_pte(vma, address, orig_pte, NULL); 2529 print_bad_pte(vma, address, orig_pte, NULL);
2530 ret = VM_FAULT_OOM; 2530 ret = VM_FAULT_SIGBUS;
2531 } 2531 }
2532 goto out; 2532 goto out;
2533 } 2533 }
@@ -2923,7 +2923,7 @@ static int do_nonlinear_fault(struct mm_struct *mm, struct vm_area_struct *vma,
2923 * Page table corrupted: show pte and kill process. 2923 * Page table corrupted: show pte and kill process.
2924 */ 2924 */
2925 print_bad_pte(vma, address, orig_pte, NULL); 2925 print_bad_pte(vma, address, orig_pte, NULL);
2926 return VM_FAULT_OOM; 2926 return VM_FAULT_SIGBUS;
2927 } 2927 }
2928 2928
2929 pgoff = pte_to_pgoff(orig_pte); 2929 pgoff = pte_to_pgoff(orig_pte);