Skip to content

SIGABORT on freeing lua_cpath in search_module_path() #67

@ligurio

Description

@ligurio
LUA_CPATH="/home/sergeyb/sources/lua-c-api-tests/build/luzer/build/luzer/?.so;;" LUA_PATH="/home/sergeyb/sources/lua-c-api-tests/build/luzer/source/?/init.lua;/home/sergeyb/sources/lua-c-api-tests/tests/lapi/?.lua;;" gdb --args /home/sergeyb/sources/lua-c-api-tests/build/lua-master/source/lua /home/sergeyb/sources/lua-c-api-tests/tests/lapi/builtin_concat_test.lua
...

luajit-gdb.py initialization is postponed until libluajit objfile is loaded
luajit-gdb.py initialization is postponed until libluajit objfile is loaded
free(): invalid pointer
Program received signal SIGABRT, Aborted.
__pthread_kill_implementation (no_tid=0, signo=6, threadid=<optimized out>) at ./nptl/pthread_kill.c:44
warning: 44     ./nptl/pthread_kill.c: No such file or directory
(gdb) bt                                                                                                              
#0  __pthread_kill_implementation (no_tid=0, signo=6, threadid=<optimized out>) at ./nptl/pthread_kill.c:44           
#1  __pthread_kill_internal (signo=6, threadid=<optimized out>) at ./nptl/pthread_kill.c:78                           
#2  __GI___pthread_kill (threadid=<optimized out>, signo=signo@entry=6) at ./nptl/pthread_kill.c:89                   
#3  0x00007ffff784527e in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26                                 
#4  0x00007ffff78288ff in __GI_abort () at ./stdlib/abort.c:79                                                        
#5  0x00007ffff78297b6 in __libc_message_impl (fmt=fmt@entry=0x7ffff79ce8d7 "%s\n")                                   
    at ../sysdeps/posix/libc_fatal.c:134                                                                              
#6  0x00007ffff78a8ff5 in malloc_printerr (str=str@entry=0x7ffff79cc672 "free(): invalid pointer")                    
    at ./malloc/malloc.c:5772                                                                                         
#7  0x00007ffff78ab38c in _int_free (av=<optimized out>, p=<optimized out>, have_lock=0) at ./malloc/malloc.c:4507    
#8  0x00007ffff78addae in __GI___libc_free (mem=0x7ffff49fe2ec) at ./malloc/malloc.c:3398                             
#9  0x00007ffff48691ad in search_module_path (so_path=0x7ffffffea270 "./libcustom_mutator.so",                        
    so_name=0x7ffff49fe1f6 "libcustom_mutator.so", len=4096)                                                          
    at /home/sergeyb/sources/lua-c-api-tests/build/luzer/source/luzer/luzer.c:163                                     
#10 0x00007ffff4868eda in init () at /home/sergeyb/sources/lua-c-api-tests/build/luzer/source/luzer/luzer.c:186       
#11 0x00007ffff4869561 in luaopen_luzer_impl (L=0x51b000000608)   
    at /home/sergeyb/sources/lua-c-api-tests/build/luzer/source/luzer/luzer.c:615
#12 0x0000555555736fc4 in precallC (L=0x51b000000608, func=0x519000000710, status=2,                               
    f=0x7ffff4869550 <luaopen_luzer_impl>) at ldo.c:644
#13 0x0000555555738612 in luaD_precall (L=0x51b000000608, func=0x519000000710, nresults=1) at ldo.c:713
#14 0x00005555557396be in ccall (L=0x51b000000608, func=0x519000000710, nResults=1, inc=65537) at ldo.c:753
#15 0x0000555555739856 in luaD_callnoyield (L=0x51b000000608, func=0x519000000710, nResults=1) at ldo.c:773 
#16 0x00005555557141ed in lua_callk (L=0x51b000000608, nargs=2, nresults=1, ctx=0, k=0x0) at lapi.c:1053    
#17 0x0000555555850f63 in ll_require (L=0x51b000000608) at loadlib.c:664             
#18 0x0000555555736fc4 in precallC (L=0x51b000000608, func=0x5190000006b0, status=0, f=0x555555850e20 <ll_require>)
    at ldo.c:644
#19 0x00005555557384da in luaD_precall (L=0x51b000000608, func=0x5190000006b0, nresults=-1) at ldo.c:710            
#20 0x00005555557396be in ccall (L=0x51b000000608, func=0x5190000006b0, nResults=-1, inc=65537) at ldo.c:753
#21 0x0000555555739856 in luaD_callnoyield (L=0x51b000000608, func=0x5190000006b0, nResults=-1) at ldo.c:773         
#22 0x0000555555715759 in f_call (L=0x51b000000608, ud=0x7ffff61154a0) at lapi.c:1071
#23 0x000055555573006f in luaD_rawrunprotected (L=0x51b000000608, f=0x555555715670 <f_call>, ud=0x7ffff61154a0)
    at ldo.c:166                                                                                                      
#24 0x000055555573cb0f in luaD_pcall (L=0x51b000000608, func=0x555555715670 <f_call>, u=0x7ffff61154a0, old_top=304, 
    ef=0) at ldo.c:1077
#25 0x0000555555714ea6 in lua_pcallk (L=0x51b000000608, nargs=1, nresults=-1, errfunc=0, ctx=0,        
    k=0x55555582a230 <finishpcall>) at lapi.c:1097                                                                    
#26 0x00005555558285ba in luaB_pcall (L=0x51b000000608) at lbaselib.c:486                                  
#27 0x0000555555736fc4 in precallC (L=0x51b000000608, func=0x519000000690, status=3, f=0x555555828510 <luaB_pcall>)
    at ldo.c:644                                                                                                      
#28 0x0000555555738612 in luaD_precall (L=0x51b000000608, func=0x517000000190, nresults=2) at ldo.c:713
#29 0x00005555557ef5d1 in luaV_execute (L=0x51b000000608, ci=0x506000000680) at lvm.c:1716                          
#30 0x000055555573975b in ccall (L=0x51b000000608, func=0x517000000150, nResults=1, inc=65537) at ldo.c:755
#31 0x0000555555739856 in luaD_callnoyield (L=0x51b000000608, func=0x517000000150, nResults=1) at ldo.c:773   
#32 0x00005555557141ed in lua_callk (L=0x51b000000608, nargs=2, nresults=1, ctx=0, k=0x0) at lapi.c:1053
#33 0x0000555555850f63 in ll_require (L=0x51b000000608) at loadlib.c:664
#34 0x0000555555736fc4 in precallC (L=0x51b000000608, func=0x5170000000f0, status=2, f=0x555555850e20 <ll_require>)
    at ldo.c:644
#35 0x00005555557384da in luaD_precall (L=0x51b000000608, func=0x5170000000f0, nresults=1) at ldo.c:710
#36 0x00005555557ef5d1 in luaV_execute (L=0x51b000000608, ci=0x506000000080) at lvm.c:1716
#37 0x000055555573975b in ccall (L=0x51b000000608, func=0x5170000000d0, nResults=-1, inc=65537) at ldo.c:755
#38 0x0000555555739856 in luaD_callnoyield (L=0x51b000000608, func=0x5170000000d0, nResults=-1) at ldo.c:773
#39 0x0000555555715759 in f_call (L=0x51b000000608, ud=0x7ffff610a9a0) at lapi.c:1071
#40 0x000055555573006f in luaD_rawrunprotected (L=0x51b000000608, f=0x555555715670 <f_call>, ud=0x7ffff610a9a0)
    at ldo.c:166
#41 0x000055555573cb0f in luaD_pcall (L=0x51b000000608, func=0x555555715670 <f_call>, u=0x7ffff610a9a0, old_top=80, 
    ef=64) at ldo.c:1077
#42 0x0000555555714ea6 in lua_pcallk (L=0x51b000000608, nargs=0, nresults=-1, errfunc=3, ctx=0, k=0x0) at lapi.c:1097
#43 0x00005555556f4f46 in docall (L=0x51b000000608, narg=0, nres=-1) at lua.c:162
#44 0x00005555556f4a95 in handle_script (L=0x51b000000608, argv=0x7fffffffcd80) at lua.c:266
#45 0x00005555556f2d64 in pmain (L=0x51b000000608) at lua.c:731
#46 0x0000555555736fc4 in precallC (L=0x51b000000608, func=0x517000000090, status=2, f=0x5555556f28c0 <pmain>)
    at ldo.c:644
#47 0x0000555555738612 in luaD_precall (L=0x51b000000608, func=0x517000000090, nresults=1) at ldo.c:713
#48 0x00005555557396be in ccall (L=0x51b000000608, func=0x517000000090, nResults=1, inc=65537) at ldo.c:753
#49 0x0000555555739856 in luaD_callnoyield (L=0x51b000000608, func=0x517000000090, nResults=1) at ldo.c:773
#50 0x0000555555715759 in f_call (L=0x51b000000608, ud=0x7ffff61001a0) at lapi.c:1071
#51 0x000055555573006f in luaD_rawrunprotected (L=0x51b000000608, f=0x555555715670 <f_call>, ud=0x7ffff61001a0)
    at ldo.c:166
#52 0x000055555573cb0f in luaD_pcall (L=0x51b000000608, func=0x555555715670 <f_call>, u=0x7ffff61001a0, old_top=16, 
    ef=0) at ldo.c:1077
#53 0x0000555555714ea6 in lua_pcallk (L=0x51b000000608, nargs=2, nresults=1, errfunc=0, ctx=0, k=0x0) at lapi.c:1097
#54 0x00005555556f26ac in main (argc=2, argv=0x7fffffffcd78) at lua.c:759
(gdb) frame 9
#9  0x00007ffff48691b3 in search_module_path (
    so_path=0x7ffffffea270 "/home/sergeyb/sources/lua-c-api-tests/build/luzer/build/luzer", 
    so_name=0x7ffff49fe1f6 "libcustom_mutator.so", len=4096)
    at /home/sergeyb/sources/lua-c-api-tests/build/luzer/source/luzer/luzer.c:160
160                             free(lua_cpath);
(gdb) 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions