lkml.org 
[lkml]   [2000]   [Aug]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subjectsleep_on races in 2.4.0-test7-pre6
Date
The attached patch shows up three places where sleep_on_interruptible() is
used unsafely. I think it would be useful to include it at least briefly to
locate other abusers.

One could cause kswapd to miss wake-ups, which is not fatal but hardly
ideal. (mm/vmscan.c:604)

One could cause a user to miss events which arrive just as they're trying
to read /proc/sys/acpi/event (drivers/acpi/driver.c:162)

The third could cause the acpi thread to fail to wake up and service a
queued task (drivers/acpi/driver.c:333)


Index: kernel/sched.c
===================================================================
RCS file: /inst/cvs/linux/kernel/sched.c,v
retrieving revision 1.4.2.35
diff -u -r1.4.2.35 sched.c
--- kernel/sched.c 2000/08/05 16:53:08 1.4.2.35
+++ kernel/sched.c 2000/08/09 13:19:02
@@ -785,10 +785,18 @@
__remove_wait_queue(q, &wait); \
wq_write_unlock_irqrestore(&q->lock,flags);

+#define SLEEP_ON_LOCKCHECK \
+ if (current->lock_depth == -1) { \
+ printk(KERN_WARNING __FUNCTION__ " called without BKL held!\n"); \
+ BUG(); \
+ }
+
void interruptible_sleep_on(wait_queue_head_t *q)
{
SLEEP_ON_VAR

+ SLEEP_ON_LOCKCHECK
+
current->state = TASK_INTERRUPTIBLE;

SLEEP_ON_HEAD
@@ -800,6 +808,8 @@
{
SLEEP_ON_VAR

+ SLEEP_ON_LOCKCHECK
+
current->state = TASK_INTERRUPTIBLE;

SLEEP_ON_HEAD
@@ -813,6 +823,8 @@
{
SLEEP_ON_VAR

+ SLEEP_ON_LOCKCHECK
+
current->state = TASK_UNINTERRUPTIBLE;

SLEEP_ON_HEAD
@@ -824,6 +836,8 @@
{
SLEEP_ON_VAR

+ SLEEP_ON_LOCKCHECK
+
current->state = TASK_UNINTERRUPTIBLE;

SLEEP_ON_HEAD

--
dwmw2


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

\
 
 \ /
  Last update: 2005-03-22 12:37    [W:0.072 / U:14.588 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site