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

Package:
src:rust-libmimalloc-sys
Source:
src:rust-libmimalloc-sys
Submitter:
Sebastian Ramacher
Date:
2026-07-14 19:09:02 UTC
Severity:
normal
Tags:
#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

#1136400#57
Date:
2026-07-14 17:22:28 UTC
From:
To:
The upstream patch got merged, but doesn't apply cleanly. Please find
attached a patch to drop into debian/patches.

Regards
Aurelien

#1136400#62
Date:
2026-07-14 19:06:24 UTC
From:
To:
We believe that the bug you reported is fixed in the latest version of
mimalloc, which is due to be installed in the Debian FTP archive.

A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to 1136400@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Alex Myczko <tar@debian.org> (supplier of updated mimalloc package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing ftpmaster@ftp-master.debian.org)
Format: 1.8
Date: Tue, 14 Jul 2026 20:40:48 +0200
Source: mimalloc
Architecture: source
Version: 3.3.2+ds-2
Distribution: unstable
Urgency: medium
Maintainer: Alex Myczko <tar@debian.org>
Changed-By: Alex Myczko <tar@debian.org>
Closes: 1136400
Changes:
 mimalloc (3.3.2+ds-2) unstable; urgency=medium
 .
   * Fix riscv64 build-time MMU detection. (Closes: #1136400)
     Thanks Aurelien Jarno for the patch.
Checksums-Sha1:
 76810eae18b214343262384e7dd1875d438515ce 1941 mimalloc_3.3.2+ds-2.dsc
 c1de13a0505524a6231ff0db0340030c2ea75e62 5736 mimalloc_3.3.2+ds-2.debian.tar.xz
 d5b6a37a9c4a5e63f957db58cf054541c723e87e 7259 mimalloc_3.3.2+ds-2_source.buildinfo
Checksums-Sha256:
 b6d2c05684fbdf4e91f6c1732b488dc8e622dad4706ecaa6483deff93cb75b28 1941 mimalloc_3.3.2+ds-2.dsc
 a1a5faf56a540a6fd3f9417b95085e98742acdba6fe99980a5bce3d3cc5e6ff2 5736 mimalloc_3.3.2+ds-2.debian.tar.xz
 5a17bec0b007bd455d049b4671514230a06d600e7bf78a27ada636d330c7eeba 7259 mimalloc_3.3.2+ds-2_source.buildinfo
Files:
 693239c53907776a69044fb6e464e771 1941 libs optional mimalloc_3.3.2+ds-2.dsc
 de146db9ffd01bf9ee1cd4f9c0559dba 5736 libs optional mimalloc_3.3.2+ds-2.debian.tar.xz
 92cadf70cbaa60a63a6d78ee1483c155 7259 libs optional mimalloc_3.3.2+ds-2_source.buildinfo
-----BEGIN PGP SIGNATURE-----

iQJDBAEBCgAtFiEEtgob82PcExn/Co6JEWhSvN91FcAFAmpWg4oPHHRhckBkZWJp
YW4ub3JnAAoJEBFoUrzfdRXA+tgQAIqF3XFFRQGzgEPN85f39SfbhCXbnmVpnpMD
JF5cjux3kohmraJWHxOiSqxA9FGSGK5KmE0xTw8Qzi5bs/PnYY9xj50PS5hw75ei
7mof7sByhOD9CqWGu6tHewkwmcWxYq68nsp17w3GCiHVasy2yfF3CP1RqxdDCWY4
XC5f95+m4r2HCn0VaVx7l5JQ1/h7EVMDOSkldCmbpqOexeMOV7LmkJU/Xa/ttv0O
kr2N1hKCa1wyZPQDdBF3wY5k2xq+JKXhTYCeM83kpCPKgUUQeegx54/bLxZTKTID
SMhVGGqIkZkI8R6iAuBqWLkO/dSr8K+u2JRXoTUoN/flNClbc6V3JpVvVqmUZVjL
iFqZJ+k1tYDOXH8SDM1J7/1Ts7MRZkL/2bEHkbuJby3mHftdKt9SbkhxojUzPctd
D+HST5Vv+GDpqPM3pcTJBMtdEAlrNDLhv+O4JPSGhAPyS+PJRXDaWL8UtFti+ypN
67B3Abr1Ri/Wh4u6PJry44vIRD1drsWozsf80wEbLoo+TrJ4GaIcvJusF+IcpcX/
Q4TWhnMICeCl/asXOaxocz52p+XdfzUFa+aFonIsW9imGwb9l0B5714Ai1xXQQAs
1SOqeLFrvMt3jUz3b5z33oW/si15peiZZatlF1+ceAsTLLlO77qTewx43aa7sE1m
9AnkJrAH
=XTzW
-----END PGP SIGNATURE-----