This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch] Fix crash on /proc/PID/stat race


On Thursday 27 May 2010 22:20:37, Jan Kratochvil wrote:
> On Thu, 27 May 2010 21:00:26 +0200, Pedro Alves wrote:
> > Why are we trying to get at the core if we know the process
> > is gone?  Since the process is already waited for, I'm surprised
> > the fopen succeeded in the first place.  On a couple of quick tests,
> > I always see fopen failing.  It sounds like a kernel bug.  Can't we
> > just skip the core_of_thread call for
> > TARGET_WAITKING_EXITED|TARGET_WAITKING_SIGNALLED?
> 
> An additional patch like this one?

Yes, exactly.  Thanks.

> It is IMO not correct for GDB to crash on unexpected /proc/** content.

Okay, I don't mind your original patch that much.  I think that it
adds a bit of complexity by being paranoid.  As long as a process
hasn't been waited for, the /stat entry should exist, even if the
process is zombie.

Anyway, if you want to put that one in, it's okay, but please don't
lose the comment below:

> -  p = strchr (p, ')') + 2; /* skip ")" and a whitespace. */
> +  if (p != NULL)
> +    p = strchr (p, ')');

and I don't think the fopen race comment makes sense
as is anymore.

Also, IWBN if gdbserver was fixed similarly, but I won't ask
you to do that.  :-)

-- 
Pedro Alves


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]