Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 31 Jul 1998 16:35:00 +1000
From:      Bruce Evans <bde@zeta.org.au>
To:        freebsd-bugs@FreeBSD.ORG, woods@zeus.leitch.com
Cc:        FreeBSD-gnats-submit@FreeBSD.ORG
Subject:   Re: bin/7444: login exited on Signal 3, core dumped
Message-ID:  <199807310635.QAA18849@godzilla.zeta.org.au>

next in thread | raw e-mail | index | archive | help
> That's trivial to reproduce, and mostly harmless.  Just type a bogus
> user-id at the initial login prompt (i.e. the one given by getty), then
> a bogus password (eg. <CR>), and at the second login prompt type
> <CTRL-\> (i.e. the default quit character).  You should see the syslog
> message and a new getty prompt at the same time.  SIGQUIT is supposed to
> cause a core dump -- that's the whole idea behind having it.
> 
> The fix would be to have login trap and ignore SIGQUIT, but I don't know
> that it's necessary.  Such a fix should be wrapped in #ifndef DEBUG or
> something similar (IMO).

Non-broken versions of login ignore SIGQUIT throughout.  The -current
version ignores it for the getpass() call only, so CTRL-\ at the password
prompt dumps core but CTRL-\ at the login prompt doesn't.  The -"stable"
version ignores it beginning with the first call to getpass(), so CTRL-\
dumps core at all prompts except the first login prompt.

The history of this bug is farcial:
getpass.c 1.3 (1995/12/27):
    Don't block SIGINT in getpass().  This had no effect for login because
    login ignored SIGINT throughout, but other callers of getpass() may
    have been adversely affected.
getpass.c 1.4 (1995/12/31):
    Break SIGINT and SIGTSTP by catching them and doing some wrong things
    in the signal handler instead of ignoring them.  Break SIGQUIT and
    SIGSTOP by catching them instead of doing nothing with them.
RELENG_2_2 branch:
    Inherit bugs in getpass.c 1.5.
login.c 1.31 (1998/02/05):
    Work around one bug in getpass.c 1.4.  The signal handler for
    SIGINT/SIGQUIT turns on echo and sends another signal (to be handled
    in the caller's environment).  This is wrong if the caller is ignoring
    the signal - getpass() continues with the password being echoed.  Call
    getpass() with SIGINT/SIGQUIT defaulted, so that CTRL-C and CTRL-\
    terminate login.  Ignore SIGINT/SIGQUIT again after getpass() returns.
getpass.c 1.6 (1998/02/18):
    Fix 1.3 and 1.4 as a side effect of sort of switching to the NetBSD
    version.  Confuse the issue in the log message by referring to the
    cosmetic (on i386's) POSIXifications and not the bugs.
getpass.c 1.5.2.1 (1998/02/17):
    Merge 1.6 into -stable.  Log more confusion about POSIXification.
login.c 1.12.2.9 (1998/02/18):
    Merge just half the change from 1.31 into -"stable" together with
    one line of Kerberos changes and one line of style bugs.  This leaves
    SIGINT/SIGQUIT defaulted forever after the first call to getpass().

The future history should be:
login.c:
    Back out 1.31 and the buggy half of 1.12.2.9.  Who needs CTRL-\ to
    give core dumps in login?
getpass.c:
    Copy the NetBSD version or back out to 1.2 and POSIXify without leaving
    ugly vestiges of 1.4 (auto variables became static so that they could
    be abused by the signal handler ...).

Bruce

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199807310635.QAA18849>