Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 170381 - RHEL3: login's timeout can fail - needs to call siginterrupt(SIGALRM,1)
Summary: RHEL3: login's timeout can fail - needs to call siginterrupt(SIGALRM,1)
Alias: None
Product: Red Hat Enterprise Linux 3
Classification: Red Hat
Component: util-linux
Version: 3.0
Hardware: All
OS: Linux
Target Milestone: ---
Assignee: Karel Zak
QA Contact: Ben Levenson
Whiteboard: RHEL3U7NAK
Depends On:
Blocks: RHEL3U8CanFix
TreeView+ depends on / blocked
Reported: 2005-10-11 08:23 UTC by Karel Zak
Modified: 2007-11-30 22:07 UTC (History)
0 users

Fixed In Version: RHBA-2006-0456
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2006-07-20 14:46:02 UTC
Target Upstream Version:

Attachments (Terms of Use)

System ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2006:0456 normal SHIPPED_LIVE util-linux and mount bug fix update 2006-07-19 18:48:00 UTC

Description Karel Zak 2005-10-11 08:23:53 UTC
+++ 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:

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 */

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,
= ? 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

This whole situation could be avoided by calling :
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:

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 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.

Comment 6 Bob Johnson 2006-04-11 16:28:26 UTC
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.

Comment 10 Red Hat Bugzilla 2006-07-20 14:46:02 UTC
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.

Note You need to log in before you can comment on or make changes to this bug.