]> git.karo-electronics.de Git - karo-tx-linux.git/commit
x86/mm: Handle mm_fault_error() in kernel space
authorAndrey Vagin <avagin@openvz.org>
Wed, 9 Mar 2011 23:22:23 +0000 (15:22 -0800)
committerAK <andi@firstfloor.org>
Thu, 31 Mar 2011 18:58:36 +0000 (11:58 -0700)
commit7838ead2b8f913f82d2b1d7f51e12d9ff1d6d936
treedc9205f435b2d75f1caf4e6c6a4e1c9873e193b2
parente5c30be3fa24a717a89a6ee9d0cd735e6002cdfd
x86/mm: Handle mm_fault_error() in kernel space

commit f86268549f424f83b9eb0963989270e14fbfc3de upstream.

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@openvz.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Andi Kleen <ak@linux.intel.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
LKML-Reference: <201103092322.p29NMNPH001682@imap1.linux-foundation.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
arch/x86/mm/fault.c