[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200720082657.GC6612@redhat.com>
Date: Mon, 20 Jul 2020 10:26:58 +0200
From: Oleg Nesterov <oleg@...hat.com>
To: Jiri Slaby <jirislaby@...nel.org>
Cc: Christian Brauner <christian.brauner@...ntu.com>,
christian@...uner.io, "Eric W. Biederman" <ebiederm@...ssion.com>,
Linux kernel mailing list <linux-kernel@...r.kernel.org>,
Peter Zijlstra <peterz@...radead.org>,
Mel Gorman <mgorman@...e.de>,
Dave Jones <davej@...emonkey.org.uk>,
Paul Gortmaker <paul.gortmaker@...driver.com>
Subject: Re: 5.8-rc*: kernel BUG at kernel/signal.c:1917
Peter,
Let me add another note. TASK_TRACED/TASK_STOPPED was always protected by
->siglock. In particular, ttwu(__TASK_TRACED) must be always called with
->siglock held. That is why ptrace_freeze_traced() assumes it can safely
do s/TASK_TRACED/__TASK_TRACED/ under spin_lock(siglock).
Can this change race with
if (signal_pending_state(prev->state, prev)) {
prev->state = TASK_RUNNING;
}
in __schedule() ? Hopefully not, signal-state is protected by siglock too.
So I think this logic was correct even if it doesn't look nice. But "doesn't
look nice" is true for the whole ptrace code ;)
On 07/20, Oleg Nesterov wrote:
>
> On 07/20, Jiri Slaby wrote:
> >
> > You tackled it, we cherry-picked dbfb089d360 to our kernels. Ccing more
> > people.
>
> Thanks... so with this patch __schedule() does
>
> prev_state = prev->state;
>
> ...
>
> if (!preempt && prev_state && prev_state == prev->state) {
> if (signal_pending_state(prev_state, prev)) {
> prev->state = TASK_RUNNING;
> } else {
>
> and ptrace_freeze_traced() can change ->state in between. This means
> that this task can return from __schedule() with ->state != RUNNING,
> this can explain BUG_ON(task_is_stopped_or_traced) in do_notify_parent()
> you reported.
>
> Oleg.
Powered by blists - more mailing lists