Re: Interesting race condition...

From: Roger Luethi
Date: Fri Jul 30 2004 - 03:39:51 EST


On Fri, 30 Jul 2004 10:27:26 +0200, Marc Ballarin wrote:
> > --- linux-2.6.8-rc2-bk1/fs/proc/base.c.orig 2004-07-30 01:43:23.535967505 +0200
> > +++ linux-2.6.8-rc2-bk1/fs/proc/base.c 2004-07-30 01:43:27.428303752 +0200
> > @@ -329,6 +329,8 @@ static int proc_pid_cmdline(struct task_
> > struct mm_struct *mm = get_task_mm(task);
> > if (!mm)
> > goto out;
> > + if (!mm->arg_end)
> > + goto out; /* Shh! No looking before we're done */
> >
> > len = mm->arg_end - mm->arg_start;
> >
>
> Yes, this seems to fix it. First I replaced "goto out" with a printk, and
> the printks matched the occurence of the bug.
> However, I got multiple printks per bug (between 2 and 7). Is that
> supposed to happen?

Every time we proceed through proc_pid_cmdline with mm->arg_end == 0 is a
bug. AFAICT anyway. Whether you see an "occurence of the bug" depends on
how you measure it. Of course you are wecome to add more printks following
the code path to see how and when it propagates to where you are catching
it.

Roger
-
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/