Re: [2.6.2] Badness in futex_wait revisited

From: Andrew Morton
Date: Tue Feb 17 2004 - 00:28:40 EST


Rusty Russell <rusty@xxxxxxxxxxxxxxx> wrote:
>
> - if (likely(!list_empty(&q.list)))
> + if (likely(!list_empty(&q.list))) {
> + current->flags |= PF_FUTEX_DEBUG;
> time = schedule_timeout(time);
> + current->flags &= ~PF_FUTEX_DEBUG;
> + }
> __set_current_state(TASK_RUNNING);
>
> /*
> diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .6375-linux-2.6.3-rc3-bk1/kernel/sched.c .6375-linux-2.6.3-rc3-bk1.updated/kernel/sched.c
> --- .6375-linux-2.6.3-rc3-bk1/kernel/sched.c 2004-02-15 18:17:22.000000000 +1100
> +++ .6375-linux-2.6.3-rc3-bk1.updated/kernel/sched.c 2004-02-17 12:02:24.000000000 +1100
> @@ -658,6 +658,14 @@ static int try_to_wake_up(task_t * p, un
> long old_state;
> runqueue_t *rq;
>
> + if ((p->flags & PF_FUTEX_DEBUG)
> + && !(current->flags & PF_FUTEX_DEBUG)) {
> + printk("%s %i waking %s: %i %i\n",
> + current->comm, (int)in_interrupt(),
> + p->comm, p->tgid, p->pid);
> + WARN_ON(1);
> + }
> +

If the schedule_timeout() expires then this wakeup will occur from within
the timer interrupt - current could point at any old thing. We will get
bogus warnings.


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/