tarantool / tarantool/tarantool

luajit: tarantool-tests-deps build fails with ASAN detect_leaks on MacOS/ARM64/clang-21

Open
#13,019 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug luajit
Dominant language
Lua
Stars
3.7k
Forks
419
Avg merge
1d 23h
Merged PRs (30d)
88

Description

Bug description

Building of tarantool tests deps fails with ASAN detect_leaks enabled on MacOS/ARM64 with clang-21.

sw_vers

ProductName:		macOS
ProductVersion:		15.7.7
BuildVersion:		24G720
  • Architecture: arm64

Compiler: clang-21.

The error reveals in tarantool/luajit CI on MacOS/ARM64 with clang-21 and clang-20.

Additional info:

  • The error does not reproduced with clang-22.

Steps to reproduce

brew install llvm@21

cd /src/luajit # tarantool/luajit

make clean && rm -rf CMakeCache.txt CMakeFiles/

cmake -S . -B . -DCMAKE_PREFIX_PATH=`brew --prefix llvm@21` -DCMAKE_C_COMPILER=clang-21 -DLUAJIT_ENABLE_GC64=ON -DLUAJIT_USE_SYSMALLOC=ON -DLUAJIT_USE_ASAN=ON -DLUAJIT_USE_UBSAN=ON -DCMAKE_BUILD_TYPE=Debug -DLUA_USE_ASSERT=ON -DLUA_USE_APICHECK=ON

make -j

cd test

export ASAN_OPTIONS="detect_leaks=1"

ctest -R tarantool-tests-deps --output-on-failure

Output:

Test project /src/luajit/luajit/test
    Start 76: tarantool-tests-deps
1/1 Test #76: tarantool-tests-deps .............***Failed    0.72 sec
[  1%] Built target allocinject
[  2%] Built target minilua
[  4%] Built target buildvm
[  8%] Built target buildvm_output
[ 43%] Built target core_shared
[ 44%] Built target vm_shared
[ 45%] Built target libluajit_shared
[ 81%] Built target core_static
[ 82%] Built target vm_static
[ 82%] Built target libluajit_static
[ 82%] Built target libluajit
[ 82%] Built target libfficcall
[ 83%] Built target libtestbitshift
[ 83%] Built target libsandwich
[ 85%] Built target libproxy
[ 86%] Built target libcur_L
[ 87%] Built target libtestxor
[ 87%] Built target mydlerror
[ 88%] Built target luajit_static
[ 88%] Exporting bytecode to a C file

=================================================================
==63445==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 256 byte(s) in 1 object(s) allocated from:
    #0 0x00010188b478 in malloc+0x70 (libclang_rt.asan_osx_dynamic.dylib:arm64+0x53478)
    #1 0x00019d6db9d4 in _malloc_type_malloc_outlined+0x60 (libsystem_malloc.dylib:arm64+0x1d9d4)
    #2 0x00019d553338  (<unknown module>)
    #3 0x00019d554bb8  (<unknown module>)
    #4 0x000100db9150 in ll_bcsym lib_package.c:65
    #5 0x000100db97d8 in lj_cf_package_loader_preload lib_package.c:433
    #6 0x000100ce34e8 in lj_BC_FUNCC+0x28 (luajit:arm64+0x1000074e8)
    #7 0x000100ced338 in jit_secure_call lj_api.c:104
    #8 0x000100d0b108 in lua_call lj_api.c:1153
    #9 0x000100db9f70 in lj_cf_package_require lib_package.c:467
    #10 0x000100ce34e8 in lj_BC_FUNCC+0x28 (luajit:arm64+0x1000074e8)
    #11 0x000100d0c230 in lua_pcall lj_api.c:1178
    #12 0x000100ce06f4 in loadjitmodule luajit.c:316
    #13 0x000100ce03b0 in dobytecode luajit.c:423
    #14 0x000100cdf49c in runargs luajit.c:534
    #15 0x000100cdd938 in pmain luajit.c:598
    #16 0x000100ce34e8 in lj_BC_FUNCC+0x28 (luajit:arm64+0x1000074e8)
    #17 0x000100d0cc30 in lua_cpcall lj_api.c:1213
    #18 0x000100cdd2cc in main luajit.c:633
    #19 0x00019d51eb94  (<unknown module>)

Direct leak of 72 byte(s) in 1 object(s) allocated from:
    #0 0x00010188b478 in malloc+0x70 (libclang_rt.asan_osx_dynamic.dylib:arm64+0x53478)
    #1 0x00019d6db9d4 in _malloc_type_malloc_outlined+0x60 (libsystem_malloc.dylib:arm64+0x1d9d4)
    #2 0x00019d4ceae4 in _fetchInitializingClassList(bool)+0x34 (libobjc.A.dylib:arm64+0xaae4)
    #3 0x00019d4ce99c in _setThisThreadIsInitializingClass(objc_class*)+0x1c (libobjc.A.dylib:arm64+0xa99c)
    #4 0x00019d4ce7bc in initializeNonMetaClass+0x258 (libobjc.A.dylib:arm64+0xa7bc)
    #5 0x00019d4ce5fc in initializeNonMetaClass+0x98 (libobjc.A.dylib:arm64+0xa5fc)
    #6 0x00019d4ce5fc in initializeNonMetaClass+0x98 (libobjc.A.dylib:arm64+0xa5fc)
    #7 0x00019d4ce5fc in initializeNonMetaClass+0x98 (libobjc.A.dylib:arm64+0xa5fc)
    #8 0x00019d4eaa60 in initializeAndMaybeRelock(objc_class*, objc_object*, locker_mixin<lockdebug::lock_mixin<objc_lock_base_t>>&, bool)+0xac (libobjc.A.dylib:arm64+0x26a60)
    #9 0x00019d4cdf88 in lookUpImpOrForward+0x120 (libobjc.A.dylib:arm64+0x9f88)
    #10 0x00019d4cdb80 in _objc_msgSend_uncached+0x40 (libobjc.A.dylib:arm64+0x9b80)
    #11 0x00019d5ba3fc in _xpc_collect_images+0xc0 (libxpc.dylib:arm64+0x23fc)
    #12 0x00019d5b9868 in _libxpc_initializer+0x440 (libxpc.dylib:arm64+0x1868)
    #13 0x0001abb24310 in libSystem_initializer+0xfc (libSystem.B.dylib:arm64+0x1310)
    #14 0x00019d53aef8  (<unknown module>)
    #15 0x00019d577898  (<unknown module>)
    #16 0x00019d5975c8 in invocation function for block in mach_o::Header::forEachSection(void (mach_o::Header::SectionInfo const&, bool&) block_pointer) const+0xec (dyld:arm64+0xfffffffffffb35c8)
    #17 0x00019d594354 in mach_o::Header::forEachLoadCommand(void (load_command const*, bool&) block_pointer) const+0xcc (dyld:arm64+0xfffffffffffb0354)
    #18 0x00019d595a94 in mach_o::Header::forEachSection(void (mach_o::Header::SectionInfo const&, bool&) block_pointer) const+0x78 (dyld:arm64+0xfffffffffffb1a94)
    #19 0x00019d577368  (<unknown module>)
    #20 0x00019d53acb0  (<unknown module>)
    #21 0x00019d54652c  (<unknown module>)
    #22 0x00019d55c8ec  (<unknown module>)
    #23 0x00019d51fdfc  (<unknown module>)
    #24 0x00019d51f1d4  (<unknown module>)
    #25 0x00019d51eb48  (<unknown module>)

Indirect leak of 32 byte(s) in 1 object(s) allocated from:
    #0 0x00010188b750 in calloc+0x78 (libclang_rt.asan_osx_dynamic.dylib:arm64+0x53750)
    #1 0x00019d6dba4c in _malloc_type_calloc_outlined+0x64 (libsystem_malloc.dylib:arm64+0x1da4c)
    #2 0x00019d4ceb60 in _fetchInitializingClassList(bool)+0xb0 (libobjc.A.dylib:arm64+0xab60)
    #3 0x00019d4ce99c in _setThisThreadIsInitializingClass(objc_class*)+0x1c (libobjc.A.dylib:arm64+0xa99c)
    #4 0x00019d4ce7bc in initializeNonMetaClass+0x258 (libobjc.A.dylib:arm64+0xa7bc)
    #5 0x00019d4ce5fc in initializeNonMetaClass+0x98 (libobjc.A.dylib:arm64+0xa5fc)
    #6 0x00019d4ce5fc in initializeNonMetaClass+0x98 (libobjc.A.dylib:arm64+0xa5fc)
    #7 0x00019d4ce5fc in initializeNonMetaClass+0x98 (libobjc.A.dylib:arm64+0xa5fc)
    #8 0x00019d4eaa60 in initializeAndMaybeRelock(objc_class*, objc_object*, locker_mixin<lockdebug::lock_mixin<objc_lock_base_t>>&, bool)+0xac (libobjc.A.dylib:arm64+0x26a60)
    #9 0x00019d4cdf88 in lookUpImpOrForward+0x120 (libobjc.A.dylib:arm64+0x9f88)
    #10 0x00019d4cdb80 in _objc_msgSend_uncached+0x40 (libobjc.A.dylib:arm64+0x9b80)
    #11 0x00019d5ba3fc in _xpc_collect_images+0xc0 (libxpc.dylib:arm64+0x23fc)
    #12 0x00019d5b9868 in _libxpc_initializer+0x440 (libxpc.dylib:arm64+0x1868)
    #13 0x0001abb24310 in libSystem_initializer+0xfc (libSystem.B.dylib:arm64+0x1310)
    #14 0x00019d53aef8  (<unknown module>)
    #15 0x00019d577898  (<unknown module>)
    #16 0x00019d5975c8 in invocation function for block in mach_o::Header::forEachSection(void (mach_o::Header::SectionInfo const&, bool&) block_pointer) const+0xec (dyld:arm64+0xfffffffffffb35c8)
    #17 0x00019d594354 in mach_o::Header::forEachLoadCommand(void (load_command const*, bool&) block_pointer) const+0xcc (dyld:arm64+0xfffffffffffb0354)
    #18 0x00019d595a94 in mach_o::Header::forEachSection(void (mach_o::Header::SectionInfo const&, bool&) block_pointer) const+0x78 (dyld:arm64+0xfffffffffffb1a94)
    #19 0x00019d577368  (<unknown module>)
    #20 0x00019d53acb0  (<unknown module>)
    #21 0x00019d54652c  (<unknown module>)
    #22 0x00019d55c8ec  (<unknown module>)
    #23 0x00019d51fdfc  (<unknown module>)
    #24 0x00019d51f1d4  (<unknown module>)
    #25 0x00019d51eb48  (<unknown module>)

Indirect leak of 16 byte(s) in 1 object(s) allocated from:
    #0 0x00010188b750 in calloc+0x78 (libclang_rt.asan_osx_dynamic.dylib:arm64+0x53750)
    #1 0x00019d6dba4c in _malloc_type_calloc_outlined+0x64 (libsystem_malloc.dylib:arm64+0x1da4c)
    #2 0x00019d4ceb1c in _fetchInitializingClassList(bool)+0x6c (libobjc.A.dylib:arm64+0xab1c)
    #3 0x00019d4ce99c in _setThisThreadIsInitializingClass(objc_class*)+0x1c (libobjc.A.dylib:arm64+0xa99c)
    #4 0x00019d4ce7bc in initializeNonMetaClass+0x258 (libobjc.A.dylib:arm64+0xa7bc)
    #5 0x00019d4ce5fc in initializeNonMetaClass+0x98 (libobjc.A.dylib:arm64+0xa5fc)
    #6 0x00019d4ce5fc in initializeNonMetaClass+0x98 (libobjc.A.dylib:arm64+0xa5fc)
    #7 0x00019d4ce5fc in initializeNonMetaClass+0x98 (libobjc.A.dylib:arm64+0xa5fc)
    #8 0x00019d4eaa60 in initializeAndMaybeRelock(objc_class*, objc_object*, locker_mixin<lockdebug::lock_mixin<objc_lock_base_t>>&, bool)+0xac (libobjc.A.dylib:arm64+0x26a60)
    #9 0x00019d4cdf88 in lookUpImpOrForward+0x120 (libobjc.A.dylib:arm64+0x9f88)
    #10 0x00019d4cdb80 in _objc_msgSend_uncached+0x40 (libobjc.A.dylib:arm64+0x9b80)
    #11 0x00019d5ba3fc in _xpc_collect_images+0xc0 (libxpc.dylib:arm64+0x23fc)
    #12 0x00019d5b9868 in _libxpc_initializer+0x440 (libxpc.dylib:arm64+0x1868)
    #13 0x0001abb24310 in libSystem_initializer+0xfc (libSystem.B.dylib:arm64+0x1310)
    #14 0x00019d53aef8  (<unknown module>)
    #15 0x00019d577898  (<unknown module>)
    #16 0x00019d5975c8 in invocation function for block in mach_o::Header::forEachSection(void (mach_o::Header::SectionInfo const&, bool&) block_pointer) const+0xec (dyld:arm64+0xfffffffffffb35c8)
    #17 0x00019d594354 in mach_o::Header::forEachLoadCommand(void (load_command const*, bool&) block_pointer) const+0xcc (dyld:arm64+0xfffffffffffb0354)
    #18 0x00019d595a94 in mach_o::Header::forEachSection(void (mach_o::Header::SectionInfo const&, bool&) block_pointer) const+0x78 (dyld:arm64+0xfffffffffffb1a94)
    #19 0x00019d577368  (<unknown module>)
    #20 0x00019d53acb0  (<unknown module>)
    #21 0x00019d54652c  (<unknown module>)
    #22 0x00019d55c8ec  (<unknown module>)
    #23 0x00019d51fdfc  (<unknown module>)
    #24 0x00019d51f1d4  (<unknown module>)
    #25 0x00019d51eb48  (<unknown module>)

SUMMARY: AddressSanitizer: 376 byte(s) leaked in 4 allocation(s).
make[3]: *** [test/tarantool-tests/lj-549-bytecode-loader/CMakeFiles/export_bc] Error 1
make[2]: *** [test/tarantool-tests/lj-549-bytecode-loader/CMakeFiles/export_bc.dir/all] Error 2
make[1]: *** [test/tarantool-tests/CMakeFiles/tarantool-tests-deps.dir/rule] Error 2
make: *** [tarantool-tests-deps] Error 2


0% tests passed, 1 tests failed out of 1

Label Time Summary:
tarantool-tests    =   0.72 sec*proc (1 test)

Total Test time (real) =   0.73 sec

The following tests FAILED:
	 76 - tarantool-tests-deps (Failed)                     tarantool-tests
Errors while running CTest

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the failure with the provided CMake configuration and ctest -R tarantool-tests-deps --output-on-failure; inspect the export_bc target under test/tarantool-tests/lj-549-bytecode-loader and the allocation path in lib_package.c. Done means tarantool-tests-deps passes with ASAN leak detection enabled on macOS/ARM64 using clang-20 or clang-21.

Written by the indexing model from the issue text.

Assessment

Tech stack
cmake, lua, macos
Domain
build-system, operating-systems, testing-qa
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.