[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220413195612.GC2762@worktop.programming.kicks-ass.net>
Date: Wed, 13 Apr 2022 21:56:12 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: Oleg Nesterov <oleg@...hat.com>
Cc: rjw@...ysocki.net, mingo@...nel.org, vincent.guittot@...aro.org,
dietmar.eggemann@....com, rostedt@...dmis.org, mgorman@...e.de,
ebiederm@...ssion.com, bigeasy@...utronix.de,
Will Deacon <will@...nel.org>, linux-kernel@...r.kernel.org,
tj@...nel.org, linux-pm@...r.kernel.org
Subject: Re: [PATCH 2/5] sched,ptrace: Fix ptrace_check_attach() vs PREEMPT_RT
On Wed, Apr 13, 2022 at 09:20:53PM +0200, Peter Zijlstra wrote:
> On Wed, Apr 13, 2022 at 08:59:10PM +0200, Oleg Nesterov wrote:
>
>
> > + // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
> > + // wrong, needs siglock
> > + current->jobctl &= ~JOBCTL_TRACED_XXX;
> > + wake_up_bit(¤t->jobctl, ~JOBCTL_TRACED_XXX_BIT);
> __wake_up_common_lock()
> spin_lock_irqsave()
> current_save_and_set_rtlock_wait_state();
>
> > + if (wait_on_bit(&task->jobctl, JOBCTL_TRACED_XXX_BIT, TASK_KILLABLE))
> > + return -EINTR;
> > + // now that the tracee cleared JOBCTL_TRACED_XXX_BIT
> > + // wait_task_inactive() should succeed or fail "really soon".
> > + if (!wait_task_inactive(child, __TASK_TRACED))
> > + return ret;
>
>
> *whoopsie* ?
>
> > preempt_enable_no_resched();
> > freezable_schedule();
> > cgroup_leave_frozen(true);
Something that might work; since there's only the one ptracer, is to
instead do something like:
current->jobctl &= ~JOBCTL_TRACED_XXX; // siglock
if (current->ptrace)
wake_up_process(current->parent);
preempt_enable_no_resched();
schedule();
vs
for (;;) {
set_current_state(TASK_UNINTERRUPTIBLE);
if (!(p->jobctl & JOBCTL_TRACED_XXX))
break;
schedule();
}
__set_current_state(TASK_RUNNING);
if (!wait_task_inactive(...))
ptrace_detach() needs some additional magic as well I think, but this
might just work.
Powered by blists - more mailing lists