+++ This bug was initially created as a clone of Bug #168434 +++ Description of problem: Login tries to set a timeout in main(), login.c, @ line 334: signal(SIGALRM, timedout); alarm((unsigned int)timeout); signal(SIGQUIT, SIG_IGN); signal(SIGINT, SIG_IGN); If any restartable system call is entered, such system calls can block indefinitely and will NOT be interrupted by the SIGALRM . Login needs to call: siginterrupt(SIGALRM,1); In order for restartable system calls to be interrupted. This problem turned out to be one root cause of mgetty bug 167830, where the login program was run for a terminal for which it did not have read or write permission (another problem). In that case, login hung until manually killed by the administrator in its tcsetattr(...) call at login.c, line 460: /* Kill processes left on this tty */ tcsetattr(0,TCSAFLUSH,&ttt); This may possibly be a kernel bug - instead of returning EIO / EPERM, the kernel continously sends an infinite number of SIGTTOU signals to the process . An 80MB strace log file was generated, consisting of >1,000,000 repetitions of : 4964 11:00:18 ioctl(0, SNDCTL_TMR_CONTINUE or TCSETSF, {c_iflags=0x106, c_oflags=0x1805, c_cflags=0x800000be, c_lflags=0x3b, c_line=0, c_cc="\x03\x1c\x7f\x15\x04\x00\x01\x00\x11\x13\x1a\x00\x12\x0f\x17\x16\x00\x00\x00"}) = ? ERESTARTSYS (To be restarted) 4964 11:00:18 --- SIGTTOU (Stopped (tty output)) @ 0 (0) --- 4964 11:00:18 --- SIGTTOU (Stopped (tty output)) @ 0 (0) --- Login's alarm signal handler DOES get the SIGALRM after the 60 second timeout, and timedout() is called; but then timedout2 calls ioctl(0, TCSETA, &ti), which also blocks, because the ioctl(0, TCSETSF...) of tcsetattr is in progress, and the exit() call of timedout2 is never reached, and the tcsetattr call is restarted. This whole situation could be avoided by calling : siginterrupt(SIGALRM,1) immediately after the signal(SIGALRM, timedout) I can reproduce this problem at will on Rawhide and RHEL-4 . Version-Release number of selected component (if applicable): ALL - util-linux-2.13-0.3.pre2 (Rawhide) util-linux-2.12a (RHEL-4) How reproducible: 100% Steps to Reproduce: Cause login to be enter any restartable system call which then blocks. For instance: if login is exec'd with its stdin/stdout directed to a terminal for which it does not have read/write access, the tcsetattr call will be restarted indefinitely. Actual results: Login hangs indefinitely Expected results: Any blocking system call should be interrupted by the login timeout. Login should exit with an error. Additional info: mgetty configuration to reproduce this problem available upon request. -- Additional comment from kzak on 2005-10-03 10:31 EST -- Jason, thanks for perfect description of problem! (also bug #168436) It will be fixed it in FC5, FC4 and added to RHEL proposed list.
This issue is on Red Hat Engineering's list of planned work items for the upcoming Red Hat Enterprise Linux 3.8 release. Engineering resources have been assigned and barring unforeseen circumstances, Red Hat intends to include this item in the 3.8 release.
An advisory has been issued which should help the problem described in this bug report. This report is therefore being closed with a resolution of ERRATA. For more information on the solution and/or where to find the updated files, please follow the link below. You may reopen this bug report if the solution does not work for you. http://rhn.redhat.com/errata/RHBA-2006-0456.html