Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Segfault due to libgit2 shenanigans #380

Closed
jplatte opened this issue Nov 26, 2021 · 17 comments · Fixed by #422
Closed

Segfault due to libgit2 shenanigans #380

jplatte opened this issue Nov 26, 2021 · 17 comments · Fixed by #422
Labels
bug Something isn't working

Comments

@jplatte
Copy link
Contributor

jplatte commented Nov 26, 2021

Describe the bug

It's a segmentation fault! The program crashes after printing a warning about being unable to find a config path. I wanted to just have it use the default config in a project where I haven't set one up yet.

To Reproduce

jplatte@jp-desktop ~/code % cargo init t
     Created binary (application) package
jplatte@jp-desktop ~/code % cd t
jplatte@jp-desktop ~/code/t (git)-[main] % cargo deny check
2021-11-26 12:48:39 [WARN] unable to find a config path, falling back to default config
[1]    18503 segmentation fault (core dumped)  cargo deny check

Expected behavior

Successfully

Additional context

This is cargo-deny 0.10.3 installed to /usr/bin through the arch linux package. Maybe it fails to mmap the default config file or something like that? Here's the package build script, it's really minimal: https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=cargo-deny

@jplatte jplatte added the bug Something isn't working label Nov 26, 2021
@Jake-Shadle
Copy link
Member

I am unable to repro this. The file is only loaded if it exists, in the code path where that is printed the "config file" is just an empty string, and the rest of the run doesn't know/care that there is no actual file the config was read from.

If this still occurs for you I would appreciate having a backtrace, as it stands, I feel like the warning message is maybe a red herring.

@jplatte
Copy link
Contributor Author

jplatte commented Jan 28, 2022

Actually just recently I got the crash again, on a project with a config file so I think you're right about the red herring.

Went ahead and uninstalled the arch package / installed from crates.io and it was fixed. I will have a closer look at how the AUR package is built and where it actually crashes.

@Jake-Shadle
Copy link
Member

Thanks!

@jplatte
Copy link
Contributor Author

jplatte commented Jan 28, 2022

Something fishy is definitely going on. When I have both the AUR package and the cargo package installed, things work even for the AUR package. Once I remove the cargo package, things break.

I built a debug version and ran it through GDB, this is the backtrace:

Starting program: /usr/bin/cargo-deny deny check
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".
2022-01-28 10:00:40 [WARN] unable to find a config path, falling back to default config
[New Thread 0x7ffff76cb640 (LWP 29600)]
[New Thread 0x7ffff74ca640 (LWP 29601)]
[New Thread 0x7ffff72c9640 (LWP 29602)]
[New Thread 0x7ffff70c8640 (LWP 29603)]
[New Thread 0x7ffff6ec7640 (LWP 29604)]
[New Thread 0x7ffff6cc6640 (LWP 29605)]
[New Thread 0x7ffff6ac5640 (LWP 29606)]
[New Thread 0x7ffff68c4640 (LWP 29607)]
[New Thread 0x7ffff66c3640 (LWP 29608)]
[New Thread 0x7ffff64c2640 (LWP 29609)]
[New Thread 0x7ffff62c1640 (LWP 29610)]
[New Thread 0x7ffff60c0640 (LWP 29611)]
[Detaching after vfork from child process 29612]

Thread 12 "cargo-deny" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7ffff62c1640 (LWP 29610)]
0x00007ffff7ac62d3 in SSL_get_peer_certificate () from /usr/lib/libssl.so.1.1
(gdb) bt
#0  0x00007ffff7ac62d3 in SSL_get_peer_certificate () from /usr/lib/libssl.so.1.1
#1  0x00007ffff7f339c5 in ?? () from /usr/lib/libgit2.so.1.3
#2  0x00007ffff7f40f6f in ?? () from /usr/lib/libgit2.so.1.3
#3  0x00007ffff7f42acb in ?? () from /usr/lib/libgit2.so.1.3
#4  0x00007ffff7f40a5c in ?? () from /usr/lib/libgit2.so.1.3
#5  0x00007ffff7f44ef6 in ?? () from /usr/lib/libgit2.so.1.3
#6  0x00007ffff7f47359 in ?? () from /usr/lib/libgit2.so.1.3
#7  0x00007ffff7f456ac in ?? () from /usr/lib/libgit2.so.1.3
#8  0x00007ffff7f1e5c7 in ?? () from /usr/lib/libgit2.so.1.3
#9  0x00007ffff7f1fd55 in git_remote_fetch () from /usr/lib/libgit2.so.1.3
#10 0x0000555556537302 in git2::remote::Remote::fetch<&str> (self=0x7ffff62bb9f8, refspecs=..., opts=..., reflog_msg=...) at /home/jplatte/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/git2-0.13.24/src/remote.rs:286
#11 0x000055555648dfcb in rustsec::repository::git::repository::{impl#0}::fetch::{closure#0}<&std::path::PathBuf> (f=...) at /home/jplatte/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/rustsec-0.25.1/src/repository/git/repository.rs:94
#12 0x000055555643e527 in rustsec::repository::git::authentication::with_authentication<(), rustsec::repository::git::repository::{impl#0}::fetch::{closure#0}> (url=..., cfg=0x7ffff62bcde8, f=...)
    at /home/jplatte/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/rustsec-0.25.1/src/repository/git/authentication.rs:48
#13 0x000055555648cf08 in rustsec::repository::git::repository::Repository::fetch<&std::path::PathBuf> (url=..., into_path=0x7ffff62bd750, ensure_fresh=true)
    at /home/jplatte/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/rustsec-0.25.1/src/repository/git/repository.rs:77
#14 0x0000555555c1b305 in cargo_deny::advisories::helpers::load_db (db_url=0x7ffff62bdf88, root_db_path=..., fetch=cargo_deny::advisories::helpers::Fetch::Allow) at src/advisories/helpers.rs:100
#15 0x00005555559a2fcc in cargo_deny::advisories::helpers::{impl#0}::load::{closure#0}<std::path::PathBuf> (url=...) at /usr/src/debug/cargo-deny-0.11.0/src/advisories/helpers.rs:67
#16 0x00005555559a3175 in core::ops::function::impls::{impl#1}::call_mut<(url::Url), cargo_deny::advisories::helpers::{impl#0}::load::{closure#0}> (self=0x7ffff62be470, args=...)
    at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/core/src/ops/function.rs:247
#17 0x00005555559a31f5 in core::ops::function::impls::{impl#4}::call_once<(url::Url), &cargo_deny::advisories::helpers::{impl#0}::load::{closure#0}> (self=0x7ffff62be470, args=...)
    at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/core/src/ops/function.rs:280
#18 0x000055555591e72c in core::option::Option<url::Url>::map<url::Url, core::result::Result<(url::Url, rustsec::database::Database), anyhow::Error>, &mut &cargo_deny::advisories::helpers::{impl#0}::load::{closure#0}> (self=...,
    f=0x7ffff62be470) at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/core/src/option.rs:846
#19 0x000055555585e0b8 in core::iter::adapters::map::{impl#2}::next<core::result::Result<(url::Url, rustsec::database::Database), anyhow::Error>, rayon::vec::SliceDrain<url::Url>, &cargo_deny::advisories::helpers::{impl#0}::load::{closure#0}> (self=0x7ffff62be460) at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/core/src/iter/adapters/map.rs:103
#20 0x000055555587739f in rayon::iter::plumbing::Folder::consume_iter<rayon::iter::collect::consumer::CollectResult<core::result::Result<(url::Url, rustsec::database::Database), anyhow::Error>>, core::result::Result<(url::Url, rustsec::database::Database), anyhow::Error>, core::iter::adapters::map::Map<rayon::vec::SliceDrain<url::Url>, &cargo_deny::advisories::helpers::{impl#0}::load::{closure#0}>> (self=..., iter=...)
    at /home/jplatte/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/rayon-1.5.1/src/iter/plumbing/mod.rs:178
#21 0x0000555555881f84 in rayon::iter::map::{impl#8}::consume_iter<url::Url, core::result::Result<(url::Url, rustsec::database::Database), anyhow::Error>, rayon::iter::collect::consumer::CollectResult<core::result::Result<(url::Url, rustsec::database::Database), anyhow::Error>>, cargo_deny::advisories::helpers::{impl#0}::load::{closure#0}, rayon::vec::SliceDrain<url::Url>> (self=..., iter=...)
    at /home/jplatte/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/rayon-1.5.1/src/iter/map.rs:248
#22 0x000055555594af6a in rayon::iter::plumbing::Producer::fold_with<rayon::vec::DrainProducer<url::Url>, rayon::iter::map::MapFolder<rayon::iter::collect::consumer::CollectResult<core::result::Result<(url::Url, rustsec::database::Database), anyhow::Error>>, cargo_deny::advisories::helpers::{impl#0}::load::{closure#0}>> (self=..., folder=...) at /home/jplatte/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/rayon-1.5.1/src/iter/plumbing/mod.rs:110
#23 0x00005555558c6fc8 in rayon::iter::plumbing::bridge_producer_consumer::helper<rayon::vec::DrainProducer<url::Url>, rayon::iter::map::MapConsumer<rayon::iter::collect::consumer::CollectConsumer<core::result::Result<(url::Url, rustsec::database::Database), anyhow::Error>>, cargo_deny::advisories::helpers::{impl#0}::load::{closure#0}>> (len=1, migrated=false, splitter=..., producer=..., consumer=...)
    at /home/jplatte/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/rayon-1.5.1/src/iter/plumbing/mod.rs:438
#24 0x00005555558c695d in rayon::iter::plumbing::bridge_producer_consumer<rayon::vec::DrainProducer<url::Url>, rayon::iter::map::MapConsumer<rayon::iter::collect::consumer::CollectConsumer<core::result::Result<(url::Url, rustsec::database::Database), anyhow::Error>>, cargo_deny::advisories::helpers::{impl#0}::load::{closure#0}>> (len=1, producer=..., consumer=...) at /home/jplatte/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/rayon-1.5.1/src/iter/plumbing/mod.rs:397
#25 0x00005555558c6841 in rayon::iter::plumbing::bridge::{impl#0}::callback<rayon::iter::map::MapConsumer<rayon::iter::collect::consumer::CollectConsumer<core::result::Result<(url::Url, rustsec::database::Database), anyhow::Error>>, cargo_deny::advisories::helpers::{impl#0}::load::{closure#0}>, url::Url, rayon::vec::DrainProducer<url::Url>> (self=..., producer=...) at /home/jplatte/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/rayon-1.5.1/src/iter/plumbing/mod.rs:373
#26 0x000055555594b150 in rayon::vec::{impl#7}::with_producer<url::Url, rayon::iter::plumbing::bridge::Callback<rayon::iter::map::MapConsumer<rayon::iter::collect::consumer::CollectConsumer<core::result::Result<(url::Url, rustsec::database::Database), anyhow::Error>>, cargo_deny::advisories::helpers::{impl#0}::load::{closure#0}>>> (self=..., callback=...) at /home/jplatte/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/rayon-1.5.1/src/vec.rs:153
#27 0x000055555594b44b in rayon::vec::{impl#4}::with_producer<url::Url, rayon::iter::plumbing::bridge::Callback<rayon::iter::map::MapConsumer<rayon::iter::collect::consumer::CollectConsumer<core::result::Result<(url::Url, rustsec::database::Database), anyhow::Error>>, cargo_deny::advisories::helpers::{impl#0}::load::{closure#0}>>> (self=..., callback=...) at /home/jplatte/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/rayon-1.5.1/src/vec.rs:83
#28 0x00005555558c736b in rayon::iter::plumbing::bridge<rayon::vec::IntoIter<url::Url>, rayon::iter::map::MapConsumer<rayon::iter::collect::consumer::CollectConsumer<core::result::Result<(url::Url, rustsec::database::Database), anyhow::Error>>, cargo_deny::advisories::helpers::{impl#0}::load::{closure#0}>> (par_iter=..., consumer=...) at /home/jplatte/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/rayon-1.5.1/src/iter/plumbing/mod.rs:357
#29 0x000055555594b50e in rayon::vec::{impl#4}::drive<url::Url, rayon::iter::map::MapConsumer<rayon::iter::collect::consumer::CollectConsumer<core::result::Result<(url::Url, rustsec::database::Database), anyhow::Error>>, cargo_deny::advisories::helpers::{impl#0}::load::{closure#0}>> (self=..., consumer=...) at /home/jplatte/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/rayon-1.5.1/src/vec.rs:71
#30 0x0000555555881e54 in rayon::iter::map::{impl#3}::drive<rayon::vec::IntoIter<url::Url>, cargo_deny::advisories::helpers::{impl#0}::load::{closure#0}, core::result::Result<(url::Url, rustsec::database::Database), anyhow::Error>, rayon::iter::collect::consumer::CollectConsumer<core::result::Result<(url::Url, rustsec::database::Database), anyhow::Error>>> (self=..., consumer=...) at /home/jplatte/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/rayon-1.5.1/src/iter/map.rs:68
#31 0x0000555555929da9 in rayon::iter::collect::collect_into_vec::{closure#0}<rayon::iter::map::Map<rayon::vec::IntoIter<url::Url>, cargo_deny::advisories::helpers::{impl#0}::load::{closure#0}>, core::result::Result<(url::Url, rustsec::database::Database), anyhow::Error>> (consumer=...) at /home/jplatte/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/rayon-1.5.1/src/iter/collect/mod.rs:22
#32 0x000055555592990a in rayon::iter::collect::Collect<core::result::Result<(url::Url, rustsec::database::Database), anyhow::Error>>::with_consumer<core::result::Result<(url::Url, rustsec::database::Database), anyhow::Error>, rayon::iter::collect::collect_into_vec::{closure#0}> (self=..., scope_fn=...) at /home/jplatte/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/rayon-1.5.1/src/iter/collect/mod.rs:93
#33 0x0000555555929d2f in rayon::iter::collect::collect_into_vec<rayon::iter::map::Map<rayon::vec::IntoIter<url::Url>, cargo_deny::advisories::helpers::{impl#0}::load::{closure#0}>, core::result::Result<(url::Url, rustsec::database::Database), anyhow::Error>> (pi=..., v=0x7ffff62bf828) at /home/jplatte/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/rayon-1.5.1/src/iter/collect/mod.rs:22
#34 0x0000555555881d00 in rayon::iter::IndexedParallelIterator::collect_into_vec<rayon::iter::map::Map<rayon::vec::IntoIter<url::Url>, cargo_deny::advisories::helpers::{impl#0}::load::{closure#0}>> (self=..., target=0x7ffff62bf828)
    at /home/jplatte/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/rayon-1.5.1/src/iter/mod.rs:2264
#35 0x00005555559a2d57 in cargo_deny::advisories::helpers::DbSet::load<std::path::PathBuf> (root=..., urls=..., fetch=cargo_deny::advisories::helpers::Fetch::Allow) at /usr/src/debug/cargo-deny-0.11.0/src/advisories/helpers.rs:66
#36 0x0000555555a0afea in cargo_deny::check::cmd::{closure#4}::{closure#1} () at src/cargo-deny/check.rs:250
#37 0x00005555558794ec in rayon_core::scope::{impl#0}::spawn::{closure#0}::{closure#0}<cargo_deny::check::cmd::{closure#4}::{closure#1}> ()
    at /home/jplatte/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/rayon-core-1.9.1/src/scope/mod.rs:544
#38 0x00005555559a5c50 in core::panic::unwind_safe::{impl#23}::call_once<(), rayon_core::scope::{impl#0}::spawn::{closure#0}::{closure#0}> (self=..., _args=())
    at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/core/src/panic/unwind_safe.rs:271
#39 0x000055555584421e in std::panicking::try::do_call<core::panic::unwind_safe::AssertUnwindSafe<rayon_core::scope::{impl#0}::spawn::{closure#0}::{closure#0}>, ()> (data=0x7ffff62bfc18)
    at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/std/src/panicking.rs:406
#40 0x0000555555845d0b in __rust_try ()
#41 0x00005555558424ab in std::panicking::try<(), core::panic::unwind_safe::AssertUnwindSafe<rayon_core::scope::{impl#0}::spawn::{closure#0}::{closure#0}>> (f=...)
    at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/std/src/panicking.rs:370
#42 0x000055555594aa70 in std::panic::catch_unwind<core::panic::unwind_safe::AssertUnwindSafe<rayon_core::scope::{impl#0}::spawn::{closure#0}::{closure#0}>, ()> (f=...)
    at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/std/src/panic.rs:133
#43 0x000055555584baf4 in rayon_core::unwind::halt_unwinding<rayon_core::scope::{impl#0}::spawn::{closure#0}::{closure#0}, ()> (func=...) at /home/jplatte/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/rayon-core-1.9.1/src/unwind.rs:17
#44 0x000055555587ad01 in rayon_core::scope::ScopeBase::execute_job_closure<rayon_core::scope::{impl#0}::spawn::{closure#0}::{closure#0}, ()> (self=0x7ffff60bdd08, func=...)
    at /home/jplatte/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/rayon-core-1.9.1/src/scope/mod.rs:650
#45 0x000055555587a2fa in rayon_core::scope::ScopeBase::execute_job<rayon_core::scope::{impl#0}::spawn::{closure#0}::{closure#0}> (self=0x7ffff60bdd08, func=...)
    at /home/jplatte/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/rayon-core-1.9.1/src/scope/mod.rs:640
#46 0x000055555587920d in rayon_core::scope::{impl#0}::spawn::{closure#0}<cargo_deny::check::cmd::{closure#4}::{closure#1}> () at /home/jplatte/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/rayon-core-1.9.1/src/scope/mod.rs:544
#47 0x00005555558daa9a in rayon_core::job::{impl#6}::execute<rayon_core::scope::{impl#0}::spawn::{closure#0}> (this=0x7fffc0000c30) at /home/jplatte/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/rayon-core-1.9.1/src/job.rs:167
#48 0x00005555562caf4e in rayon_core::job::JobRef::execute (self=0x7ffff62bff40) at /home/jplatte/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/rayon-core-1.9.1/src/job.rs:59
#49 0x00005555562d9aaa in rayon_core::registry::WorkerThread::execute (self=0x7ffff62c0200, job=...) at /home/jplatte/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/rayon-core-1.9.1/src/registry.rs:749
#50 0x00005555562d982a in rayon_core::registry::WorkerThread::wait_until_cold (self=0x7ffff62c0200, latch=0x55555723ca50) at /home/jplatte/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/rayon-core-1.9.1/src/registry.rs:726
#51 0x00005555562d95bc in rayon_core::registry::WorkerThread::wait_until<rayon_core::latch::CountLatch> (self=0x7ffff62c0200, latch=0x55555723ca50)
    at /home/jplatte/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/rayon-core-1.9.1/src/registry.rs:700
#52 0x00005555562da396 in rayon_core::registry::main_loop (worker=..., registry=..., index=10) at /home/jplatte/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/rayon-core-1.9.1/src/registry.rs:833
#53 0x00005555562d6eed in rayon_core::registry::ThreadBuilder::run (self=...) at /home/jplatte/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/rayon-core-1.9.1/src/registry.rs:55
#54 0x00005555562d740d in rayon_core::registry::{impl#2}::spawn::{closure#0} () at /home/jplatte/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/rayon-core-1.9.1/src/registry.rs:100
#55 0x00005555562bdcc0 in std::sys_common::backtrace::__rust_begin_short_backtrace<rayon_core::registry::{impl#2}::spawn::{closure#0}, ()> (f=...)
    at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/std/src/sys_common/backtrace.rs:123
#56 0x00005555562e6b8d in std::thread::{impl#0}::spawn_unchecked::{closure#1}::{closure#0}<rayon_core::registry::{impl#2}::spawn::{closure#0}, ()> () at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/std/src/thread/mod.rs:484
#57 0x00005555562e0e01 in core::panic::unwind_safe::{impl#23}::call_once<(), std::thread::{impl#0}::spawn_unchecked::{closure#1}::{closure#0}> (self=..., _args=())
    at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/core/src/panic/unwind_safe.rs:271
#58 0x00005555562db81c in std::panicking::try::do_call<core::panic::unwind_safe::AssertUnwindSafe<std::thread::{impl#0}::spawn_unchecked::{closure#1}::{closure#0}>, ()> (data=0x7ffff62c0938)
    at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/std/src/panicking.rs:406
#59 0x00005555562de3ab in __rust_try ()
#60 0x00005555562db447 in std::panicking::try<(), core::panic::unwind_safe::AssertUnwindSafe<std::thread::{impl#0}::spawn_unchecked::{closure#1}::{closure#0}>> (f=...)
    at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/std/src/panicking.rs:370
#61 0x000055555629e991 in std::panic::catch_unwind<core::panic::unwind_safe::AssertUnwindSafe<std::thread::{impl#0}::spawn_unchecked::{closure#1}::{closure#0}>, ()> (f=...)
    at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/std/src/panic.rs:133
#62 0x00005555562e5dd1 in std::thread::{impl#0}::spawn_unchecked::{closure#1}<rayon_core::registry::{impl#2}::spawn::{closure#0}, ()> () at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/std/src/thread/mod.rs:483
#63 0x00005555562be08f in core::ops::function::FnOnce::call_once<std::thread::{impl#0}::spawn_unchecked::{closure#1}, ()> () at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/core/src/ops/function.rs:227
#64 0x0000555556ad1443 in alloc::boxed::{impl#44}::call_once<(), dyn core::ops::function::FnOnce<(), Output=()>, alloc::alloc::Global> () at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/alloc/src/boxed.rs:1694
#65 alloc::boxed::{impl#44}::call_once<(), alloc::boxed::Box<dyn core::ops::function::FnOnce<(), Output=()>, alloc::alloc::Global>, alloc::alloc::Global> () at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/alloc/src/boxed.rs:1694
#66 std::sys::unix::thread::{impl#2}::new::thread_start () at library/std/src/sys/unix/thread.rs:106
#67 0x00007ffff7e44259 in start_thread () from /usr/lib/libpthread.so.0
#68 0x00007ffff7c225e3 in clone () from /usr/lib/libc.so.6

@Jake-Shadle
Copy link
Member

This looks to be an issue for others cloudflare/wrangler-legacy#1464, possibly from rust-lang/rust#83994? I'm not really sure what options are available to workaround this, but I suppose you might try pulling the fetch into the main thread and see if waiting on it there might reduce/eliminate the problem?

I've never gotten this before so it might be something that is different between versions of openssl/libgit2 on arch versus my distro, but since I can't repro it I'm going to defer to you or someone who can repro it to provide a workaround/fix.

@jplatte
Copy link
Contributor Author

jplatte commented Jan 28, 2022

I suppose you might try pulling the fetch into the main thread and see if waiting on it there might reduce/eliminate the problem?

What is "the fetch" here?

@Jake-Shadle
Copy link
Member

The code in that callstack is fetching https://github.com/rustsec/advisory-db to disk to check the crate graph for advisories.

@jplatte
Copy link
Contributor Author

jplatte commented Jan 28, 2022

Hm, I don't think I want to take the time right now to go through the code and patch cargo-deny myself, especially considering it (somehow) works when installed the easy (when developing) way.

Might revisit at some later point.

@Jake-Shadle Jake-Shadle changed the title Segmentation fault when run on a project without config file Segfault due to openssl shenanigans Jan 28, 2022
@jplatte
Copy link
Contributor Author

jplatte commented Feb 22, 2022

I've looked into it and there's multiple lifetime transmutations going on. I wouldn't be surprised if that's related to the issue at hand.

@nightkr
Copy link

nightkr commented Feb 23, 2022

The advisory check seems to have broken with Arch's libgit2 1:1.4.1-1, even when building using cargo build.

gdb backtrace
#0  0x00007ffff7ed9fc0 in ?? () from /usr/lib/libgit2.so.1.4
#1  0x00007ffff7edbaae in git_remote_fetch () from /usr/lib/libgit2.so.1.4
#2  0x000055555654f162 in git2::remote::Remote::fetch<&str> (self=0x7ffff4aaa5b8, refspecs=..., opts=..., reflog_msg=...) at /home/teo/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/git2-0.13.25/src/remote.rs:286
#3  0x00005555564ba3bb in rustsec::repository::git::repository::{impl#0}::fetch::{closure#0}<&std::path::PathBuf> (f=...)
    at /home/teo/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/rustsec-0.25.1/src/repository/git/repository.rs:94
#4  0x0000555556463b37 in rustsec::repository::git::authentication::with_authentication<(), rustsec::repository::git::repository::{impl#0}::fetch::{closure#0}> (url=..., cfg=0x7ffff4aab9b8, f=...)
    at /home/teo/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/rustsec-0.25.1/src/repository/git/authentication.rs:48
#5  0x00005555564b92c8 in rustsec::repository::git::repository::Repository::fetch<&std::path::PathBuf> (url=..., into_path=0x7ffff4aac330, ensure_fresh=true)
    at /home/teo/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/rustsec-0.25.1/src/repository/git/repository.rs:77
#6  0x0000555555c0bc75 in cargo_deny::advisories::helpers::load_db (db_url=0x7ffff4aacb88, root_db_path=..., fetch=cargo_deny::advisories::helpers::Fetch::Allow) at src/advisories/helpers.rs:100
#7  0x00005555559d0bbc in cargo_deny::advisories::helpers::{impl#0}::load::{closure#0}<std::path::PathBuf> (url=...) at /home/teo/Documents/stackable/cargo-deny/src/advisories/helpers.rs:67
#8  0x00005555559d0d65 in core::ops::function::impls::{impl#1}::call_mut<(url::Url), cargo_deny::advisories::helpers::{impl#0}::load::{closure#0}> (self=0x7ffff4aad078, args=...)
    at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/core/src/ops/function.rs:247
#9  0x00005555559d0de5 in core::ops::function::impls::{impl#4}::call_once<(url::Url), &cargo_deny::advisories::helpers::{impl#0}::load::{closure#0}> (self=0x7ffff4aad078, args=...)
    at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/core/src/ops/function.rs:280
#10 0x000055555578d7bc in core::option::Option<url::Url>::map<url::Url, core::result::Result<(url::Url, rustsec::database::Database), anyhow::Error>, &mut &cargo_deny::advisories::helpers::{impl#0}::load::{closure#0}> (self=..., f=0x7ffff4aad078) at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/core/src/option.rs:836
#11 0x00005555557db418 in core::iter::adapters::map::{impl#2}::next<core::result::Result<(url::Url, rustsec::database::Database), anyhow::Error>, rayon::vec::SliceDrain<url::Url>, &cargo_deny::advisories::helpers::{impl#0}::load::{closure#0}> (self=0x7ffff4aad068) at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/core/src/iter/adapters/map.rs:103
#12 0x00005555558cf58a in rayon::iter::plumbing::Folder::consume_iter<rayon::iter::collect::consumer::CollectResult<core::result::Result<(url::Url, rustsec::database::Database), anyhow::Error>>, core::result::Result<(url::Url, rustsec::database::Database), anyhow::Error>, core::iter::adapters::map::Map<rayon::vec::SliceDrain<url::Url>, &cargo_deny::advisories::helpers::{impl#0}::load::{closure#0}>> (self=..., iter=...)
    at /home/teo/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/rayon-1.5.1/src/iter/plumbing/mod.rs:178
#13 0x00005555558b69f4 in rayon::iter::map::{impl#8}::consume_iter<url::Url, core::result::Result<(url::Url, rustsec::database::Database), anyhow::Error>, rayon::iter::collect::consumer::CollectResult<core::result::Result<(url::Url, rustsec::database::Database), anyhow::Error>>, cargo_deny::advisories::helpers::{impl#0}::load::{closure#0}, rayon::vec::SliceDrain<url::Url>> (self=..., iter=...)
    at /home/teo/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/rayon-1.5.1/src/iter/map.rs:248
#14 0x00005555559ca6ba in rayon::iter::plumbing::Producer::fold_with<rayon::vec::DrainProducer<url::Url>, rayon::iter::map::MapFolder<rayon::iter::collect::consumer::CollectResult<core::result::Result<(url::Url, rustsec::database::Database), anyhow::Error>>, cargo_deny::advisories::helpers::{impl#0}::load::{closure#0}>> (self=..., folder=...)
    at /home/teo/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/rayon-1.5.1/src/iter/plumbing/mod.rs:110
#15 0x000055555588f798 in rayon::iter::plumbing::bridge_producer_consumer::helper<rayon::vec::DrainProducer<url::Url>, rayon::iter::map::MapConsumer<rayon::iter::collect::consumer::CollectConsumer<core::result::Result<(url::Url, rustsec::database::Database), anyhow::Error>>, cargo_deny::advisories::helpers::{impl#0}::load::{closure#0}>> (len=1, migrated=false, splitter=..., producer=..., consumer=...)
    at /home/teo/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/rayon-1.5.1/src/iter/plumbing/mod.rs:438
#16 0x000055555588f12d in rayon::iter::plumbing::bridge_producer_consumer<rayon::vec::DrainProducer<url::Url>, rayon::iter::map::MapConsumer<rayon::iter::collect::consumer::CollectConsumer<core::result::Result<(url::Url, rustsec::database::Database), anyhow::Error>>, cargo_deny::advisories::helpers::{impl#0}::load::{closure#0}>> (len=1, producer=..., consumer=...)
    at /home/teo/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/rayon-1.5.1/src/iter/plumbing/mod.rs:397
#17 0x000055555588f011 in rayon::iter::plumbing::bridge::{impl#0}::callback<rayon::iter::map::MapConsumer<rayon::iter::collect::consumer::CollectConsumer<core::result::Result<(url::Url, rustsec::database::Database), anyhow::Error>>, cargo_deny::advisories::helpers::{impl#0}::load::{closure#0}>, url::Url, rayon::vec::DrainProducer<url::Url>> (self=..., producer=...)
    at /home/teo/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/rayon-1.5.1/src/iter/plumbing/mod.rs:373
#18 0x00005555559ca8a0 in rayon::vec::{impl#7}::with_producer<url::Url, rayon::iter::plumbing::bridge::Callback<rayon::iter::map::MapConsumer<rayon::iter::collect::consumer::CollectConsumer<core::result::Result<(url::Url, rustsec::database::Database), anyhow::Error>>, cargo_deny::advisories::helpers::{impl#0}::load::{closure#0}>>> (self=..., callback=...)
    at /home/teo/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/rayon-1.5.1/src/vec.rs:153
#19 0x00005555559cab9b in rayon::vec::{impl#4}::with_producer<url::Url, rayon::iter::plumbing::bridge::Callback<rayon::iter::map::MapConsumer<rayon::iter::collect::consumer::CollectConsumer<core::result::Result<(url::Url, rustsec::database::Database), anyhow::Error>>, cargo_deny::advisories::helpers::{impl#0}::load::{closure#0}>>> (self=..., callback=...)
    at /home/teo/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/rayon-1.5.1/src/vec.rs:83
#20 0x000055555588fb3b in rayon::iter::plumbing::bridge<rayon::vec::IntoIter<url::Url>, rayon::iter::map::MapConsumer<rayon::iter::collect::consumer::CollectConsumer<core::result::Result<(url::Url, rustsec::database::Database), anyhow::Error>>, cargo_deny::advisories::helpers::{impl#0}::load::{closure#0}>> (par_iter=..., consumer=...)
    at /home/teo/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/rayon-1.5.1/src/iter/plumbing/mod.rs:357
#21 0x00005555559cac5e in rayon::vec::{impl#4}::drive<url::Url, rayon::iter::map::MapConsumer<rayon::iter::collect::consumer::CollectConsumer<core::result::Result<(url::Url, rustsec::database::Database), anyhow::Error>>, cargo_deny::advisories::helpers::{impl#0}::load::{closure#0}>> (self=..., consumer=...) at /home/teo/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/rayon-1.5.1/src/vec.rs:71
#22 0x00005555558b68c4 in rayon::iter::map::{impl#3}::drive<rayon::vec::IntoIter<url::Url>, cargo_deny::advisories::helpers::{impl#0}::load::{closure#0}, core::result::Result<(url::Url, rustsec::database::Database), anyhow::Error>, rayon::iter::collect::consumer::CollectConsumer<core::result::Result<(url::Url, rustsec::database::Database), anyhow::Error>>> (self=..., consumer=...)
    at /home/teo/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/rayon-1.5.1/src/iter/map.rs:68
#23 0x00005555559a9779 in rayon::iter::collect::collect_into_vec::{closure#0}<rayon::iter::map::Map<rayon::vec::IntoIter<url::Url>, cargo_deny::advisories::helpers::{impl#0}::load::{closure#0}>, core::result::Result<(url::Url, rustsec::database::Database), anyhow::Error>> (consumer=...) at /home/teo/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/rayon-1.5.1/src/iter/collect/mod.rs:22
#24 0x00005555559a92da in rayon::iter::collect::Collect<core::result::Result<(url::Url, rustsec::database::Database), anyhow::Error>>::with_consumer<core::result::Result<(url::Url, rustsec::database::Database), anyhow::Error>, rayon::iter::collect::collect_into_vec::{closure#0}> (self=..., scope_fn=...) at /home/teo/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/rayon-1.5.1/src/iter/collect/mod.rs:93
#25 0x00005555559a96ff in rayon::iter::collect::collect_into_vec<rayon::iter::map::Map<rayon::vec::IntoIter<url::Url>, cargo_deny::advisories::helpers::{impl#0}::load::{closure#0}>, core::result::Result<(url::Url, rustsec::database::Database), anyhow::Error>> (pi=..., v=0x7ffff4aae818) at /home/teo/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/rayon-1.5.1/src/iter/collect/mod.rs:22
#26 0x00005555558b6770 in rayon::iter::IndexedParallelIterator::collect_into_vec<rayon::iter::map::Map<rayon::vec::IntoIter<url::Url>, cargo_deny::advisories::helpers::{impl#0}::load::{closure#0}>> (self=..., target=0x7ffff4aae818) at /home/teo/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/rayon-1.5.1/src/iter/mod.rs:2264
#27 0x00005555559d0947 in cargo_deny::advisories::helpers::DbSet::load<std::path::PathBuf> (root=..., urls=..., fetch=cargo_deny::advisories::helpers::Fetch::Allow) at /home/teo/Documents/stackable/cargo-deny/src/advisories/helpers.rs:66
#28 0x00005555559c235a in cargo_deny::check::cmd::{closure#4}::{closure#1} () at src/cargo-deny/check.rs:250
#29 0x0000555555a0294c in rayon_core::scope::{impl#0}::spawn::{closure#0}::{closure#0}<cargo_deny::check::cmd::{closure#4}::{closure#1}> () at /home/teo/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/rayon-core-1.9.1/src/scope/mod.rs:544
#30 0x00005555559ea540 in core::panic::unwind_safe::{impl#23}::call_once<(), rayon_core::scope::{impl#0}::spawn::{closure#0}::{closure#0}> (self=..., _args=()) at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/core/src/panic/unwind_safe.rs:271
#31 0x00005555558bea1e in std::panicking::try::do_call<core::panic::unwind_safe::AssertUnwindSafe<rayon_core::scope::{impl#0}::spawn::{closure#0}::{closure#0}>, ()> (data=0x7ffff4aaec18) at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/std/src/panicking.rs:403
#32 0x00005555558c061b in __rust_try ()
#33 0x00005555558bcfbb in std::panicking::try<(), core::panic::unwind_safe::AssertUnwindSafe<rayon_core::scope::{impl#0}::spawn::{closure#0}::{closure#0}>> (f=...) at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/std/src/panicking.rs:367
#34 0x00005555558c44d0 in std::panic::catch_unwind<core::panic::unwind_safe::AssertUnwindSafe<rayon_core::scope::{impl#0}::spawn::{closure#0}::{closure#0}>, ()> (f=...) at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/std/src/panic.rs:129
#35 0x00005555559ca014 in rayon_core::unwind::halt_unwinding<rayon_core::scope::{impl#0}::spawn::{closure#0}::{closure#0}, ()> (func=...) at /home/teo/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/rayon-core-1.9.1/src/unwind.rs:17
#36 0x0000555555a038a1 in rayon_core::scope::ScopeBase::execute_job_closure<rayon_core::scope::{impl#0}::spawn::{closure#0}::{closure#0}, ()> (self=0x7ffff4caed08, func=<error reading variable: Cannot access memory at address 0x1>) at /home/teo/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/rayon-core-1.9.1/src/scope/mod.rs:650
#37 0x0000555555a031ba in rayon_core::scope::ScopeBase::execute_job<rayon_core::scope::{impl#0}::spawn::{closure#0}::{closure#0}> (self=0x7ffff4caed08, func=...) at /home/teo/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/rayon-core-1.9.1/src/scope/mod.rs:640
#38 0x0000555555a0241d in rayon_core::scope::{impl#0}::spawn::{closure#0}<cargo_deny::check::cmd::{closure#4}::{closure#1}> () at /home/teo/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/rayon-core-1.9.1/src/scope/mod.rs:544
#39 0x000055555599ee3a in rayon_core::job::{impl#6}::execute<rayon_core::scope::{impl#0}::spawn::{closure#0}> (this=0x7fff98000c40) at /home/teo/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/rayon-core-1.9.1/src/job.rs:167
#40 0x00005555562e19fe in rayon_core::job::JobRef::execute (self=0x7ffff4aaef40) at /home/teo/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/rayon-core-1.9.1/src/job.rs:59
#41 0x00005555562eb14a in rayon_core::registry::WorkerThread::execute (self=0x7ffff4aaf200, job=...) at /home/teo/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/rayon-core-1.9.1/src/registry.rs:749
#42 0x00005555562eaeca in rayon_core::registry::WorkerThread::wait_until_cold (self=0x7ffff4aaf200, latch=0x555557176b90) at /home/teo/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/rayon-core-1.9.1/src/registry.rs:726
#43 0x00005555562eabfc in rayon_core::registry::WorkerThread::wait_until<rayon_core::latch::CountLatch> (self=0x7ffff4aaf200, latch=0x555557176b90) at /home/teo/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/rayon-core-1.9.1/src/registry.rs:700
#44 0x00005555562eba36 in rayon_core::registry::main_loop (worker=..., registry=..., index=22) at /home/teo/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/rayon-core-1.9.1/src/registry.rs:833
#45 0x00005555562e845d in rayon_core::registry::ThreadBuilder::run (self=...) at /home/teo/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/rayon-core-1.9.1/src/registry.rs:55
#46 0x00005555562e897d in rayon_core::registry::{impl#2}::spawn::{closure#0} () at /home/teo/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/rayon-core-1.9.1/src/registry.rs:100
#47 0x00005555562ab880 in std::sys_common::backtrace::__rust_begin_short_backtrace<rayon_core::registry::{impl#2}::spawn::{closure#0}, ()> (f=...) at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/std/src/sys_common/backtrace.rs:125
#48 0x00005555562b708d in std::thread::{impl#0}::spawn_unchecked::{closure#0}::{closure#0}<rayon_core::registry::{impl#2}::spawn::{closure#0}, ()> () at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/std/src/thread/mod.rs:481
#49 0x00005555562ec281 in core::panic::unwind_safe::{impl#23}::call_once<(), std::thread::{impl#0}::spawn_unchecked::{closure#0}::{closure#0}> (self=..., _args=()) at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/core/src/panic/unwind_safe.rs:271
#50 0x00005555562ece2c in std::panicking::try::do_call<core::panic::unwind_safe::AssertUnwindSafe<std::thread::{impl#0}::spawn_unchecked::{closure#0}::{closure#0}>, ()> (data=0x7ffff4aaf938) at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/std/src/panicking.rs:403
#51 0x00005555562ef7eb in __rust_try ()
#52 0x00005555562ecc47 in std::panicking::try<(), core::panic::unwind_safe::AssertUnwindSafe<std::thread::{impl#0}::spawn_unchecked::{closure#0}::{closure#0}>> (f=...) at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/std/src/panicking.rs:367
#53 0x00005555562ace31 in std::panic::catch_unwind<core::panic::unwind_safe::AssertUnwindSafe<std::thread::{impl#0}::spawn_unchecked::{closure#0}::{closure#0}>, ()> (f=...) at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/std/src/panic.rs:129
#54 0x00005555562b6eb1 in std::thread::{impl#0}::spawn_unchecked::{closure#0}<rayon_core::registry::{impl#2}::spawn::{closure#0}, ()> () at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/std/src/thread/mod.rs:480
#55 0x00005555562d1baf in core::ops::function::FnOnce::call_once<std::thread::{impl#0}::spawn_unchecked::{closure#0}, ()> () at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/core/src/ops/function.rs:227
#56 0x0000555556a4f9b3 in alloc::boxed::{impl#44}::call_once<(), dyn core::ops::function::FnOnce<(), Output=()>, alloc::alloc::Global> () at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/alloc/src/boxed.rs:1636
#57 alloc::boxed::{impl#44}::call_once<(), alloc::boxed::Box<dyn core::ops::function::FnOnce<(), Output=()>, alloc::alloc::Global>, alloc::alloc::Global> () at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/alloc/src/boxed.rs:1636
#58 std::sys::unix::thread::{impl#2}::new::thread_start () at library/std/src/sys/unix/thread.rs:106
#59 0x00007ffff7bb65c2 in start_thread () from /usr/lib/libc.so.6
#60 0x00007ffff7c3b584 in clone () from /usr/lib/libc.so.6

Downgrading to libgit2 1:1.3.0-1 and cargo clean && cargo build seems to fix it.

@MarijnS95
Copy link

Same crash as @teozkr since Arch's libgit2 1:1.4.1-1, with some extra info through the recently-enabled debuginfod. No SSL crash for us, but inside the same git_remote_fetch path:

GDB backtrace
Core was generated by `/home/marijn/.cargo/bin/cargo-deny deny --workspace check'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  validate_custom_headers (custom_headers=<optimized out>) at /usr/src/debug/libgit2-1.4.1/src/remote.c:847
Downloading 0.07 MB source file /usr/src/debug/libgit2-1.4.1/src/remote.c
847			if (is_malformed_http_header(custom_headers->strings[i])) {
[Current thread is 1 (Thread 0x7fabcf9fc640 (LWP 711322))]
(gdb) bt
#0  validate_custom_headers (custom_headers=<optimized out>) at /usr/src/debug/libgit2-1.4.1/src/remote.c:847
#1  git_remote_connect_options_normalize (dst=dst@entry=0x7fabcf9f9460, repo=0x7faba00fb5f0, src=0x7fabcf9f9520)
    at /usr/src/debug/libgit2-1.4.1/src/remote.c:914
#2  0x00007fac97686aae in connect_opts_from_fetch_opts (remote=0x7faba0103050, remote=0x7faba0103050, fetch_opts=0x7fabcf9f97a8,
    out=0x7fabcf9f9460) at /usr/src/debug/libgit2-1.4.1/src/remote.c:1243
#3  git_remote_fetch (remote=0x7faba0103050, refspecs=0x7fabcf9f96b0, opts=0x7fabcf9f97a8, reflog_message=0x0)
    at /usr/src/debug/libgit2-1.4.1/src/remote.c:1361
#4  0x000055cc54271e48 in git2::remote::Remote::fetch ()
#5  0x000055cc5424824e in rustsec::repository::git::repository::Repository::fetch::{{closure}} ()
#6  0x000055cc54247667 in rustsec::repository::git::authentication::with_authentication ()
#7  0x000055cc542623c6 in rustsec::repository::git::repository::Repository::fetch ()
#8  0x000055cc5407c0ba in cargo_deny::advisories::helpers::load_db ()
#9  0x000055cc53fa17db in rayon::iter::plumbing::Folder::consume_iter ()
#10 0x000055cc53fd4afe in <rayon::iter::map::MapFolder<C,F> as rayon::iter::plumbing::Folder<T>>::consume_iter ()
#11 0x000055cc53fb0059 in rayon::iter::plumbing::Producer::fold_with ()
#12 0x000055cc540023a9 in rayon::iter::plumbing::bridge_producer_consumer::helper ()
#13 0x000055cc53ffc1ca in <rayon::iter::plumbing::bridge::Callback<C> as rayon::iter::plumbing::ProducerCallback<I>>::callback ()
#14 0x000055cc53fb04e0 in <rayon::vec::IntoIter<T> as rayon::iter::IndexedParallelIterator>::with_producer ()
#15 0x000055cc540025ee in rayon::iter::plumbing::bridge ()
#16 0x000055cc53fb0579 in <rayon::vec::IntoIter<T> as rayon::iter::IndexedParallelIterator>::drive ()
#17 0x000055cc53fd4aa8 in <rayon::iter::map::Map<I,F> as rayon::iter::IndexedParallelIterator>::drive ()
#18 0x000055cc53fafefb in rayon::iter::collect::collect_into_vec ()
#19 0x000055cc53fd3694 in rayon::iter::IndexedParallelIterator::collect_into_vec ()
#20 0x000055cc53f9bae2 in cargo_deny::advisories::helpers::DbSet::load ()
#21 0x000055cc53fa9601 in <core::panic::unwind_safe::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once ()
#22 0x000055cc53fa4248 in std::panicking::try ()
#23 0x000055cc53fcf8b3 in std::panic::catch_unwind ()
#24 0x000055cc53ffc017 in rayon_core::unwind::halt_unwinding ()
#25 0x000055cc53f9d143 in rayon_core::scope::ScopeBase::execute_job ()
#26 0x000055cc53fc406e in <rayon_core::job::HeapJob<BODY> as rayon_core::job::Job>::execute ()
#27 0x000055cc541db9fb in rayon_core::registry::WorkerThread::wait_until_cold ()
#28 0x000055cc541da8e5 in rayon_core::registry::ThreadBuilder::run ()
#29 0x000055cc541dc99e in std::sys_common::backtrace::__rust_begin_short_backtrace ()
#30 0x000055cc541d83b7 in <core::panic::unwind_safe::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once ()
#31 0x000055cc541d866a in std::panicking::try ()
#32 0x000055cc541d96ec in std::panic::catch_unwind ()
#33 0x000055cc541dd5d3 in core::ops::function::FnOnce::call_once{{vtable.shim}} ()
#34 0x000055cc544b6b93 in alloc::boxed::{impl#44}::call_once<(), dyn core::ops::function::FnOnce<(), Output=()>, alloc::alloc::Global>
    () at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/alloc/src/boxed.rs:1694
#35 alloc::boxed::{impl#44}::call_once<(), alloc::boxed::Box<dyn core::ops::function::FnOnce<(), Output=()>, alloc::alloc::Global>, alloc::alloc::Global> () at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/alloc/src/boxed.rs:1694
#36 std::sys::unix::thread::{impl#2}::new::thread_start () at library/std/src/sys/unix/thread.rs:106
#37 0x00007fac973475c2 in start_thread () from /usr/lib/libc.so.6
#38 0x00007fac973cc584 in clone () from /usr/lib/libc.so.6

@MarijnS95
Copy link

rust-lang/git2-rs#813 A changed struct seems to be the cause this time around. Unfortunately cargo-deny can only update git2 (libgit2-sys) in parallel with crates-index and rustsec.

@Jake-Shadle Jake-Shadle changed the title Segfault due to openssl shenanigans Segfault due to libgit2 shenanigans Mar 2, 2022
@Jake-Shadle Jake-Shadle mentioned this issue Mar 9, 2022
3 tasks
@Purpzie
Copy link

Purpzie commented Mar 18, 2022

Until git2 can be upgraded to 0.14, adding its vendored feature in the meantime also seems to fix the issue. I haven't tested it with cargo-deny yet but it did work with cargo-edit.

@jplatte
Copy link
Contributor Author

jplatte commented Apr 25, 2022

Maybe an alternative to fixing the problems with libgit2 (which seems pretty hard) is switching to gitoxide instead?

@Jake-Shadle
Copy link
Member

I would be for that except there are 2 transitive dependencies on libgit2, one via cargo, and I doubt that will ever change.

@jplatte
Copy link
Contributor Author

jplatte commented Apr 25, 2022

Hm, well I haven't seem these segfaults in cargo itself. And I wouldn't think cargo itself will never change. There's actually a tracking issue for features cargo uses in the gitoxide repo.

@Jake-Shadle
Copy link
Member

If people are blocked by this, support for using the git cli was added in #420 which can be used to workaround this issue in the meantime.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants