Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New test ffi_2/regress_b_261224444_test is red on ASAN #50705

Closed
sstrickl opened this issue Dec 13, 2022 · 1 comment
Closed

New test ffi_2/regress_b_261224444_test is red on ASAN #50705

sstrickl opened this issue Dec 13, 2022 · 1 comment
Labels
area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. gardening library-ffi

Comments

@sstrickl
Copy link
Contributor

There are new test failures on [vm/ffi] Fix FfiTrampolineData GC bug.

The tests

ffi_2/regress_b_261224444_test Crash (expected Pass)

are failing on configurations

dartk-asan-linux-release-x64

Example log:

--- Command "vm" (took 02.000648s):
DART_CONFIGURATION=ReleaseASANX64 out/ReleaseASANX64/dart --no-sound-null-safety -Dtest_runner.configuration=dartk-asan-linux-release-x64 --ignore-unrecognized-flags --packages=/b/s/w/ir/cache/builder/sdk/.dart_tool/package_config.json /b/s/w/ir/cache/builder/sdk/tests/ffi_2/regress_b_261224444_test.dart

exit code:
-6

stdout:
Closure: (int) => Pointer<Void>
106309030598656

stderr:
=================================================================
==14948==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 100 byte(s) in 1 object(s) allocated from:
    #0 0x55665a0bd1ee in malloc ../staging/llvm_build/tools/clang/stage2-bins/runtimes/runtimes-x86_64-unknown-linux-gnu-bins/compiler-rt/lib/asan/asan_malloc_linux.cpp:69:3
    #1 0x7f11cee8622a  (<unknown module>)
    #2 0x7f11cc824b42  (<unknown module>)
    #3 0x7f11cc823f06  (<unknown module>)
    #4 0x7f11cc823d85  (<unknown module>)
    #5 0x7f11cc823cb7  (<unknown module>)
    #6 0x7f11cc822be6  (<unknown module>)
    #7 0x7f11cc82293a  (<unknown module>)
    #8 0x7f11cc8221e5  (<unknown module>)
    #9 0x7f11cee82f2b  (<unknown module>)
    #10 0x55665a59b39c in dart::DartEntry::InvokeCode(dart::Code const&, unsigned long, dart::Array const&, dart::Array const&, dart::Thread*) ../../out/ReleaseASANX64/../../runtime/vm/dart_entry.cc
    #11 0x55665a59ade7 in dart::DartEntry::InvokeFunction(dart::Function const&, dart::Array const&, dart::Array const&, unsigned long) ../../out/ReleaseASANX64/../../runtime/vm/dart_entry.cc:145:10
    #12 0x55665a5a0c8e in dart::DartEntry::InvokeFunction(dart::Function const&, dart::Array const&) ../../out/ReleaseASANX64/../../runtime/vm/dart_entry.cc:37:10
    #13 0x55665a5a0c8e in dart::DartLibraryCalls::HandleMessage(long, dart::Instance const&) ../../out/ReleaseASANX64/../../runtime/vm/dart_entry.cc:732:28
    #14 0x55665a61b237 in dart::IsolateMessageHandler::HandleMessage(std::__2::unique_ptr<dart::Message, std::__2::default_delete<dart::Message>>) ../../out/ReleaseASANX64/../../runtime/vm/isolate.cc:1428:15
    #15 0x55665a6af9db in dart::MessageHandler::HandleMessages(dart::MonitorLocker*, bool, bool) ../../out/ReleaseASANX64/../../runtime/vm/message_handler.cc:240:16
    #16 0x55665a6b0fe3 in dart::MessageHandler::TaskCallback() ../../out/ReleaseASANX64/../../runtime/vm/message_handler.cc:450:18
    #17 0x55665aac7a55 in dart::ThreadPool::WorkerLoop(dart::ThreadPool::Worker*) ../../out/ReleaseASANX64/../../runtime/vm/thread_pool.cc:158:15
    #18 0x55665aac8e9a in dart::ThreadPool::Worker::Main(unsigned long) ../../out/ReleaseASANX64/../../runtime/vm/thread_pool.cc:330:9
    #19 0x55665a8dc79f in dart::ThreadStart(void*) ../../out/ReleaseASANX64/../../runtime/vm/os_thread_linux.cc:154:5
    #20 0x7f11d03b86da in start_thread (/lib/x86_64-linux-gnu/libpthread.so.0+0x76da) (BuildId: 1f06001733b9be9478b105faf0dac6bdf36c85de)

SUMMARY: AddressSanitizer: 100 byte(s) leaked in 1 allocation(s).

--- Re-run this test:
python3 tools/test.py -n dartk-asan-linux-release-x64 ffi_2/regress_b_261224444_test

/cc @dcharkes

@sstrickl sstrickl added area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. gardening library-ffi labels Dec 13, 2022
@dcharkes
Copy link
Contributor

main() {
  // Ensure we have FfiTrampolineData in heap.
  final foo = DynamicLibrary.process()
      .lookup<NativeFunction<Pointer<Void> Function(IntPtr)>>("malloc")
      .asFunction<Pointer<Void> Function(int)>();
  print(foo);

  triggerGc();

  print(foo(100).address);
}

We're calling malloc and not freeing. 🙃

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. gardening library-ffi
Projects
None yet
Development

No branches or pull requests

2 participants