managarm / mlibc

Portable C standard library
Other
827 stars 126 forks source link

Possible allocator issues #1107

Open Mathewnd opened 1 month ago

Mathewnd commented 1 month ago

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:

Geertiebear commented 1 month ago

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.

Mathewnd commented 1 month ago

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