Bug 29103

Summary: make (1) dump core while processing ^C from console with malloc's "recursive call." diagnostic.
Product: Base System Reporter: andrew <andrew>
Component: binAssignee: Hartmut Brandt <harti>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: 5.0-CURRENT   
Hardware: Any   
OS: Any   

Description andrew 2001-07-20 11:00:04 UTC
Got this backtrace:

pyvo# gdb /usr/obj/usr/src/usr.bin/make/make -c make.core
GNU gdb 4.18
Copyright 1998 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386-unknown-freebsd"...
Core was generated by `make'.
Program terminated with signal 6, Abort trap.
#0  0x8062010 in kill ()
(gdb) bt
#0  0x8062010 in kill ()
#1  0x806fc96 in abort () at /usr/src/lib/libc/../libc/stdlib/abort.c:70
#2  0x806ea85 in wrterror (p=0x807636f "recursive call.\n")
    at /usr/src/lib/libc/../libc/stdlib/malloc.c:295
#3  0x806eaa4 in wrtwarning (p=0x807636f "recursive call.\n")
    at /usr/src/lib/libc/../libc/stdlib/malloc.c:303
#4  0x806f999 in free (ptr=0x0)
    at /usr/src/lib/libc/../libc/stdlib/malloc.c:1099
#5  0x80498b8 in CompatInterrupt (signo=2)
    at /usr/src/usr.bin/make/compat.c:118
#6  0xbfbfffac in ?? ()
#7  0x806f9ad in free (ptr=0x80bff00)
    at /usr/src/lib/libc/../libc/stdlib/malloc.c:1103
#8  0x805a470 in Var_Subst (var=0x0,
    str=0x80a4c00 "PORTOBJFORMAT=${PORTOBJFORMAT} ${INSTALL_MACROS} CURDIR=${MASTERDIR} DISTDIR=${DISTDIR}  WRKDIR=${WRKDIR} WRKSRC=${WRKSRC} PATCHDIR=${PATCHDIR}  SCRIPTDIR=${SCRIPTDIR} FILESDIR=${FILESDIR}  PORTSDIR=$"...,
    ctxt=0x80a9980, undefErr=0) at /usr/src/usr.bin/make/var.c:2444
#9  0x805943f in Var_Parse (
    str=0x80a4c00 "PORTOBJFORMAT=${PORTOBJFORMAT} ${INSTALL_MACROS} CURDIR=${MASTERDIR} DISTDIR=${DISTDIR}  WRKDIR=${WRKDIR} WRKSRC=${WRKSRC} PATCHDIR=${PATCHDIR}  SCRIPTDIR=${SCRIPTDIR} FILESDIR=${FILESDIR}  PORTSDIR=$"...,
    ctxt=0x80a9980, err=0, lengthPtr=0xbfbfe940, freePtr=0xbfbfe944)
    at /usr/src/usr.bin/make/var.c:1718
#10 0x805a39c in Var_Subst (var=0x0,
    str=0x80ab801 "@if [ -f ${SCRIPTDIR}/${.TARGET:S/^real-/pre-/} ]; then  cd ${.CURDIR} && ${SETENV} ${SCRIPTS_ENV", ctxt=0x80a9980, undefErr=0)
    at /usr/src/usr.bin/make/var.c:2398
#11 0x80499d3 in CompatRunCommand (cmdp=0x80ab801, gnp=0x80a9980)
    at /usr/src/usr.bin/make/compat.c:213
#12 0x805aab4 in Lst_ForEachFrom (l=0x80acee0, ln=0x80831d0,
    proc=0x8049984 <CompatRunCommand>, d=0x80a9980)
    at /usr/src/usr.bin/make/lst.lib/lstForEachFrom.c:94
#13 0x805aa71 in Lst_ForEach (l=0x80acee0, proc=0x8049984 <CompatRunCommand>,
    d=0x80a9980) at /usr/src/usr.bin/make/lst.lib/lstForEach.c:73
#14 0x8049f4b in CompatMake (gnp=0x80a9980, pgnp=0x80a9980)
    at /usr/src/usr.bin/make/compat.c:505
#15 0x804a241 in Compat_Run (targs=0x809a520)
    at /usr/src/usr.bin/make/compat.c:701
#16 0x8051156 in main (argc=3, argv=0xbfbff7ac)
    at /usr/src/usr.bin/make/main.c:871
#17 0x8048135 in _start (arguments=0xbfbff8a8 "make")
    at /usr/src/lib/csu/i386-elf/crt1.c:96
(gdb)

How-To-Repeat: Don't know how this repitable.

cd /usr/ports/graphics/png
make

hit ^C quickly before make print's any output

I have copy of core + program with debuging symbols for future examining
Comment 1 Hartmut Brandt freebsd_committer freebsd_triage 2004-08-13 12:03:15 UTC
Responsible Changed
From-To: freebsd-bugs->harti

I take this. The reason for the core is quite obvious from 
the backtrace: the interrupt handler CompatInterrupt call free() 
which it shouldn't do. In general interrupt handlers are allowed 
to call only a small number of functions. This will require some work, 
though.
Comment 2 Hartmut Brandt freebsd_committer freebsd_triage 2004-11-15 12:58:30 UTC
State Changed
From-To: open->closed

Fixed in RELENG_6 by not doing the interrupt processing from the 
signal handler.