[merged] x86-mm-handle-mm_fault_error-in-kernel-space.patch removed from -mm tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The patch titled
     x86/mm: handle mm_fault_error() in kernel space
has been removed from the -mm tree.  Its filename was
     x86-mm-handle-mm_fault_error-in-kernel-space.patch

This patch was dropped because it was merged into mainline or a subsystem tree

The current -mm tree may be found at http://userweb.kernel.org/~akpm/mmotm/

------------------------------------------------------
Subject: x86/mm: handle mm_fault_error() in kernel space
From: Andrey Vagin <avagin@xxxxxxxxxx>

mm_fault_error() should not execute oom-killer, if page fault occurs in
kernel space.  E.g.  in copy_from_user/copy_to_user.

This would happen if we find ourselves in OOM on a copy_to_user(), or a
copy_from_user() which faults.

Without this patch, the kernels hangs up in copy_from_user, because OOM
killer sends SIG_KILL to current process, but it can't handle a signal
while in syscall, then the kernel returns to copy_from_user, reexcute
current command and provokes page_fault again.

With this patch the kernel return -EFAULT from copy_from_user.

The code, which checks that page fault occurred in kernel space, has been
copied from do_sigbus.

This situation is handled by the same way on powerpc, xtensa, tile, ...

Signed-off-by: Andrey Vagin <avagin@xxxxxxxxxx>
Cc: Ingo Molnar <mingo@xxxxxxx>
Cc: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
Cc: "H. Peter Anvin" <hpa@xxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
---

 arch/x86/mm/fault.c |    7 +++++++
 1 file changed, 7 insertions(+)

diff -puN arch/x86/mm/fault.c~x86-mm-handle-mm_fault_error-in-kernel-space arch/x86/mm/fault.c
--- a/arch/x86/mm/fault.c~x86-mm-handle-mm_fault_error-in-kernel-space
+++ a/arch/x86/mm/fault.c
@@ -827,6 +827,13 @@ mm_fault_error(struct pt_regs *regs, uns
 	       unsigned long address, unsigned int fault)
 {
 	if (fault & VM_FAULT_OOM) {
+		/* Kernel mode? Handle exceptions or die: */
+		if (!(error_code & PF_USER)) {
+			up_read(&current->mm->mmap_sem);
+			no_context(regs, error_code, address);
+			return;
+		}
+
 		out_of_memory(regs, error_code, address);
 	} else {
 		if (fault & (VM_FAULT_SIGBUS|VM_FAULT_HWPOISON|
_

Patches currently in -mm which might be from avagin@xxxxxxxxxx are

linux-next.patch
oom-prevent-unnecessary-oom-kills-or-kernel-panics.patch
oom-skip-zombies-when-iterating-tasklist.patch
fs-devpts-inodec-correctly-check-d_alloc_name-return-code-in-devpts_pty_new.patch
fs-devpts_pty_new-return-enomem-if-dentry-allocation-failed.patch

--
To unsubscribe from this list: send the line "unsubscribe mm-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Kernel Newbies FAQ]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Photo]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux