Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2023-06-30
14:21 • Closed ticket [26960060d7]: lseq-3.14 triggers use-after-free plus 5 other c... artifact: 9982911209 user: griffin
2023-06-28
07:20
Fix [26960060d7]: lseq-3.14 triggers use-after-free check-in: 68c0bd3f02 user: jan.nijtmans tags: core-8-branch
2023-06-27
22:00 • Ticket [26960060d7] lseq-3.14 triggers use-after-free status still Open with... artifact: 491b671f56 user: chrstphrchvz
2023-06-25
21:40 • Ticket [26960060d7]: 3 changes artifact: dd91be0a05 user: griffin
20:17 • Ticket [26960060d7]: 4 changes artifact: 602f81cebb user: chrstphrchvz
19:58 • New ticket [26960060d7]. artifact: dbcfab36ed user: chrstphrchvz

lseq-3.14 triggers use-after-free

Closed26960060d75e13b704f7953bc160850e4890e6a0Created 3 years agoUpdated 3 years ago
Descriptionwiki2023-06-25 19:58:54
Occurs after tests are run. Does not seem to occur on 64-bit. Introduced by [97cc33cd20fd]. AddressSanitizer (-DPURIFY -fsanitize=address) output:
==11283==ERROR: AddressSanitizer: heap-use-after-free on address 0xad4221b4 at pc 0xb60e0de8 bp 0xbfd96a48 sp 0xbfd96a38
READ of size 4 at 0xad4221b4 thread T0
    #0 0xb60e0de7 in Tcl_AppendObjToObj tcl87/generic/tclStringObj.c:1790
    #1 0xb618eaab in Tcl_GetVariableFullName tcl87/generic/tclVar.c:4975
    #2 0xb61923a3 in TclDeleteNamespaceVars tcl87/generic/tclVar.c:5472
    #3 0xb5fde359 in TclTeardownNamespace tcl87/generic/tclNamesp.c:1199
    #4 0xb56fe6c4 in DeleteInterpProc tcl87/generic/tclBasic.c:1913
    #5 0xb607f9f6 in Tcl_Release tcl87/generic/tclPreserve.c:228
    #6 0xb5fd68f3 in FreeMainInterp tcl87/generic/tclMain.c:923
    #7 0xb5d6b689 in InvokeExitHandlers tcl87/generic/tclEvent.c:936
    #8 0xb5d6b82d in Tcl_Finalize tcl87/generic/tclEvent.c:1208
    #9 0xb5d6b752 in Tcl_Exit tcl87/generic/tclEvent.c:993
    #10 0xb5793245 in Tcl_ExitObjCmd tcl87/generic/tclCmdAH.c:1145
    #11 0xb571b89b in Dispatch tcl87/generic/tclBasic.c:4996
    #12 0xb571bca1 in TclNRRunCallbacks tcl87/generic/tclBasic.c:5036
    #13 0xb572e044 in TclEvalObjEx tcl87/generic/tclBasic.c:6610
    #14 0xb572deeb in Tcl_EvalObjEx tcl87/generic/tclBasic.c:6591
    #15 0xb5fd4df0 in Tcl_MainEx tcl87/generic/tclMain.c:609
    #16 0x52b5f3 in main tcl87/unix/tclAppInit.c:94
    #17 0xb4e25628  (/usr/lib/libc.so.6+0x1f628)
    #18 0xb4e256ec in __libc_start_main (/usr/lib/libc.so.6+0x1f6ec)
    #19 0x52b3fa in _start (tcl87/unix/tcltest+0x483fa)

0xad4221b4 is located 4 bytes inside of 24-byte region [0xad4221b0,0xad4221c8) freed by thread T0 here: #0 0xb78c0f61 in __interceptor_free /build/gcc/src/gcc/libsanitizer/asan/asan_malloc_linux.cpp:52 #1 0xb56be305 in TclpFree tcl87/generic/tclAlloc.c:722 #2 0xb6007745 in TclFreeObj tcl87/generic/tclObj.c:1483 #3 0xb61802da in ArrayForLoopCallback tcl87/generic/tclVar.c:3347 #4 0xb571bca1 in TclNRRunCallbacks tcl87/generic/tclBasic.c:5036 #5 0xb57185b2 in Tcl_EvalObjv tcl87/generic/tclBasic.c:4755 #6 0xb5729408 in TclEvalEx tcl87/generic/tclBasic.c:5912 #7 0xb5f6c446 in Tcl_FSEvalFileEx tcl87/generic/tclIOUtil.c:1782 #8 0xb5fd2ec7 in Tcl_MainEx tcl87/generic/tclMain.c:405 #9 0x52b5f3 in main tcl87/unix/tclAppInit.c:94 #10 0xb4e25628 (/usr/lib/libc.so.6+0x1f628)

previously allocated by thread T0 here: #0 0xb78c2315 in __interceptor_malloc /build/gcc/src/gcc/libsanitizer/asan/asan_malloc_linux.cpp:69 #1 0xb56be2df in TclpAlloc tcl87/generic/tclAlloc.c:699 #2 0xb5778714 in Tcl_Alloc tcl87/generic/tclCkalloc.c:1037 #3 0xb601469a in Tcl_NewWideIntObj tcl87/generic/tclObj.c:3333 #4 0xb56c2e6c in TclArithSeriesObjIndex tcl87/generic/tclArithSeries.c:451 #5 0xb5fbca28 in SetListFromAny tcl87/generic/tclListObj.c:3273 #6 0xb6006573 in Tcl_ConvertToType tcl87/generic/tclObj.c:986 #7 0xb60092f6 in SetDuplicatePureObj tcl87/generic/tclObj.c:1652 #8 0xb600a009 in TclDuplicatePureObj tcl87/generic/tclObj.c:1701 #9 0xb617debc in ArrayForNRCmd tcl87/generic/tclVar.c:3224 #10 0xb571b89b in Dispatch tcl87/generic/tclBasic.c:4996 #11 0xb571bca1 in TclNRRunCallbacks tcl87/generic/tclBasic.c:5036 #12 0xb57185b2 in Tcl_EvalObjv tcl87/generic/tclBasic.c:4755 #13 0xb5729408 in TclEvalEx tcl87/generic/tclBasic.c:5912 #14 0xb5f6c446 in Tcl_FSEvalFileEx tcl87/generic/tclIOUtil.c:1782 #15 0xb5fd2ec7 in Tcl_MainEx tcl87/generic/tclMain.c:405 #16 0x52b5f3 in main tcl87/unix/tclAppInit.c:94 #17 0xb4e25628 (/usr/lib/libc.so.6+0x1f628)

Referenced by1
chrstphrchvz Ticket [26960060d7]: 4 changes [History diff]2023-06-25 20:17:21
griffin Ticket [26960060d7]: 3 changes [History diff]2023-06-25 21:40:18
chrstphrchvzwiki2023-06-27 22:00:25

I have now observed this error on 64-bit; not sure why I did not observe it earlier. So the error is not specific to 32-bit.

This is fixed by backporting [e45cee0c53]; the test lseq-convertToList would trigger a similar error immediately rather than when exiting. So this is a duplicate of [5ee010988248] but for 8.7.

griffinmarkdown2023-06-30 14:21:39

Fixed with [68c0bd3f02] Thanks Jan!

Log in (anonymous is fine) to add a comment.