* [PATCH 1/4] for 2.6.18, revert "Drop tasklist lock in do_sched_setscheduler"
@ 2006-08-19 19:30 Oleg Nesterov
2006-08-19 19:43 ` Oleg Nesterov
0 siblings, 1 reply; 2+ messages in thread
From: Oleg Nesterov @ 2006-08-19 19:30 UTC (permalink / raw)
To: Andrew Morton
Cc: Thomas Gleixner, Ingo Molnar, Steven Rostedt, Nick Piggin,
Linus Torvalds, linux-kernel
sched_setscheduler() looks at ->signal->rlim[]. It is unsafe do dereference
->signal unless tasklist_lock or ->siglock is held (or p == current). We pin
the task structure, but this can't prevent from release_task()->__exit_signal()
which sets ->signal = NULL.
Restore tasklist_lock across the setscheduler call.
Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru>
--- 2.6.18-rc4/kernel/sched.c~1_revert 2006-08-19 17:50:56.000000000 +0400
+++ 2.6.18-rc4/kernel/sched.c 2006-08-19 18:15:15.000000000 +0400
@@ -4162,10 +4162,8 @@ do_sched_setscheduler(pid_t pid, int pol
read_unlock_irq(&tasklist_lock);
return -ESRCH;
}
- get_task_struct(p);
- read_unlock_irq(&tasklist_lock);
retval = sched_setscheduler(p, policy, &lparam);
- put_task_struct(p);
+ read_unlock_irq(&tasklist_lock);
return retval;
}
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH 1/4] for 2.6.18, revert "Drop tasklist lock in do_sched_setscheduler"
2006-08-19 19:30 [PATCH 1/4] for 2.6.18, revert "Drop tasklist lock in do_sched_setscheduler" Oleg Nesterov
@ 2006-08-19 19:43 ` Oleg Nesterov
0 siblings, 0 replies; 2+ messages in thread
From: Oleg Nesterov @ 2006-08-19 19:43 UTC (permalink / raw)
To: Andrew Morton
Cc: Thomas Gleixner, Ingo Molnar, Steven Rostedt, Nick Piggin,
Linus Torvalds, linux-kernel
On 08/19, Oleg Nesterov wrote:
>
> sched_setscheduler() looks at ->signal->rlim[]. It is unsafe do dereference
> ->signal unless tasklist_lock or ->siglock is held (or p == current). We pin
> the task structure, but this can't prevent from release_task()->__exit_signal()
> which sets ->signal = NULL.
See the testcase below, 2.6.18-rc4 oopses. The stable tree is ok, the problem
was introduced during 2.6.18 development.
Oleg.
#!/usr/bin/perl
pipe R, W;
if (fork) {
while (sysread R, $_, 4) {
do {
syscall 156, unpack('i', $_), 1, pack('i', 1);
} while $! == 1; # EPERM
}
} else {
wait while fork;
syswrite W, pack 'i', $$;
}
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2006-08-19 15:19 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-08-19 19:30 [PATCH 1/4] for 2.6.18, revert "Drop tasklist lock in do_sched_setscheduler" Oleg Nesterov
2006-08-19 19:43 ` Oleg Nesterov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome