Bug 552 - sudo 1.8.4 hangs on AIX 6.1 if no TTY is available
sudo 1.8.4 hangs on AIX 6.1 if no TTY is available
Status: RESOLVED FIXED
Product: Sudo
Classification: Unclassified
Component: Sudo
1.8.4
IBM AIX
: low high
Assigned To: Todd C. Miller
: 557 (view as bug list)
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-04-09 16:28 MDT by Paul Donohue
Modified: 2012-05-24 10:37 MDT (History)
1 user (show)

See Also:


Attachments
Patch to open /proc/ppid/fd/[0-2] in non-blocking mode (419 bytes, patch)
2012-04-10 09:12 MDT, Todd C. Miller
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Paul Donohue 2012-04-09 16:28:42 MDT
On AIX 6.1, sudo 1.8.4 will always hang (even just 'sudo -V' or 'sudo -h' hangs) if it is run without a TTY (for example, if it is run from a cron job or from a script executed using 'ssh -T ...').

This seems to be caused by the following change:
http://www.sudo.ws/repos/sudo/rev/b9dfce12af85

Here is a stack trace from a hung sudo process:
#0  0xd013087c in open () from /usr/lib/libc.a(shr.o)
#1  0xd013019c in open64 () from /usr/lib/libc.a(shr.o)
#2  0x1000b430 in get_process_ttyname () at ./ttyname.c:168
#3  0x1000952c in get_user_info.constprop.11 () at ./sudo.c:469
#4  0x10000578 in main (argc=2, argv=<incomplete type>, envp=<incomplete type>) at  _start_ :198

It looks like calling open() on /proc/<parent PID>/fd/1 under AIX simply hangs forever.
Comment 1 Todd C. Miller 2012-04-10 09:12:59 MDT
Created attachment 339 [details]
Patch to open /proc/ppid/fd/[0-2] in non-blocking mode

I'm unable to reproduce this behavior on AIX 6.1 but opening the file in non-blocking mode should help.  Please try the attached patch.  If that doesn't help I have a test program I'll ask you to run under truss.
Comment 2 Todd C. Miller 2012-04-10 16:59:26 MDT
Can you try the current beta version of sudo 1.8.5?  I've rewritten the tty fallback code for systems with an SVR4-style /proc (like AIX).  See http://www.sudo.ws/devel.html
Comment 3 Paul Donohue 2012-04-16 13:20:06 MDT
Sorry for the delay in responding.

I just tried 1.8.5rc1, and everything seems to work fine.  I have not tried the non-blocking patch ... it looks like you've replaced all that code now anyway.

Thank you very much!
Comment 4 Todd C. Miller 2012-05-24 10:37:27 MDT
*** Bug 557 has been marked as a duplicate of this bug. ***