From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from out01.mta.xmission.com ([166.70.13.231]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nrSZ9-004Bvj-V5 for linux-um@lists.infradead.org; Wed, 18 May 2022 22:54:53 +0000 From: "Eric W. Biederman" Date: Wed, 18 May 2022 17:53:46 -0500 Message-Id: <20220518225355.784371-7-ebiederm@xmission.com> In-Reply-To: <871qwq5ucx.fsf_-_@email.froward.int.ebiederm.org> References: <871qwq5ucx.fsf_-_@email.froward.int.ebiederm.org> MIME-Version: 1.0 Subject: [PATCH 07/16] signal: Wake up the designated parent List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-um" Errors-To: linux-um-bounces+geert=linux-m68k.org@lists.infradead.org To: linux-kernel@vger.kernel.org Cc: rjw@rjwysocki.net, Oleg Nesterov , mingo@kernel.org, vincent.guittot@linaro.org, dietmar.eggemann@arm.com, rostedt@goodmis.org, mgorman@suse.de, bigeasy@linutronix.de, Will Deacon , tj@kernel.org, linux-pm@vger.kernel.org, Peter Zijlstra , Richard Weinberger , Anton Ivanov , Johannes Berg , linux-um@lists.infradead.org, Chris Zankel , Max Filippov , linux-xtensa@linux-xtensa.org, Kees Cook , Jann Horn , linux-ia64@vger.kernel.org, Robert OCallahan , Kyle Huey , Richard Henderson , Ivan Kokshaysky , Matt Turner , Jason Wessel , Daniel Thompson , Douglas Anderson , Douglas Miller , Michael Ellerman , Benjamin Herrenschmidt , Paul Mackerras , "Eric W. Biederman" Today if a process is ptraced only the ptracer will ever be woken up in wait, if the parent is waiting with __WNOTHREAD. Update the code so that the real_parent can also be woken up with __WNOTHREAD even when the code is ptraced. Fixes: 75b95953a569 ("job control: Add @for_ptrace to do_notify_parent_cldstop()") Signed-off-by: "Eric W. Biederman" --- kernel/exit.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/kernel/exit.c b/kernel/exit.c index f072959fcab7..0e26f73c49ac 100644 --- a/kernel/exit.c +++ b/kernel/exit.c @@ -1421,26 +1421,35 @@ static int ptrace_do_wait(struct wait_opts *wo, struct task_struct *tsk) return 0; } +struct child_wait_info { + struct task_struct *p; + struct task_struct *parent; +}; + static int child_wait_callback(wait_queue_entry_t *wait, unsigned mode, int sync, void *key) { struct wait_opts *wo = container_of(wait, struct wait_opts, child_wait); - struct task_struct *p = key; + struct child_wait_info *info = key; - if (!eligible_pid(wo, p)) + if (!eligible_pid(wo, info->p)) return 0; - if ((wo->wo_flags & __WNOTHREAD) && wait->private != p->parent) - return 0; + if ((wo->wo_flags & __WNOTHREAD) && (wait->private != info->parent)) + return 0; return default_wake_function(wait, mode, sync, key); } void __wake_up_parent(struct task_struct *p, struct task_struct *parent) { + struct child_wait_info info = { + .p = p, + .parent = parent, + }; __wake_up_sync_key(&parent->signal->wait_chldexit, - TASK_INTERRUPTIBLE, p); + TASK_INTERRUPTIBLE, &info); } static bool is_effectively_child(struct wait_opts *wo, bool ptrace, -- 2.35.3 _______________________________________________ linux-um mailing list linux-um@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-um