Skip to content

Segfault running aarch64-unknown-linux-gnu binaries on Fedora #36994

Closed
@cuviper

Description

@cuviper

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    O-ArmTarget: 32-bit Arm processors (armv6, armv7, thumb...), including 64-bit Arm in AArch32 state

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions