Re: WARNING in get_signal
From: Oleg Nesterov
Date: Thu Oct 15 2020 - 08:49:39 EST
On 10/06, Oleg Nesterov wrote:
>
> I still do not see a good fix. I am crying ;)
Sorry for delay... Finally I think I have a simple and clean fix.
We can leave ptrace_init_task() alone and fix task_join_group_stop().
I need to test it a bit and write the changelog, do you see any problem
in the patch below?
(TODO: SIGCONT should clear JOBCTL_STOP_SIGMASK, needs another patch)
Oleg.
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -391,16 +391,17 @@ static bool task_participate_group_stop(struct task_struct *task)
void task_join_group_stop(struct task_struct *task)
{
+ struct signal_struct *sig = current->signal;
+ unsigned long mask = current->jobctl & JOBCTL_STOP_SIGMASK;
+
+ if (sig->group_stop_count) {
+ sig->group_stop_count++;
+ mask |= JOBCTL_STOP_CONSUME;
+ } else if (!(sig->flags & SIGNAL_STOP_STOPPED))
+ return;
+
/* Have the new thread join an on-going signal group stop */
- unsigned long jobctl = current->jobctl;
- if (jobctl & JOBCTL_STOP_PENDING) {
- struct signal_struct *sig = current->signal;
- unsigned long signr = jobctl & JOBCTL_STOP_SIGMASK;
- unsigned long gstop = JOBCTL_STOP_PENDING | JOBCTL_STOP_CONSUME;
- if (task_set_jobctl_pending(task, signr | gstop)) {
- sig->group_stop_count++;
- }
- }
+ task_set_jobctl_pending(task, mask | JOBCTL_STOP_PENDING);
}
/*