patch-2.1.127 linux/arch/i386/mm/fault.c
Next file: linux/arch/m68k/atari/time.c
Previous file: linux/arch/i386/kernel/setup.c
Back to the patch index
Back to the overall index
- Lines: 41
- Date:
Tue Oct 27 10:18:35 1998
- Orig file:
v2.1.126/linux/arch/i386/mm/fault.c
- Orig date:
Fri Oct 9 13:27:05 1998
diff -u --recursive --new-file v2.1.126/linux/arch/i386/mm/fault.c linux/arch/i386/mm/fault.c
@@ -156,7 +156,14 @@
if (!(vma->vm_flags & (VM_READ | VM_EXEC)))
goto bad_area;
}
- handle_mm_fault(tsk, vma, address, write);
+
+ /*
+ * If for any reason at all we couldn't handle the fault,
+ * make sure we exit gracefully rather than endlessly redo
+ * the fault.
+ */
+ if (!handle_mm_fault(tsk, vma, address, write))
+ goto do_sigbus;
/*
* Did it hit the DOS screen memory VA from vm86 mode?
@@ -243,4 +250,24 @@
}
die("Oops", regs, error_code);
do_exit(SIGKILL);
+
+/*
+ * We ran out of memory, or some other thing happened to us that made
+ * us unable to handle the page fault gracefully.
+ */
+do_sigbus:
+ up(&mm->mmap_sem);
+
+ /*
+ * Send a sigbus, regardless of whether we were in kernel
+ * or user mode.
+ */
+ tsk->tss.cr2 = address;
+ tsk->tss.error_code = error_code;
+ tsk->tss.trap_no = 14;
+ force_sig(SIGBUS, tsk);
+
+ /* Kernel mode? Handle exceptions or die */
+ if (!(error_code & 4))
+ goto no_context;
}
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov