[Tarantool-patches] [PATCH luajit 0/6] FFI fixes

Sergey Kaplun skaplun at tarantool.org
Mon Oct 23 12:22:00 MSK 2023


This patchset is an umbrella for all FFI fixes and refactoring to be
done in #9145.

The first patch is a refactoring, and it will be useful for us when we
do #4738. The next two patches are just some FFI bugs to be fixed. The
last three patches are minor fixes use-after-free references of the
`cts->tab` objects.

Branch: https://github.com/tarantool/luajit/tree/skaplun/ffi-fixes
Tarantool PR: https://github.com/tarantool/tarantool/pull/9285
Related issues:
* https://github.com/LuaJIT/LuaJIT/issues/745
* https://github.com/LuaJIT/LuaJIT/issues/920
* https://github.com/LuaJIT/LuaJIT/issues/1108
* https://github.com/tarantool/tarantool/issues/9145
* https://github.com/tarantool/tarantool/issues/4738

Mike Pall (6):
  Abstract out on-demand loading of FFI library.
  FFI: Fix missing cts->L initialization in argv2ctype().
  FFI: Ensure returned string is alive in ffi.typeinfo().
  FFI: Fix dangling reference to CType.
  FFI: Fix dangling reference to CType. Improve checks.
  FFI: Fix dangling reference to CType in carith_checkarg().

 src/lib_ffi.c                                 |  1 +
 src/lib_jit.c                                 |  6 +-
 src/lj_bcread.c                               |  6 +-
 src/lj_carith.c                               |  4 +
 src/lj_cconv.c                                |  2 +
 src/lj_crecord.c                              |  6 +-
 src/lj_ctype.c                                | 12 +++
 src/lj_ctype.h                                | 10 +++
 src/lj_lex.c                                  |  6 +-
 .../fix-argv2ctype-cts-L-init.test.lua        | 15 ++++
 .../fix-argv2ctype-cts-L-init/script.lua      | 14 ++++
 .../fix-dangling-reference-to-ctype.test.lua  | 59 ++++++++++++++
 ...8-fix-dangling-reference-to-ctype.test.lua | 67 ++++++++++++++++
 .../lj-745-ffi-typeinfo-dead-names.test.lua   | 28 +++++++
 ...0-fix-dangling-reference-to-ctype.test.lua | 77 +++++++++++++++++++
 15 files changed, 297 insertions(+), 16 deletions(-)
 create mode 100644 test/tarantool-tests/fix-argv2ctype-cts-L-init.test.lua
 create mode 100644 test/tarantool-tests/fix-argv2ctype-cts-L-init/script.lua
 create mode 100644 test/tarantool-tests/fix-dangling-reference-to-ctype.test.lua
 create mode 100644 test/tarantool-tests/lj-1108-fix-dangling-reference-to-ctype.test.lua
 create mode 100644 test/tarantool-tests/lj-745-ffi-typeinfo-dead-names.test.lua
 create mode 100644 test/tarantool-tests/lj-920-fix-dangling-reference-to-ctype.test.lua

-- 
2.42.0



More information about the Tarantool-patches mailing list