Tcl Source Code

View Ticket
Login
Ticket UUID: 463b7a93be0a2ddd3484d776b83e2b8ab6f63f0c
Title: Tcl_Unload, make gdb-test, segmentation fault
Type: Bug Version: 8.7
Submitter: pooryorick Created on: 2021-05-14 18:48:45
Subsystem: - New Builtin Commands Assigned To: nobody
Priority: 5 Medium Severity: Minor
Status: Closed Last Modified: 2022-04-18 17:29:02
Resolution: Fixed Closed By: jan.nijtmans
    Closed on: 2022-04-18 17:29:02
Description: (text/x-fossil-wiki)
Up to at least commit [45fa0ff557cfdb12], the command,

<code><verbatim>
make TESTFLAGS='-file "unload.test winPipe.test"' gdb-test
</verbatim></code>

, produces the results below.  The problem is that in some cases, although the
library is unloaded its record is not removed from the per-interp list of
loaded libraries, and subsequent calls to <code>TclGetLoadedLibraries()</code>
attempt to acces the record, whose storage has already been freed.


<code><verbatim>
Program received signal SIGSEGV, Segmentation fault.
0x00007ffff7a2d5e2 in __strcmp_sse2_unaligned () from /usr/lib/libc.so.6
(gdb) bt
#0  0x00007ffff7a2d5e2 in __strcmp_sse2_unaligned () from /usr/lib/libc.so.6
#1  0x00007ffff7eda1d0 in TclGetLoadedLibraries (interp=0x555555584a70, targetName=0x7ffff7fc3550 <tclEmptyString> "", prefix=0x555555711b10 "Tcltest") at /path/to/src/generic/tclLoad.c:1092
#2  0x00007ffff7dbbd7b in InfoLoadedCmd (dummy1681=0x0, interp=0x555555584a70, objc=3, objv=0x55555565c940) at /path/to/src/generic/tclCmdIL.c:1703
#3  0x00007ffff7d9f195 in Dispatch (data=0x55555574b478, interp=0x555555584a70, dummy4779=0) at /path/to/src/generic/tclBasic.c:4817
#4  0x00007ffff7d9f21b in TclNRRunCallbacks (interp=0x555555584a70, result=0, rootPtr=0x0) at /path/to/src/generic/tclBasic.c:4857
#5  0x00007ffff7d9eadd in Tcl_EvalObjv (interp=0x555555584a70, objc=3, objv=0x5555555c3a20, flags=2097168) at /path/to/src/generic/tclBasic.c:4576
#6  0x00007ffff7da11b0 in TclEvalEx (interp=0x555555584a70, 
    script=0x5555555e0cb0 "# all.tcl --\n#\n# This file contains a top-level script to run all of the Tcl\n# tests.  Execute it by invoking \"source all.tcl\" when running tcltest\n# in this directory.\n#\n# Copyright © 1998-1999 Scri"..., numBytes=1012, flags=0, line=26, clNextOuter=0x0, 
    outerScript=0x5555555e0cb0 "# all.tcl --\n#\n# This file contains a top-level script to run all of the Tcl\n# tests.  Execute it by invoking \"source all.tcl\" when running tcltest\n# in this directory.\n#\n# Copyright © 1998-1999 Scri"...) at /path/to/src/generic/tclBasic.c:5728
#7  0x00007ffff7ecc0e9 in Tcl_FSEvalFileEx (interp=0x555555584a70, pathPtr=0x5555555cbc60, encodingName=0x7ffff7f7d94c "utf-8") at /path/to/src/generic/tclIOUtil.c:1782
#8  0x00007ffff7edabfe in Tcl_MainEx (argc=-1, argv=0x7fffffffe2f8, appInitProc=0x5555555563bc <Tcl_AppInit>, interp=0x555555584a70) at /path/to/src/generic/tclMain.c:399
#9  0x00005555555563b5 in main (argc=6, argv=0x7fffffffe2c8) at /path/to/src/unix/tclAppInit.c:91
</verbatim></code>
User Comments: jan.nijtmans added on 2021-05-16 09:26:37: (text/x-fossil-wiki)
Should this be backported to 8.6?

pooryorick added on 2021-05-15 09:13:03: (text/x-fossil-wiki)
Merged to core-8-branch in [7ffa017f9b76bf5d].

pooryorick added on 2021-05-14 18:52:59: (text/x-fossil-wiki)
Fixed in [343281a570d47661].