[Pkg-rust-maintainers] Bug#998232: cargo segv when updating crates.io index

Daniel P. Berrange dan-debian at berrange.com
Mon Nov 1 12:38:41 GMT 2021


Package: cargo
Version: 0.43.1-3~deb10u1
Severity: important

Dear Maintainer,

Since about Oct 12th, we have been seeing cargo on Debian 10
crash with a segv when attempting to update crates.io index
in CI jobs.

This was initially seen inside docker container running CI
pipelines in GitLab, but has been reproduced in regular
VM installs too and by multiple people

Steps to reproduce

 $ git clone https://gitlab.com/libvirt/libvirt-rust
 $ cd libvirt-rust
 $ cargo test
     Updating crates.io index
   Segmentation fault (core dumped)

This doesn't appear limited to the libvirt-rust project. For
example this also fails

 $ git clone https://github.com/enarx/sev
 $ cd sev
 $ cargo test
     Updating crates.io index
   Segmentation fault (core dumped)

Stack trace captured from GDB


Thread 1 (Thread 0x7ffff6888100 (LWP 2198)):
#0  0x0000555555ca4a54 in on_header_field (parser=0x5555560f24f0, 
    str=0x5555560f25c9 "Server: GitHub Babel 2.0\r\nContent-Type: application/x-git-upload-pack-advertisement\r\nContent-Security-Policy: default-src 'none'; sandbox\r\nTransfer-Encoding: chunked\r\nexpires: Fri, 01 Jan 1980 00:00:0"..., len=6) at libgit2/src/transports/http.c:356
#1  0x00007ffff7fc0486 in http_parser_execute () from /usr/lib/x86_64-linux-gnu/libhttp_parser.so.2.8
#2  0x0000555555ca6a09 in http_stream_read (stream=<optimized out>, buffer=0x5555560e2350 "", buf_size=<optimized out>, bytes_read=0x7fffffff3db0)
    at libgit2/src/transports/http.c:1106
#3  0x0000555555ca231a in git_smart__recv_cb (buf=0x5555560e2328) at libgit2/src/transports/smart.c:25
#4  0x0000555555cc02e8 in git_smart__store_refs (t=t at entry=0x5555560e2190, flushes=2) at libgit2/src/transports/smart_protocol.c:55
#5  0x0000555555ca2a9e in git_smart__connect (transport=0x5555560e2190, url=0x5555560e2130 "https://github.com/rust-lang/crates.io-index", 
    cred_acquire_cb=0x555555c45c90 <git2::remote_callbacks::credentials_cb>, cred_acquire_payload=0x7fffffff4358, proxy=0x7fffffff41a8, 
    direction=<optimized out>, flags=0) at libgit2/src/transports/smart.c:255
#6  0x0000555555c5ed5d in git_remote__connect (remote=remote at entry=0x5555560e16e0, direction=direction at entry=GIT_DIRECTION_FETCH, 
    callbacks=callbacks at entry=0x7fffffff4130, conn=conn at entry=0x7fffffff3f70) at libgit2/src/remote.c:695
#7  0x0000555555c604c0 in git_remote_fetch (remote=0x5555560e16e0, refspecs=0x7fffffff4050, opts=0x7fffffff4128, reflog_message=0x0)
    at libgit2/src/remote.c:1022
#8  0x00005555557631e1 in git2::remote::Remote::fetch (self=<optimized out>, refspecs=..., opts=..., reflog_msg=...)
    at /usr/src/cargo-0.43.1/vendor/git2/src/call.rs:14
#9  0x0000555555838e56 in cargo::sources::git::utils::fetch::{{closure}} (opts=...) at src/cargo/sources/git/utils.rs:730
#10 0x0000555555836de7 in cargo::sources::git::utils::with_fetch_options::{{closure}}::{{closure}} (f=...) at src/cargo/sources/git/utils.rs:659
#11 0x0000555555806f8f in cargo::sources::git::utils::with_authentication (url=..., cfg=0x7fffffff4820, f=...) at src/cargo/sources/git/utils.rs:450
#12 cargo::sources::git::utils::with_fetch_options::{{closure}} () at src/cargo/sources/git/utils.rs:644
#13 core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &mut F>::call_once (self=<optimized out>, args=<optimized out>)
    at /usr/src/rustc-1.41.1/src/libcore/ops/function.rs:285
#14 0x00005555557eb1ba in cargo::util::network::Retry::try (f=<optimized out>, self=<optimized out>) at src/cargo/util/network.rs:23
#15 cargo::util::network::with_retry (config=0x7fffffffe210, callback=...) at src/cargo/util/network.rs:91
#16 0x0000555555838144 in cargo::sources::git::utils::with_fetch_options (git_config=0x5555560d1d30, config=<optimized out>, url=..., cb=...)
    at src/cargo/sources/git/utils.rs:643
#17 cargo::sources::git::utils::fetch (repo=0x5555560cc2d0, url=..., refspec=..., config=<optimized out>) at src/cargo/sources/git/utils.rs:716
#18 0x0000555555927ada in <cargo::sources::registry::remote::RemoteRegistry as cargo::sources::registry::RegistryData>::update_index (self=0x5555560cc270)
    at src/cargo/sources/registry/remote.rs:222
#19 0x0000555555725b3c in cargo::sources::registry::RegistrySource::do_update (self=0x5555560d3cf0) at src/cargo/sources/registry/mod.rs:504
#20 0x0000555555a1ad7b in cargo::core::registry::PackageRegistry::load::{{closure}} () at src/cargo/core/registry.rs:365
#21 cargo::core::registry::PackageRegistry::load (self=<optimized out>, source_id=..., kind=<optimized out>) at src/cargo/core/registry.rs:353
#22 cargo::core::registry::PackageRegistry::ensure_loaded (self=<optimized out>, namespace=..., kind=<optimized out>) at src/cargo/core/registry.rs:167
#23 0x0000555555a1ce39 in <cargo::core::registry::PackageRegistry as cargo::core::registry::Registry>::query (self=<optimized out>, dep=<optimized out>, 
    f=..., fuzzy=false) at src/cargo/core/registry.rs:517
#24 0x0000555555716337 in cargo::core::resolver::dep_cache::RegistryQueryer::query (self=<optimized out>, dep=0x7fffffff52e0)
    at src/cargo/core/resolver/dep_cache.rs:82
#25 0x00005555558608a4 in cargo::core::resolver::dep_cache::RegistryQueryer::build_deps::{{closure}} () at src/cargo/core/resolver/dep_cache.rs:223
#26 core::iter::adapters::map_try_fold::{{closure}} (elt=..., acc=<optimized out>) at /usr/src/rustc-1.41.1/src/libcore/iter/adapters/mod.rs:711
#27 core::iter::traits::iterator::Iterator::try_fold (self=<optimized out>, f=..., init=<optimized out>)
    at /usr/src/rustc-1.41.1/src/libcore/iter/traits/iterator.rs:1710
#28 <core::iter::adapters::Map<I,F> as core::iter::traits::iterator::Iterator>::try_fold (self=<optimized out>, g=..., init=<optimized out>)
    at /usr/src/rustc-1.41.1/src/libcore/iter/adapters/mod.rs:731
#29 <core::iter::adapters::ResultShunt<I,E> as core::iter::traits::iterator::Iterator>::try_fold (self=<optimized out>, init=<optimized out>, f=...)
    at /usr/src/rustc-1.41.1/src/libcore/iter/adapters/mod.rs:2435
#30 core::iter::traits::iterator::Iterator::find (self=<optimized out>, predicate=...) at /usr/src/rustc-1.41.1/src/libcore/iter/traits/iterator.rs:1999
#31 <core::iter::adapters::ResultShunt<I,E> as core::iter::traits::iterator::Iterator>::next (self=<optimized out>)
    at /usr/src/rustc-1.41.1/src/libcore/iter/adapters/mod.rs:2417
#32 0x0000555555956761 in <alloc::vec::Vec<T> as alloc::vec::SpecExtend<T,I>>::from_iter (iterator=...) at /usr/src/rustc-1.41.1/src/liballoc/vec.rs:1998
#33 0x00005555557193b2 in <alloc::vec::Vec<T> as core::iter::traits::collect::FromIterator<T>>::from_iter (iter=...)
    at /usr/src/rustc-1.41.1/src/liballoc/vec.rs:1911
#34 core::iter::traits::iterator::Iterator::collect (self=...) at /usr/src/rustc-1.41.1/src/libcore/iter/traits/iterator.rs:1494
#35 <core::result::Result<V,E> as core::iter::traits::collect::FromIterator<core::result::Result<A,E>>>::from_iter::{{closure}} (i=...)
    at /usr/src/rustc-1.41.1/src/libcore/result.rs:1450
#36 core::iter::adapters::process_results (iter=..., f=...) at /usr/src/rustc-1.41.1/src/libcore/iter/adapters/mod.rs:2407
#37 <core::result::Result<V,E> as core::iter::traits::collect::FromIterator<core::result::Result<A,E>>>::from_iter (iter=...)
    at /usr/src/rustc-1.41.1/src/libcore/result.rs:1450
#38 core::iter::traits::iterator::Iterator::collect (self=...) at /usr/src/rustc-1.41.1/src/libcore/iter/traits/iterator.rs:1494
#39 cargo::core::resolver::dep_cache::RegistryQueryer::build_deps (self=<optimized out>, parent=..., candidate=<optimized out>, opts=<optimized out>)
    at src/cargo/core/resolver/dep_cache.rs:220
#40 0x000055555591c2c0 in cargo::core::resolver::activate (cx=0x7fffffff6d60, registry=0x7fffffff7260, parent=..., candidate=..., opts=...)
    at src/cargo/core/resolver/mod.rs:647
#41 0x00005555559174b8 in cargo::core::resolver::activate_deps_loop (cx=..., registry=<optimized out>, summaries=..., config=...)
    at src/cargo/core/resolver/mod.rs:185
#42 0x0000555555915b40 in cargo::core::resolver::resolve (summaries=..., replacements=..., registry=..., try_to_use=<optimized out>, config=..., 
    check_public_visible_dependencies=<optimized out>) at src/cargo/core/resolver/mod.rs:137
#43 0x00005555556ea8d2 in cargo::ops::resolve::resolve_with_previous (registry=<optimized out>, ws=<optimized out>, opts=..., previous=..., to_avoid=..., 
    specs=..., register_patches=<optimized out>) at src/cargo/ops/resolve.rs:356
#44 0x00005555556e84c0 in cargo::ops::resolve::resolve_with_registry (ws=0x7fffffffd8a8, registry=0x7fffffff93c8) at src/cargo/ops/resolve.rs:137
#45 0x00005555556e7c70 in cargo::ops::resolve::resolve_ws_with_opts (ws=0x7fffffffd8a8, opts=..., specs=...) at src/cargo/ops/resolve.rs:86
#46 0x00005555556dbc22 in cargo::ops::cargo_compile::compile_ws (ws=<optimized out>, options=0x7fffffffd160, exec=0x7fffffffc230)
    at src/cargo/ops/cargo_compile.rs:313
#47 0x00005555556db54c in cargo::ops::cargo_compile::compile_with_exec (ws=0x7fffffffd8a8, options=0x7fffffffd160, exec=<optimized out>)
    at src/cargo/ops/cargo_compile.rs:259
#48 cargo::ops::cargo_compile::compile (ws=0x7fffffffd8a8, options=0x7fffffffd160) at src/cargo/ops/cargo_compile.rs:248
#49 0x00005555559def6b in cargo::ops::cargo_test::compile_tests (ws=0x5555560f25c9, options=0x7fffffffd160) at src/cargo/ops/cargo_test.rs:69
#50 cargo::ops::cargo_test::run_tests (ws=0x5555560f25c9, options=0x7fffffffd160, test_args=...) at src/cargo/ops/cargo_test.rs:21
#51 0x000055555560d49b in cargo::commands::test::exec (config=<optimized out>, args=0x555556002948) at src/bin/cargo/commands/test.rs:162
#52 0x00005555555f6af0 in cargo::cli::execute_subcommand (config=<optimized out>, cmd=..., subcommand_args=<optimized out>) at src/bin/cargo/cli.rs:197
#53 cargo::cli::main (config=0x7fffffffe210) at src/bin/cargo/cli.rs:107
#54 0x000055555563b3f5 in cargo::main () at src/bin/cargo/main.rs:39


Suggests the problem is likely related to libgit2 HTTP handling.

-- System Information:
Debian Release: 10.11
  APT prefers oldstable-updates
  APT policy: (500, 'oldstable-updates'), (500, 'oldstable')
Architecture: amd64 (x86_64)

Kernel: Linux 4.19.0-18-amd64 (SMP w/1 CPU core)
Locale: LANG=C.UTF-8, LC_CTYPE=C.UTF-8 (charmap=UTF-8), LANGUAGE=C.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages cargo depends on:
ii  binutils            2.31.1-16
ii  gcc [c-compiler]    4:8.3.0-1
ii  gcc-8 [c-compiler]  8.3.0-6
ii  libc6               2.28-10
ii  libcurl3-gnutls     7.64.0-4+deb10u2
ii  libgcc1             1:8.3.0-6
ii  libhttp-parser2.8   2.8.1-1+deb10u1
ii  libssh2-1           1.8.0-2.1
ii  libssl1.1           1.1.1d-0+deb10u7
ii  rustc               1.41.1+dfsg1-1~deb10u1
ii  zlib1g              1:1.2.11.dfsg-1

cargo recommends no packages.

Versions of packages cargo suggests:
pn  cargo-doc  <none>
ii  python3    3.7.3-1

-- no debconf information



More information about the Pkg-rust-maintainers mailing list