mpeterv/cluacov

bug: luajit2.1 compiled with gc64 mode cause segment fault

Closed this issue · 1 comments

Hi @mpeterv , thanks for sharing this extension, I ran into a segment fault problem with luajit2.1 compiled with gc64 mode.

luajit version

$ luajit -v
LuaJIT 2.1.0-beta3 -- Copyright (C) 2005-2020 Mike Pall. https://luajit.org/

deepactivelines.so complied command

gcc -O2 -fPIC -I/usr/local/openresty/luajit/include/luajit-2.1 -c src/cluacov/deepactivelines.c -o src/cluacov/deepactivelines.o
gcc -shared -o cluacov/deepactivelines.so src/cluacov/deepactivelines.o

recompiled deepactivelines.so with -g option, got the following backtrace:

#0  0x00007f41af8901d4 in add_activelines (L=L@entry=0x7f41af85b380, proto=0xf66ffbf) at src/cluacov/deepactivelines.c:58
58	    const void *lineinfo = proto_lineinfo(proto);
Missing separate debuginfos, use: debuginfo-install libgcc-4.8.5-28.el7_5.1.x86_64
(gdb) bt
#0  0x00007f41af8901d4 in add_activelines (L=L@entry=0x7f41af85b380, proto=0xf66ffbf) at src/cluacov/deepactivelines.c:58
#1  0x00007f41af890342 in l_deepactivelines (L=0x7f41af85b380) at src/cluacov/deepactivelines.c:97
#2  0x0000000000407ec2 in lj_BC_FUNCC ()
#3  0x000000000040a5ff in gc_call_finalizer (g=g@entry=0x7f41af85b3f0, L=L@entry=0x7f41af85b380, mo=<optimized out>,
    o=o@entry=0x7f41af865b60) at lj_gc.c:511
#4  0x000000000040a765 in gc_finalize (L=L@entry=0x7f41af85b380) at lj_gc.c:558
#5  0x000000000040be48 in lj_gc_finalize_udata (L=L@entry=0x7f41af85b380) at lj_gc.c:565
#6  0x0000000000414591 in cpfinalize (L=0x7f41af85b380, dummy=<optimized out>, ud=<optimized out>) at lj_state.c:272
#7  0x00000000004082b8 in lj_vm_cpcall ()
#8  0x0000000000414a24 in lua_close (L=0x7f41af85b380) at lj_state.c:298
#9  0x0000000000404df8 in main (argc=3, argv=<optimized out>) at luajit.c:584

I seems that luajit crashed at proto_lineinfo, does this releated to my luajit gc64 mode?

replace lj2 floder with openresty's luajit2's header file resolves.