lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On 2021-11-25 16:03, Roberto Ierusalimschy wrote:

But, if the bad thing happens in free_unlocked, then maybe the
problem is being caused by memory corruption somewhere else in the
program?

Running this

local path, cpath in package
print (path, cpath)
local x = require "lpeg"
print (x.version ( ) )

produces

rlua:lib.?,?    rlua:solib.?/so,?/so
1.0.0

Fatal signal received: Segmentation fault

Stack backtrace:

Running thread 0x4920c (Main Thread)
  (   a7f34) pc: 55ee0b64 lr: 55ee1044 sp:    a7f38  __write_backtrace()
( a7fa0) pc: 55ee0d78 lr: 55ee2bdc sp: a7fa4 __unixlib_raise_signal()
  (   a7fb0) pc: 55ee2ac4 lr: 55eeeb74 sp:    a6c84  __h_cback()

  Register dump at 000a7fb4:

    a1:    4c07c a2:        1 a3:     186c a4:        0
    v1:    4c07c v2:        1 v3:    3d3a4 v4:    75e50
    v5: 55eeeb30 v6:    3cab4 sl:    a6208 fp:    a6c9c
    ip:    a6ca0 sp:    a6c84 lr: 55eeeb74 pc: 55eedabc
    cpsr: 20000110

  55eedaa8 : ..Qã : e3510000 : CMP     R1,#0
  55eedaac : .@ á : e1a04000 : MOV     R4,R0
  55eedab0 : p¨.. : 091ba870 : LDMEQDB R11,{R4-R6,R11,R13,PC}
  55eedab4 : ...å : e5110004 : LDR     R0,[R1,#-4]
  55eedab8 : .À”å : e594c000 : LDR     R12,[R4,#0]
  55eedabc : .0Àã : e3c03003 : BIC     R3,R0,#3
  55eedac0 : ..Sá : e153000c : CMP     R3,R12
  55eedac4 : . Aâ : e2412008 : SUB     R2,R1,#8
  55eedac8 : ,..š : 9a00002c : BLS     &55EEDB80

  (   a6c9c) pc: 55eedaa0 lr: 55eeeb74 sp:    a6ca0  free_unlocked()
  (   a6cb4) pc: 55eeeb3c lr: 55e3a004 sp:    a6cb8  __free()
  (   a6ce0) pc: 55e39e4c lr: 55e3a694 sp:    a6ce4  do_dlclose()
  (   a6cf0) pc: 55e3a684 lr:    32194 sp:    a6cf4  _dlclose()
  (   a6d0c) pc:    32148 lr:    1217c sp:    a6d10  gctm()
  (   a6d40) pc:    11fb8 lr:    12424 sp:    a6d44  luaD_precall()
  (   a6d5c) pc:    123f0 lr:    14384 sp:    a6d60  luaD_callnoyield()
  (   a6d6c) pc:    1436c lr:    11094 sp:    a6d70  dothecall()
( a6e08) pc: 1103c lr: 127f0 sp: a6e0c luaD_rawrunprotected()
  (   a6e30) pc:    127c4 lr:    14308 sp:    a6e34  luaD_pcall()
  (   a6e68) pc:    141ec lr:    15eec sp:    a6e6c  GCTM()
( a6e88) pc: 15eb0 lr: 1b9b8 sp: a6e8c luaC_freeallobjects()
  (   a6ea0) pc:    1b98c lr:    1bfe8 sp:    a6ea4  close_state()
  (   a6eb0) pc:    1bfd4 lr:     b178 sp:    a6eb4  lua_close()
  (   a6ed4) pc:     b0e4 lr: 55ef797c sp:    a6ed8  main()

Practically the same. So the contents of the C-module are probably irrelevant.

-- Gavin