Expect goes crazy... spinning cpu in kill_pgrp

Dave Korn dave.korn.cygwin@googlemail.com
Wed Oct 21 14:44:00 GMT 2009

Dave Korn wrote:

>   So, one thing I don't know is: is it wrong for kill_pgrp to want to know
> about the ctty of an execed process, or should that data be moved into the
> leading PINFO_REDIR_SIZE part?

  Looking at the code some more, I guess in many places the answer would be to
chase the redirection to the real pid, but in this instance, where we are
going to loop over all pids anyway, there's no need; we can just skip entries

  This same problem appears to affect most loops over all winpids; they
attempt to access members beyond 'exitcode' without guarding against it being
a small redirection pinfo.  I haven't seen the problem arise anywhere else
yet, expect seems to be particularly good at tripping it in this one
particular place, but it looks like it would happen if you try and nice (or
even just get the priority of) one of these execed process stubs/redirectors.
 And trying to access the /proc filesystem of one of these pids could be
expected to lead to hilarity.

  I'm experimenting with this.  It's not a full solution, it needs to do
something a bit cleverer about /proc, but it should avoid the crashes.  So no
changelog etc.; this is only FYI right now.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: guard-pinfo-access-against-execed-pids.diff
Type: text/x-c
Size: 2813 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin-developers/attachments/20091021/d492d99c/attachment.bin>

More information about the Cygwin-developers mailing list