Re: Interesting race condition...

Roger Luethi
2004-07-30T08:38:29Z

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