]> git.baikalelectronics.ru Git - kernel.git/commit
kthread: make kthread_create() killable
authorTetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Tue, 12 Nov 2013 23:06:45 +0000 (15:06 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 13 Nov 2013 03:08:59 +0000 (12:08 +0900)
commit8d04f4974a227b7c1ccaa4262035ba58ce123f12
treee529b2b8f6a64889ec8c385cdca64f5c1d8e1c19
parent1353a2559c861fa1d19bdc326b77544cf13e3d78
kthread: make kthread_create() killable

Any user process callers of wait_for_completion() except global init
process might be chosen by the OOM killer while waiting for completion()
call by some other process which does memory allocation.  See
CVE-2012-4398 "kernel: request_module() OOM local DoS" can happen.

When such users are chosen by the OOM killer when they are waiting for
completion() in TASK_UNINTERRUPTIBLE, the system will be kept stressed
due to memory starvation because the OOM killer cannot kill such users.

kthread_create() is one of such users and this patch fixes the problem
for kthreadd by making kthread_create() killable - the same approach
used for fixing CVE-2012-4398.

Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Cc: Oleg Nesterov <oleg@redhat.com>
Acked-by: David Rientjes <rientjes@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
kernel/kthread.c