ptrace patch fails stress testing
Hi,
I've got a number of machines here that crash after installing the recent ptrace fix. The crash only occurrs when machines are highly stressed.
The problem appears to be that task->mm is dereferenced without looking to see if mm is NULL. e.g. in the sched.h in the is_dumpable() macro, we have task->mm->dumpable . I'm sitting in front of a KDB session and I'm clearly looking at task->mm which is NULL.
In my particular case, the crash is *always* in kernel/ptrace.c in access_process_vm(), (which is called when something tries to read /proc/pid/cmd_line). There seem to be a few other places in the kernel where task->mm is dererenced without checking mm, but these are rare (?) Most (?) places seem to make a point of checking for NULL before using mm.
Why, how and under what conditions this race condition occurs, I don't know. What the best fix is, I don't know.
I can try to just add a check for NULL, but I'd like someone to tell me that 'yes this is the right way to fix this.' (As opposed for trying to get some lock or trying to force the process to get paged in or whatever.)
BTW, this is an SMP machine, don't know if that matters.
Comments? Suggestions?
--linas
Quoted 3 lines · On Tue, Apr 01, 2003 at 12:22:56PM -0600, [email protected] wrote:
I've got a number of machines here that crash after installing the recent ptrace fix. The crash only occurrs when machines are highly stressed.
i've seen suspicious behaviour since installing the ptrace patch as well, but i couldn't really narrow it down to anything, as i have absolutely nothing of interest in logs. i just login during the day and notice that it had rebooted itself (uncleanly) over night at around 3-5am. this is when the disk-intensive nightly stuff happens, like some backups, updatedb, etc.
i was starting to suspect power issues, since i never see oopses in logs.
this is a dual athlon box.
Signature · 3 lines
____________________}John Flinchbaugh{______________________
| [email protected] http://www.hjsoft.com/~glynis/ |
~~Powered by Linux: Reboots are for hardware upgrades only~~Quoted 7 lines · On Tue, 2003-04-01 at 19:22, [email protected] wrote:
The problem appears to be that
task->mmis dereferenced without looking to see if mm is NULL. e.g. in thesched.hin theis_dumpable()macro, we havetask->mm->dumpable. I'm sitting in front of a KDB session and I'm clearly looking attask->mmwhich is NULL.
Why, how and under what conditions this race condition occurs, I don't know. What the best fix is, I don't know.
Zombie process. The patch checks ->mm but must also check ->mm != NULL first.
Quoted 2 lines
I can try to just add a check for NULL, but I'd like someone to tell me that 'yes this is the right way to fix this.'
It is I think.
Alan
Quoted 5 lines · On Tue, 2003-04-01 at 19:22, [email protected] wrote:
The problem appears to be that
task->mmis dereferenced without looking to see if mm is NULL. e.g. in thesched.hin theis_dumpable()macro, we havetask->mm->dumpable. I'm sitting in front of a KDB session and I'm clearly looking attask->mmwhich is NULL.
Sorry, KDB is an illegal kernel patch. Linus has spoken, the kernel does not need debuggers.
All right, assume a smiley there.