Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1247860

Re: [PATCH 0/1] kmod: don't run async usermode helper as a child of kworker thread

From Oleg Nesterov <oleg@redhat.com>
Newsgroups linux.kernel
Subject Re: [PATCH 0/1] kmod: don't run async usermode helper as a child of kworker thread
Date 2015-10-15 16:50 +0200
Message-ID <qjS0W-Yf-13@gated-at.bofh.it> (permalink)
References <qjzrj-7fk-11@gated-at.bofh.it> <qjS0W-Yf-15@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


call_usermodehelper_exec_sync() does fork() + wait() with "unignored"
SIGCHLD.  What we have missed is that this worker thread can have other
children previously forked by call_usermodehelper_exec_work() without
UMH_WAIT_PROC.  If such a child exits in between it becomes a zombie and
nobody can reap it (unless/until this worker thread exits too).

Change the !UMH_WAIT_PROC case to use CLONE_PARENT.

Note: this is only first step. All PF_KTHREAD tasks, even created by
kernel_thread() should have ->parent == kthreadd by default.

Signed-off-by: Oleg Nesterov <oleg@redhat.com>
---
 kernel/kmod.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/kernel/kmod.c b/kernel/kmod.c
index da98d05..e7185a2 100644
--- a/kernel/kmod.c
+++ b/kernel/kmod.c
@@ -327,9 +327,13 @@ static void call_usermodehelper_exec_work(struct work_struct *work)
 		call_usermodehelper_exec_sync(sub_info);
 	} else {
 		pid_t pid;
-
+		/*
+		 * Use CLONE_PARENT to reparent it to kthreadd; we do not
+		 * want to pollute current->children, in particular because
+		 * call_usermodehelper_exec_sync() assumes it is empty.
+		 */
 		pid = kernel_thread(call_usermodehelper_exec_async, sub_info,
-				    SIGCHLD);
+				    CLONE_PARENT | SIGCHLD);
 		if (pid < 0) {
 			sub_info->retval = pid;
 			umh_complete(sub_info);
-- 
2.4.3


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 0/1] Revert "kmod: handle UMH_WAIT_PROC from system unbound  workqueue" Oleg Nesterov <oleg@redhat.com> - 2015-10-14 21:00 +0200
  Re: [PATCH 0/1] kmod: don't run async usermode helper as a child  of kworker thread Oleg Nesterov <oleg@redhat.com> - 2015-10-15 16:50 +0200
    Re: [PATCH 0/1] kmod: don't run async usermode helper as a child of  kworker thread Frederic Weisbecker <fweisbec@gmail.com> - 2015-10-15 18:00 +0200
      Re: [PATCH 0/1] kmod: don't run async usermode helper as a child  of kworker thread Oleg Nesterov <oleg@redhat.com> - 2015-10-15 18:40 +0200
        Re: [PATCH 0/1] kmod: don't run async usermode helper as a child of  kworker thread Frederic Weisbecker <fweisbec@gmail.com> - 2015-10-15 19:00 +0200
          Re: [PATCH 0/1] kmod: don't run async usermode helper as a child  of kworker thread Oleg Nesterov <oleg@redhat.com> - 2015-10-15 20:00 +0200
  [PATCH 0/1] kmod: don't run async usermode helper as a child of  kworker thread Oleg Nesterov <oleg@redhat.com> - 2015-10-15 16:50 +0200
    [PATCH v2 1/1] kmod: don't run async usermode helper as a child of  kworker thread Oleg Nesterov <oleg@redhat.com> - 2015-10-15 20:00 +0200

csiph-web