[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200720131747.GD119549@hirez.programming.kicks-ass.net>
Date: Mon, 20 Jul 2020 15:17:47 +0200
From: peterz@...radead.org
To: Valentin Schneider <valentin.schneider@....com>
Cc: Oleg Nesterov <oleg@...hat.com>, Jiri Slaby <jirislaby@...nel.org>,
Christian Brauner <christian.brauner@...ntu.com>,
christian@...uner.io, "Eric W. Biederman" <ebiederm@...ssion.com>,
Linux kernel mailing list <linux-kernel@...r.kernel.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
On Mon, Jul 20, 2020 at 01:20:26PM +0100, Valentin Schneider wrote:
> On 20/07/20 12:26, peterz@...radead.org wrote:
> > + /*
> > + * We must re-load prev->state in case ttwu_remote() changed it
> > + * before we acquired rq->lock.
> > + */
> > + tmp_state = prev->state;
> > + if (unlikely(prev_state != tmp_state)) {
> > + /*
> > + * ptrace_{,un}freeze_traced() think it is cool to change
> > + * ->state around behind our backs between TASK_TRACED and
> > + * __TASK_TRACED.
> > + *
> > + * This is safe because this, as well as any __TASK_TRACED
> > + * wakeups are under siglock.
> > + *
> > + * For any other case, a changed prev_state must be to
> > + * TASK_RUNNING, such that when it blocks, the load has
> > + * happened before the smp_mb().
> > + *
> > + * Also see the comment with deactivate_task().
> > + */
> > + SCHED_WARN_ON(tmp_state && (prev_state & __TASK_TRACED &&
> > + !(tmp_state & __TASK_TRACED)));
> > +
>
> IIUC if the state changed and isn't TASK_RUNNING it *has* to have
> __TASK_TRACED, so can't that be
>
> SCHED_WARN_ON(tmp_state && !(tmp_state & __TASK_TRACED));
Suppose task->state == TASK_UNINTERRUPTIBLE, and task != current, and
then someone goes and does task->state = __TASK_TRACED.
That is, your statement is correct given the current code, but we also
want to verify no new code comes along and does something 'creative'.
Or is the heat getting to me?
Powered by blists - more mailing lists