Possible race in interruptible_sleep_on_timeout()

Richard B. Johnson (root@chaos.analogic.com)
Wed, 16 May 2001 11:55:12 -0400 (EDT)


I lifted the following kernel-thread code from
../linux/drivers/net/8139too.c, just added a procedure to call.

static int gpib_thread(void *unused)
{
unsigned long timeout;

daemonize();
spin_lock_irq(&current->sigmask_lock);
sigemptyset(&current->blocked);
recalc_sigpending(current);
spin_unlock_irq(&current->sigmask_lock);
memcpy(current->comm, task_name, sizeof(task_name));
for(;;)
{
timeout = 0x02;
do {
timeout = interruptible_sleep_on_timeout(&info->twait, timeout);
} while (!signal_pending(current)&&(timeout > 0));
if(signal_pending(current))
up_and_exit(&info->quit, 0);
tinker(info->what_to_do);
}
}

It has been observed that, given the conditions of little or no
CPU activity except `top`, procedure "tinker()" will never get
executed because interruptible_sleep_on_timeout returns the
same timeout value it received.

This is on kernel version 2.4.1. Maybe this race has been found and
fixed?

Cheers,
Dick Johnson

Penguin : Linux version 2.4.1 on an i686 machine (799.53 BogoMips).

"Memory is like gasoline. You use it up when you are running. Of
course you get it all back when you reboot..."; Actual explanation
obtained from the Micro$oft help desk.

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