Bug 422 - sudo process freezed and overloaded system after sshd is timeout.
sudo process freezed and overloaded system after sshd is timeout.
Status: RESOLVED FIXED
Product: Sudo
Classification: Unclassified
Component: Sudo
1.7.3
PC FreeBSD
: low normal
Assigned To: Todd C. Miller
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2010-07-26 07:07 MDT by Igor
Modified: 2010-08-02 15:00 MDT (History)
0 users

See Also:


Attachments
Handle ENXIO error from read/write of pty (1.34 KB, patch)
2010-07-26 13:07 MDT, Todd C. Miller
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Igor 2010-07-26 07:07:36 MDT
When user logged into remote server over ssh and used sudo (enabled log_input, log_output) with:
$sudo -i -u test  (where test is another user of remote system)

And do nothing for some time, sshd exited with "Timeout, client not responding"
(timeout depends on sshd_config's : ClientAliveInterval 20,ClientAliveCountMax 2)

It's ok, but after that sudo freezed and overloaded system:

$ps -axwu | grep sudo
root   8807  4.0  0.4  4344  2000  p0- R     1:19PM   0:17.48 sudo -i -u test
test   8809  0.0  0.4  4612  2196  p1  Is    1:19PM   0:00.01 sudo -i -u test

$top
ast pid:  8833;  load averages:  0.67,  0.82,  0.79    up 0+01:46:33  13:20:51
31 processes:  2 running, 29 sleeping
CPU:  1.9% user,  0.0% nice, 96.2% system,  1.9% interrupt,  0.0% idle
Mem: 18M Active, 20M Inact, 47M Wired, 184K Cache, 52M Buf, 405M Free
Swap: 851M Total, 851M Free

  PID USERNAME   THR PRI NICE   SIZE    RES STATE    TIME   WCPU COMMAND
 8807 root         1  96    0  4344K  2000K RUN      0:41  0.00% sudo
 1332 root         1  44    0  3532K  1832K RUN      0:02  0.00% top
  840 root         1  44    0 19152K 10624K select   0:02  0.00% httpd

freezed sudo process may be killed by kill -9 8809.

sudo process losts parent process:
$ps -axj 8809
USER   PID  PPID  PGID   SID JOBC STAT  TT       TIME COMMAND
test  8809  8807  8809  8809    0 Is    p1    0:00.01 sudo -i -u test
$ps -axj 8807
USER   PID  PPID  PGID   SID JOBC STAT  TT       TIME COMMAND
root  8807     1  8807  8882    0 R     p0-   7:39.81 sudo -i -u test


sudoers:
User_Alias SUDO_GRP = %su_users
Defaults:SUDO_GRP log_input,log_output
Runas_Alias TARGET_USERS = test
SUDO_GRP ALL = (TARGET_USERS) ALL

PS. systems freebsd 7.x with sudo 1.7.3 and 1.7.4b4.
PPS. It happends when sshd user have bash as login shell (tested with 4.0.35,4.1.7) (sh or tcsh not affected). Ie, sshd user have /usr/local/bin/bash and test user have /bin/sh.
PPPS. Without new sudo log functions (log_input, log_output), sudo exits correctly after sshd timeout.
Comment 1 Todd C. Miller 2010-07-26 13:07:18 MDT
Created attachment 282 [details]
Handle ENXIO error from read/write of pty

Thanks for the detailed bug report.  I was able to reproduce the problem and have attached a patch to fix it.  This will also be part of sudo 1.7.4b5 which will be released shortly.
Comment 2 Igor 2010-07-27 02:46:00 MDT
Confirmed. Issue resolved in 1.7.4b5.
Comment 3 Todd C. Miller 2010-08-02 15:00:09 MDT
Closing, sudo 1.7.4 is out now.