flate2 with zlib features on static link musl target throw SIGSEGV: invalid memory reference #81923
Labels
C-bug
Category: This is a bug.
O-musl
Target: The musl libc
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
This is a Gentoo Linux system with musl libc. (musl 1.2.2)
When I build
cargo
from source code, I I encountered this error:In dmesg:
Backtrace of core file:
A minimal example:
(The source code and dockerfile is at https://github.com/12101111/flate2-rs-zlib-musl-bug )
The backtrace is basically the same:
The rust code that cause SIGSEVG is https://github.com/rust-lang/flate2-rs/blob/90d9e5ed866742ce8b3946d156830e300d1e5aab/src/ffi/c.rs#L377-L394
The disassemble from lldb:
The asm
callq *0x46b04(%rip)
is a GOT lookup code, but the address oflibz_sys::deflateInit2_
in GOT somehow is0x0
, and call it cause SIGSEGVMeta
rustc --version --verbose
:This issue is similar with #76021, but that is a regression on old musl version.
In this issue, I test in alpine 3.11 (docker
rust:alpine3.11
) and 3.12 (dockerrust:alpine3.12
), both of them use musl 1.1.24 which is the same version rust ship with, and have the same error.The title may not be accurate as this issue may not be limited to flate2-rs crate
The text was updated successfully, but these errors were encountered: