#1136400 rist-libmimalloc-sys: autopktest regression on riscv64

#1136400#5
Date:
2026-05-13 11:13:54 UTC
From:
To:
Source: rust-libmimalloc-sys
Version: 0.1.47+dfsg-1
Severity: serious
X-Debbugs-Cc: debian-riscv@lists.debian.org, sramacher@debian.org
User: debian-riscv@lists.debian.org
Usertags: riscv64

Dear maintainer,

the autopkgtests of rust-libmimalloc-sys fail:

127s error[E0425]: cannot find function `mi_malloc` in this scope
127s     --> src/extended.rs:1020:28
127s      |
127s   17 |     pub fn mi_calloc(count: usize, size: usize) -> *mut c_void;
127s      |     ----------------------------------------------------------- similarly named function `mi_calloc` defined here
127s ...
127s 1020 |         let ptr = unsafe { mi_malloc(32) } as *mut u8;
127s      |                            ^^^^^^^^^
127s      |
127s help: a function with a similar name exists
127s      |
127s 1020 -         let ptr = unsafe { mi_malloc(32) } as *mut u8;
127s 1020 +         let ptr = unsafe { mi_calloc(32) } as *mut u8;
127s      |
127s help: consider importing this function
127s      |
127s 1016 +     use crate::mi_malloc;
127s      |
127s
127s For more information about this error, try `rustc --explain E0425`.
127s error: could not compile `libmimalloc-sys` (lib test) due to 1 previous error
127s
127s Caused by:
127s   process didn't exit successfully: `CARGO=/usr/bin/cargo CARGO_CRATE_NAME=libmimalloc_sys CARGO_MANIFEST_DIR=/usr/share/cargo/registry/libmimalloc-sys-0.1.40 CARGO_MANIFEST_PATH=/usr/share/cargo/registry/libmimalloc-sys-0.1.40/Cargo.toml CARGO_PKG_AUTHORS='Octavian Oncescu <octavonce@gmail.com>' CARGO_PKG_DESCRIPTION='Sys crate wrapping the mimalloc allocator' CARGO_PKG_HOMEPAGE='' CARGO_PKG_LICENSE=MIT CARGO_PKG_LICENSE_FILE='' CARGO_PKG_NAME=libmimalloc-sys CARGO_PKG_README='' CARGO_PKG_REPOSITORY='https://github.com/purpleprotocol/mimalloc_rust/tree/master/libmimalloc-sys' CARGO_PKG_RUST_VERSION='' CARGO_PKG_VERSION=0.1.40 CARGO_PKG_VERSION_MAJOR=0 CARGO_PKG_VERSION_MINOR=1 CARGO_PKG_VERSION_PATCH=40 CARGO_PKG_VERSION_PRE='' CARGO_PRIMARY_PACKAGE=1 LD_LIBRARY_PATH=/tmp/tmp.507VUezvIG/target/debug/deps OUT_DIR=/tmp/tmp.507VUezvIG/target/riscv64gc-unknown-linux-gnu/debug/build/libmimalloc-sys-c102f2a0c5e98212/out rustc --crate-name libmimalloc_sys --edition=2018 src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --emit=dep-info,link -C embed-bitcode=no -C debuginfo=2 --test --cfg 'feature="arena"' --cfg 'feature="cty"' --cfg 'feature="extended"' --cfg 'feature="secure"' --check-cfg 'cfg(docsrs,test)' --check-cfg 'cfg(feature, values("arena", "cty", "extended", "secure"))' -C metadata=f3a36e8f116d61f1 -C extra-filename=-a656d63922750d93 --out-dir /tmp/tmp.507VUezvIG/target/riscv64gc-unknown-linux-gnu/debug/deps --target riscv64gc-unknown-linux-gnu -C incremental=/tmp/tmp.507VUezvIG/target/riscv64gc-unknown-linux-gnu/debug/incremental -L dependency=/tmp/tmp.507VUezvIG/target/riscv64gc-unknown-linux-gnu/debug/deps -L dependency=/tmp/tmp.507VUezvIG/target/debug/deps --extern cty=/tmp/tmp.507VUezvIG/target/riscv64gc-unknown-linux-gnu/debug/deps/libcty-1b05055fa781f71d.rlib --extern libc=/tmp/tmp.507VUezvIG/target/riscv64gc-unknown-linux-gnu/debug/deps/liblibc-23125869910bcf7c.rlib -C debuginfo=2 -C strip=none --cap-lints warn -C linker=riscv64-linux-gnu-gcc -C link-arg=-Wl,-z,relro --remap-path-prefix /usr/share/cargo/registry/libmimalloc-sys-0.1.40=/usr/share/cargo/registry/libmimalloc-sys-0.1.40 --remap-path-prefix /tmp/tmp.507VUezvIG/registry=/usr/share/cargo/registry -l mimalloc` (exit status: 1)
128s autopkgtest [05:06:27]: test rust-libmimalloc-sys:@: -----------------------]

See
https://ci.debian.net/packages/r/rust-libmimalloc-sys/testing/riscv64/70743830/
for details.

Cheers

#1136400#10
Date:
2026-05-14 00:02:36 UTC
From:
To:
found 1136400 0.1.40-1
thanks

I believe you've quoted the wrong part of the log,
quoting output from a test that is already marked as "broken".

I belive the actual failure is.

142s   process didn't exit successfully: `CARGO=/usr/bin/cargo CARGO_MANIFEST_DIR=/usr/share/cargo/registry/libmimalloc-sys-0.1.40 CARGO_MANIFEST_PATH=/usr/share/cargo/registry/libmimalloc-sys-0.1.40/Cargo.toml CARGO_PKG_AUTHORS='Octavian Oncescu <octavonce@gmail.com>' CARGO_PKG_DESCRIPTION='Sys crate wrapping the mimalloc allocator' CARGO_PKG_HOMEPAGE='' CARGO_PKG_LICENSE=MIT CARGO_PKG_LICENSE_FILE='' CARGO_PKG_NAME=libmimalloc-sys CARGO_PKG_README='' CARGO_PKG_REPOSITORY='https://github.com/purpleprotocol/mimalloc_rust/tree/master/libmimalloc-sys' CARGO_PKG_RUST_VERSION='' CARGO_PKG_VERSION=0.1.40 CARGO_PKG_VERSION_MAJOR=0 CARGO_PKG_VERSION_MINOR=1 CARGO_PKG_VERSION_PATCH=40 CARGO_PKG_VERSION_PRE='' LD_LIBRARY_PATH='/tmp/tmp.YhgzhQ6wzU/target/riscv64gc-unknown-linux-gnu/debug:/tmp/tmp.YhgzhQ6wzU/target/riscv64gc-unknown-linux-gnu/debug/deps:/usr/lib/rustlib/riscv64gc-unknown-linux-gnu/lib' OUT_DIR=/tmp/tmp.YhgzhQ6wzU/target/riscv64gc-unknown-linux-gnu/debug/build/libmimalloc-sys-4d9f02f6027bf000/out /tmp/tmp.YhgzhQ6wzU/target/riscv64gc-unknown-linux-gnu/debug/deps/libmimalloc_sys-ceadfc72acec09f8` (signal: 11, SIGSEGV: invalid memory reference)
142s autopkgtest [05:06:41]: test librust-libmimalloc-sys-dev:arena: -----------------------]

This seems to affect both versions 0.1.40 and 0.1.47, but only when tested
with unstable's version of mimalloc.

#1136400#17
Date:
2026-05-14 11:02:45 UTC
From:
To:
Hi,

I am personally unable to reproduce the issue on two different boards,
using JH7110 and SpacemiT K1 CPU. That said after retrying the
autopkgtest a few time on debci (it runs fast), I have noticed the
following pattern:
- Tests pass on debci-10 running Linux 6.12.86+deb13-riscv64
- Tests fail on debci-31, debci-32 and debci-33 running Linux 6.6.88-win2030

Therefore I believe it could be a kernel or a hardware issue. I guess
the boards running the 6.6.88-win2030 kernel are the P550 ones.

Regards
Aurelien

#1136400#22
Date:
2026-05-14 20:09:52 UTC
From:
To:
I am able to reproduce the issue on a P550 board, either running kernel
6.6.77, 6.12.33 or 6.12.78. I am also able to reproduce it on the same
hardware in a VM running kernel 6.12.86+deb13-riscv64.

On the other hand I am unable to reproduce it on the riscv64 porterbox
(ricci.d.o).

I therefore believe there is something fishy with the hardware that
needs more investigation.

Regards
Aurelien

#1136400#29
Date:
2026-05-14 22:06:19 UTC
From:
To:
control: retitle -1 mimalloc: riscv64: build-time MMU detection causes crashes on SV48 systems
control: reassign -1 src:mimalloc
control: found -1 3.0.1+ds-1

Hi,
following build time check:

| # Check /proc/cpuinfo for an SV39 MMU and limit the virtual address bits.
| # (this will skip the aligned hinting in that case. Issue #939, #949)
| if (EXISTS /proc/cpuinfo)
|   file(STRINGS /proc/cpuinfo mi_sv39_mmu REGEX "^mmu[ \t]+:[ \t]+sv39$")
|   if (mi_sv39_mmu)
|     MESSAGE( STATUS "Set virtual address bits to 39 (SV39 MMU detected)" )
|     list(APPEND mi_defines MI_DEFAULT_VIRTUAL_ADDRESS_BITS=39)
|   endif()
| endif()

Our build daemons are using a sv39 nmu:

| aurel32@ricci:~$ grep ^mmu /proc/cpuinfo  | head -n1
| mmu             : sv39

While the P550 defaults to a sv48 nmu:
| aurel32@p550:~$ grep ^mmu /proc/cpuinfo  | head -n1
| mmu             : sv48

Therefore libmimalloc.so.3 is built with a 39-bit virtual address space
support. When the binary is run on a sv48 system, things explodes.
Rebuilding libmimalloc.so.3 on the P550 enables sv48 support and things
work again, even on a sv39 mmu.

It's not clear to me if there is a drawback to always enable sv48
support, if yes I guess a runtime detection should be implemented.
Anyway for now reassigning the bug to the correct package.

Regards
Aurelien

#1136400#44
Date:
2026-05-18 19:50:00 UTC
From:
To:
control: tag -1 + patch
control: forwarded -1 https://github.com/microsoft/mimalloc/pull/1296

Hi:
https://github.com/microsoft/mimalloc/pull/1296

Regards
Aurelien