Bug 7444 - login exited on Signal 3, core dumped
Summary: login exited on Signal 3, core dumped
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 2.2.7-STABLE
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 1998-07-30 12:10 UTC by Ruslan Ermilov
Modified: 1998-07-31 12:15 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ruslan Ermilov 1998-07-30 12:10:00 UTC
I have a five dial-in lines. Sometimes login core dumps:

Jul 29 15:10:15 relay /kernel: pid 12953 (login), uid 0: exited on signal 3 (core dumped)

I have recompiled login statically, and installed it non-stripped.
Here is GDB output of the latest two cores:

Core was generated by `login'.
Program terminated with signal 3, Quit.
#0  0x326ae in read ()
(gdb) bt
#0  0x326ae in read ()
#1  0x321db in __sread ()
#2  0x244f7 in __srefill ()
#3  0x243dd in __srget ()
#4  0xbee0 in getpass ()
#5  0x5981 in skey_getpass ()
#6  0x1ab9 in main (argc=2, argv=0xefbfde80)
    at /usr/src/usr.bin/login/login.c:450

Core was generated by `login'.
Program terminated with signal 3, Quit.
#0  0x326ae in read ()
(gdb) bt
#0  0x326ae in read ()
#1  0x321db in __sread ()
#2  0x244f7 in __srefill ()
#3  0x243dd in __srget ()
#4  0xbee0 in getpass ()
#5  0x5981 in skey_getpass ()
#6  0x1ab9 in main (argc=2, argv=0xefbfde7c)
    at /usr/src/usr.bin/login/login.c:450
Comment 1 woods 1998-07-30 17:05:07 UTC
[ On Thu, July 30, 1998 at 13:59:31 (+0300), Ruslan Ermilov wrote: ]
> Subject: bin/7444: login exited on Signal 3, core dumped
>
> I have a five dial-in lines. Sometimes login core dumps:
> 
> Jul 29 15:10:15 relay /kernel: pid 12953 (login), uid 0: exited on signal 3 (core dumped)

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

-- 
							Greg A. Woods

+1 416 443-1734      VE3TCP      <gwoods@acm.org>      <robohack!woods>
Planix, Inc. <woods@planix.com>; Secrets of the Weird <woods@weird.com>
Comment 2 Bruce Evans 1998-07-31 07:35:00 UTC
> 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
Comment 3 Bruce Evans freebsd_committer freebsd_triage 1998-07-31 12:15:24 UTC
State Changed
From-To: open->closed

Fixed in -current and 2.2.