[Tarantool-patches] [PATCH luajit 0/2] Fix UBSan warnings

Sergey Kaplun skaplun at tarantool.org
Tue Jun 25 18:54:23 MSK 2024


This patchset removes all UBSan suppressions (except one in
lj_opt_fold.c regarding integer overflow and lj_buf.h regarding NULL ptr
argument) by fixing all known issues.

The first patch fixes out-of-bounds access to the `ex->gpr` structure
during snapshot restore. The second patch fixes all possible negations
of INT*_MIN.

Branch: https://github.com/tarantool/luajit/tree/skaplun/lj-928-1193-sanitizer-fixes
Related issues:
* https://github.com/LuaJIT/LuaJIT/issues/928
* https://github.com/LuaJIT/LuaJIT/issues/1193
* https://github.com/tarantool/tarantool/issues/9924
* https://github.com/tarantool/tarantool/issues/8473

Mike Pall (2):
  Prevent sanitizer warning in snap_restoredata().
  Avoid negation of signed integers in C that may hold INT*_MIN.

 src/lib_base.c                                |   2 +-
 src/lib_bit.c                                 |   3 +-
 src/lj_asm_mips.h                             |   2 +-
 src/lj_carith.c                               |   7 +-
 src/lj_cparse.c                               |   2 +-
 src/lj_crecord.c                              |   3 +-
 src/lj_ctype.c                                |   2 +-
 src/lj_emit_arm.h                             |   2 +-
 src/lj_emit_arm64.h                           |   9 +-
 src/lj_obj.h                                  |   2 +-
 src/lj_opt_fold.c                             |   6 +-
 src/lj_parse.c                                |  17 +--
 src/lj_snap.c                                 |  13 +-
 src/lj_strfmt.c                               |   9 +-
 src/lj_strscan.c                              |  26 ++--
 src/lj_vmmath.c                               |   6 +-
 ...93-out-of-bounds-snap-restoredata.test.lua |  28 ++++
 .../lj-928-int-min-negation.test.lua          | 121 ++++++++++++++++++
 18 files changed, 196 insertions(+), 64 deletions(-)
 create mode 100644 test/tarantool-tests/lj-1193-out-of-bounds-snap-restoredata.test.lua
 create mode 100644 test/tarantool-tests/lj-928-int-min-negation.test.lua

-- 
2.45.1



More information about the Tarantool-patches mailing list