Bug 447 - sudo hangs - race condition if SIGCHLD is received immediately before we call select()
sudo hangs - race condition if SIGCHLD is received immediately before we call...
Status: RESOLVED FIXED
Product: Sudo
Classification: Unclassified
Component: Sudo
1.7.4
PC Linux
: low normal
Assigned To: Todd C. Miller
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2010-11-01 17:10 MDT by Ivan Zahariev (famzah)
Modified: 2011-03-03 09:53 MST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ivan Zahariev (famzah) 2010-11-01 17:10:32 MDT
Sometimes sudo enters in an endless blocking state and never exits. The called program finishes successfully, but is left in "zombie" state.

You have already tried to fix this by http://www.sudo.ws/repos/sudo/rev/99adc5ea7f0a . However, there's always a possibility that SIGCHLD arrives right after the "if" and just before the "select()". In order to fix this, the blocking select() must be used with a "timeout" (say one second or less). This bug is usually rarely encountered on busy systems.

More details on the bug and a proposed fix can be found at my blog article about it: http://blog.famzah.net/2010/11/01/sudo-hangs-and-leaves-the-executed-program-as-zombie/

P.S. Select() is used at least at two places, so they probably should both be fixed.
Comment 1 Todd C. Miller 2010-11-01 17:41:16 MDT
This should be fixed in sudo 1.7.5 which uses a pipe for signal delivery, eliminating the race condition.  I'll have a beta release of 1.7.5 out soon.
Comment 2 Todd C. Miller 2010-11-03 13:31:19 MDT
THe first beta of sudo 1.7.5 is out now.
http://www.sudo.ws/sudo/dist/beta/sudo-1.7.5b1.tar.gz
Comment 3 Todd C. Miller 2011-03-03 09:53:28 MST
Fixed in sudo 1.7.5 and 1.8.0.