mlibc icon indicating copy to clipboard operation
mlibc copied to clipboard

Possible allocator issues

Open Mathewnd opened this issue 1 year ago • 2 comments

While building GCC in Astral, mlibc accesses invalid memory while allocating memory for the application. The fault happens in frigg's rbtree implementation.

From what I have managed to gather, this is what happens:

  • Some memory still being used by the allocator's rbtree is unmapped here.
  • When the application calls malloc, the rbtree function faults, as it tries to access that unmapped range.

Mathewnd avatar Aug 06 '24 15:08 Mathewnd

Frigg has allocation tracing capabilities, it would be useful for debugging if such a trace could be acquired for this issue. Without this I suspect this will be exceedingly difficult to debug, especially because the Frigg allocator is quite well tested.

Geertiebear avatar Aug 06 '24 16:08 Geertiebear

Still don't have a trace. However, enabling FRG_SLAB_TRACK_REGIONS causes the following assertion to fail: /sysroot/usr/share/mlibc-build/frigg/include/frg/rbtree.hpp:213: Assertion 'grand && h(grand)->color == color_type::black' failed! This is due to h(grand)->color being color_type::red

Mathewnd avatar Aug 10 '24 15:08 Mathewnd

Was an issue with my virtual memory manager that only happened under very specific circumstances.

Mathewnd avatar Oct 11 '24 23:10 Mathewnd