aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorOleg Nesterov <oleg@redhat.com>2010-05-26 14:43:03 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2010-05-27 09:12:45 -0700
commit7d64224217b53b23243fd2aa428001486f2a5da5 (patch)
tree23219e8d6d81e891fe2571e10be6feab7f81cd49 /Makefile
parentcall_usermodehelper: no need to unblock signals (diff)
downloadlinux-dev-7d64224217b53b23243fd2aa428001486f2a5da5.tar.xz
linux-dev-7d64224217b53b23243fd2aa428001486f2a5da5.zip
wait_for_helper: SIGCHLD from user-space can lead to use-after-free
1. wait_for_helper() calls allow_signal(SIGCHLD) to ensure the child can't autoreap itself. However, this means that a spurious SIGCHILD from user-space can set TIF_SIGPENDING and: - kernel_thread() or sys_wait4() can fail due to signal_pending() - worse, wait4() can fail before ____call_usermodehelper() execs or exits. In this case the caller may kfree(subprocess_info) while the child still uses this memory. Change the code to use SIG_DFL instead of magic "(void __user *)2" set by allow_signal(). This means that SIGCHLD won't be delivered, yet the child won't autoreap itsefl. The problem is minor, only root can send a signal to this kthread. 2. If sys_wait4(&ret) fails it doesn't populate "ret", in this case wait_for_helper() reports a random value from uninitialized var. With this patch sys_wait4() should never fail, but still it makes sense to initialize ret = -ECHILD so that the caller can notice the problem. Signed-off-by: Oleg Nesterov <oleg@redhat.com> Acked-by: Neil Horman <nhorman@tuxdriver.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'Makefile')
0 files changed, 0 insertions, 0 deletions