Description
I've been trying to bootstrap Fedora aarch64, and I was getting strange segfaults. It was even stranger when I found that it would work in a Fedora chroot on my tablet (Android kernel), but failed under a full Fedora system. I finally realized that Fedora's kernel is using 64k pages, and Rust's jemalloc is built for 4k.
I filed jemalloc/jemalloc#467 for compiled-in page sizes. The result is that most madvise(MADV_DONTNEED)
calls are failing due to alignment, which wouldn't be a big deal, but a few happen to align correctly. However, the kernel rounds up the requested length to a full 64k page, so it actually clears a lot more memory than intended. It doesn't take long for a nulled pointer to get dereferenced and crash.
So on the Rust side, this might be more fuel for switching the default allocator, cc #36963. Or perhaps Rust's jemalloc tree can be patched the same as Firefox's mozjemalloc to read the page size at runtime.
In the meantime, those madvise
calls can be disabled by the environment:
export MALLOC_CONF=lg_dirty_mult:-1
So far, that works for me, and I'll try a full build soon.