mmtk / mmtk-core

Memory Management ToolKit
https://www.mmtk.io
Other
379 stars 69 forks source link

Segfault in unit tests on 32bits #1092

Closed qinsoon closed 8 months ago

qinsoon commented 8 months ago

I recently saw this error in https://github.com/mmtk/mmtk-core/actions/runs/8258885514/job/22591917311?pr=1090. It should not be introduced in that PR. This test failed in 32 bits with Rust 1.71.1.

++ cargo test --features vm_space,ro_space,code_space,vo_bit,is_mmtk_object,object_pinning,immix_non_moving,sticky_immix_non_moving_nursery,immix_smaller_block,immix_zero_on_release,sanity,analysis,nogc_lock_free,nogc_no_zeroing,single_worker,extreme_assertions,nogc_multi_space,work_packet_stats,malloc_counted_size,count_live_bytes_in_gc,bpftrace_workaround,malloc_jemalloc
   Compiling mmtk v0.23.0 (/home/runner/work/mmtk-core/mmtk-core)
    Finished test [unoptimized + debuginfo] target(s) in 10.84s
     Running unittests src/lib.rs (target/debug/deps/mmtk-e1b2bcfa71dea606)

running 419 tests
test build_info::tests::test_features ... ok
test build_info::tests::test_pkg_version ... ok
test build_info::tests::test_git_version ... ok
test build_info::tests::test_full_build_version ... ok
test util::address::tests::align_down ... ok
test util::address::tests::align_up ... ok
test util::address::tests::bit_or ... ok
test util::address::tests::bit_and ... ok
test util::conversions::tests::test_bytes_to_formatted_string ... ok
test util::address::tests::is_aligned_to ... ok
test util::conversions::tests::test_chunk_align ... ok
test util::conversions::tests::test_page_align ... ok
test util::heap::layout::byte_map_mmapper::tests::address_to_mmap_chunks ... ok
error: test failed, to rerun pass `--lib`

Caused by:
  process didn't exit successfully: `/home/runner/work/mmtk-core/mmtk-core/target/debug/deps/mmtk-e1b2bcfa71dea606` (signal: 11, SIGSEGV: invalid memory reference)

It did not show in which test we got segfault.

It may be related with #1091. But there is no prove that they are related except that they were revealed in about the same time in 32bits Rust 1.71.1.

qinsoon commented 8 months ago

The segfault happened after the byte_map_mmapper unit test finished (possibly in the Rust testing framework). In the unit test, we do munmap for a larger memory region than what we mmap in the test so it may cause some memory used by the Rust testing framework to be unmapped. https://github.com/mmtk/mmtk-core/pull/1095 fixed this.