[PATCH 07/16] signal: Wake up the designated parent
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
- To: linux-kernel@xxxxxxxxxxxxxxx
- Subject: [PATCH 07/16] signal: Wake up the designated parent
- From: "Eric W. Biederman" <ebiederm@xxxxxxxxxxxx>
- Date: Wed, 18 May 2022 17:53:46 -0500
- Cc: rjw@xxxxxxxxxxxxx, Oleg Nesterov <oleg@xxxxxxxxxx>, mingo@xxxxxxxxxx, vincent.guittot@xxxxxxxxxx, dietmar.eggemann@xxxxxxx, rostedt@xxxxxxxxxxx, mgorman@xxxxxxx, bigeasy@xxxxxxxxxxxxx, Will Deacon <will@xxxxxxxxxx>, tj@xxxxxxxxxx, linux-pm@xxxxxxxxxxxxxxx, Peter Zijlstra <peterz@xxxxxxxxxxxxx>, Richard Weinberger <richard@xxxxxx>, Anton Ivanov <anton.ivanov@xxxxxxxxxxxxxxxxxx>, Johannes Berg <johannes@xxxxxxxxxxxxxxxx>, linux-um@xxxxxxxxxxxxxxxxxxx, Chris Zankel <chris@xxxxxxxxxx>, Max Filippov <jcmvbkbc@xxxxxxxxx>, linux-xtensa@xxxxxxxxxxxxxxxx, Kees Cook <keescook@xxxxxxxxxxxx>, Jann Horn <jannh@xxxxxxxxxx>, linux-ia64@xxxxxxxxxxxxxxx, Robert OCallahan <roc@xxxxxxxxx>, Kyle Huey <khuey@xxxxxxxxx>, Richard Henderson <rth@xxxxxxxxxxxxxxx>, Ivan Kokshaysky <ink@xxxxxxxxxxxxxxxxxxxx>, Matt Turner <mattst88@xxxxxxxxx>, Jason Wessel <jason.wessel@xxxxxxxxxxxxx>, Daniel Thompson <daniel.thompson@xxxxxxxxxx>, Douglas Anderson <dianders@xxxxxxxxxxxx>, Douglas Miller <dougmill@xxxxxxxxxxxxxxxxxx>, Michael Ellerman <mpe@xxxxxxxxxxxxxx>, Benjamin Herrenschmidt <benh@xxxxxxxxxxxxxxxxxxx>, Paul Mackerras <paulus@xxxxxxxxx>, "Eric W. Biederman" <ebiederm@xxxxxxxxxxxx>
- In-reply-to: <871qwq5ucx.fsf_-_@email.froward.int.ebiederm.org>
- References: <871qwq5ucx.fsf_-_@email.froward.int.ebiederm.org>
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" <ebiederm@xxxxxxxxxxxx>
---
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
[Index of Archives]
[Linux Kernel]
[Sparc Linux]
[DCCP]
[Linux ARM]
[Yosemite News]
[Linux SCSI]
[Linux x86_64]
[Linux for Ham Radio]