Crash on Ctrl-C
jengelh opened this issue · 4 comments
Version: zypper-1.14.61-2.3.x86_64 libzypp-17.31.15-14.5.x86_64
OS: cpe:/o:opensuse:tumbleweed:20230724
SIGINT'ing zypper a few times can sometimes crash it. (At other times, it might hang, etc.)
# zypper in policycoreutils-devel
Loading repository data...
Reading installed packages...
Resolving package dependencies...
The following 7 NEW packages are going to be installed:
checkpolicy policycoreutils-devel python3-audit python3-policycoreutils python3-selinux python311-distro python311-semanage
7 new packages to install.
Overall download size: 2.5 MiB. Already cached: 0 B. After the operation, additional 6.1 MiB will be used.
Continue? [y/n/v/...? shows all options] (y):
Retrieving: checkpolicy-3.5-1.3.x86_64 (oss) (1/7), 307.0 KiB
Retrieving: checkpolicy-3.5-1.3.x86_64.rpm ........................................................................................[done]
Retrieving: python3-audit-3.1.1-1.1.x86_64 (oss) (2/7), 83.8 KiB
Retrieving: python3-audit-3.1.1-1.1.x86_64.rpm ....................................................................................[done]
^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^CSegmentation fault (core dumped)
Backtrace
Core was generated by `zypper in policycoreutils-devel'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0 __pthread_rwlock_wrlock_full64 (abstime=0x0, clockid=0, rwlock=0x0) at /usr/src/debug/glibc-2.37/nptl/pthread_rwlock_common.c:603
603 if (__glibc_unlikely (atomic_load_relaxed (&rwlock->__data.__cur_writer)
Missing separate debuginfos, use: zypper install libcurl4-debuginfo-8.1.2-1.1.x86_64 libgcc_s1-debuginfo-13.1.1+git7552-1.1.x86_64 libgcrypt20-debuginfo-1.10.2-2.2.x86_64 libkeyutils1-debuginfo-1.6.3-6.2.x86_64 libldap2-debuginfo-2.6.4-2.1.x86_64 libpcre2-8-0-debuginfo-10.42-3.8.x86_64
(gdb) bt
#0 __pthread_rwlock_wrlock_full64 (abstime=0x0, clockid=0, rwlock=0x0) at /usr/src/debug/glibc-2.37/nptl/pthread_rwlock_common.c:603
#1 ___pthread_rwlock_wrlock (rwlock=0x0) at pthread_rwlock_wrlock.c:26
#2 0x00007fde351bcc59 in CRYPTO_THREAD_write_lock (lock=<optimized out>) at crypto/threads_pthread.c:112
#3 0x00007fde351e8e63 in RAND_get_rand_method () at crypto/rand/rand_lib.c:192
#4 0x00007fde351e9a76 in RAND_status () at crypto/rand/rand_lib.c:301
#5 0x00007fde357c925c in ?? () from /lib64/libcurl.so.4
#6 0x00007fde357a2af1 in ?? () from /lib64/libcurl.so.4
#7 0x00007fde357a2b86 in ?? () from /lib64/libcurl.so.4
#8 0x00007fde3577a12a in ?? () from /lib64/libcurl.so.4
#9 0x00007fde35772e01 in ?? () from /lib64/libcurl.so.4
#10 0x00007fde357d95ee in ?? () from /lib64/libcurl.so.4
#11 0x00007fde3577577f in curl_easy_cleanup () from /lib64/libcurl.so.4
#12 0x00007fde361c91b1 in zypp::media::MediaCurl::disconnectFrom (this=0x55984b7712a0)
at /usr/src/debug/libzypp-17.31.15/zypp/media/MediaCurl.cc:706
#13 0x00007fde361a5a20 in zypp::media::MediaHandler::disconnect (this=0x55984b7712a0)
at /usr/src/debug/libzypp-17.31.15/zypp/media/MediaHandler.cc:691
#14 zypp::media::MediaHandler::disconnect (this=0x55984b7712a0) at /usr/src/debug/libzypp-17.31.15/zypp/media/MediaHandler.cc:686
#15 0x00007fde361a97a1 in zypp::media::MediaHandler::release (this=0x55984b7712a0, ejectDev="")
at /usr/src/debug/libzypp-17.31.15/zypp/media/MediaHandler.cc:722
#16 0x00007fde361dd1b4 in zypp::media::(anonymous namespace)::ManagedMedia::close (this=this@entry=0x55984eafccb8)
at /usr/src/debug/libzypp-17.31.15/zypp/media/MediaManager.cc:106
#17 0x00007fde361dd61e in zypp::media::(anonymous namespace)::ManagedMedia::~ManagedMedia (this=<optimized out>, this=<optimized out>)
at /usr/src/debug/libzypp-17.31.15/zypp/media/MediaManager.cc:51
#18 std::pair<unsigned int const, zypp::media::(anonymous namespace)::ManagedMedia>::~pair (this=<optimized out>, this=<optimized out>)
at /usr/include/c++/13/bits/stl_pair.h:187
#19 std::__new_allocator<std::_Rb_tree_node<std::pair<unsigned int const, zypp::media::(anonymous namespace)::ManagedMedia> > >::destroy<std::pair<unsigned int const, zypp::media::(anonymous namespace)::ManagedMedia> > (__p=0x55984eafccb0, this=0x55984eaf9278)
at /usr/include/c++/13/bits/new_allocator.h:194
#20 std::allocator_traits<std::allocator<std::_Rb_tree_node<std::pair<unsigned int const, zypp::media::(anonymous namespace)::ManagedMedia> > > >::destroy<std::pair<unsigned int const, zypp::media::(anonymous namespace)::ManagedMedia> > (__p=0x55984eafccb0, __a=...)
at /usr/include/c++/13/bits/alloc_traits.h:557
#21 std::_Rb_tree<unsigned int, std::pair<unsigned int const, zypp::media::(anonymous namespace)::ManagedMedia>, std::_Select1st<std::pair<unsigned int const, zypp::media::(anonymous namespace)::ManagedMedia> >, std::less<unsigned int>, std::allocator<std::pair<unsigned int const, zypp::media::(anonymous namespace)::ManagedMedia> > >::_M_destroy_node (__p=0x55984eafcc90, this=0x55984eaf9278)
at /usr/include/c++/13/bits/stl_tree.h:625
#22 std::_Rb_tree<unsigned int, std::pair<unsigned int const, zypp::media::(anonymous namespace)::ManagedMedia>, std::_Select1st<std::pair<unsigned int const, zypp::media::(anonymous namespace)::ManagedMedia> >, std::less<unsigned int>, std::allocator<std::pair<unsigned int const, zypp::media::(anonymous namespace)::ManagedMedia> > >::_M_drop_node (__p=0x55984eafcc90, this=0x55984eaf9278)
at /usr/include/c++/13/bits/stl_tree.h:633
#23 std::_Rb_tree<unsigned int, std::pair<unsigned int const, zypp::media::(anonymous namespace)::ManagedMedia>, std::_Select1st<std::pair<unsigned int const, zypp::media::(anonymous namespace)::ManagedMedia> >, std::less<unsigned int>, std::allocator<std::pair<unsigned int const, zypp::media::(anonymous namespace)::ManagedMedia> > >::_M_erase (this=0x55984eaf9278, __x=0x55984eafcc90)
at /usr/include/c++/13/bits/stl_tree.h:1938
#24 std::_Rb_tree<unsigned int, std::pair<unsigned int const, zypp::media::(anonymous namespace)::ManagedMedia>, std::_Select1st<std::pair<unsigned int const, zypp::media::(anonymous namespace)::ManagedMedia> >, std::less<unsigned int>, std::allocator<std::pair<unsigned int const, zypp::media::(anonymous namespace)::ManagedMedia> > >::clear (this=0x55984eaf9278) at /usr/include/c++/13/bits/stl_tree.h:1255
#25 std::map<unsigned int, zypp::media::(anonymous namespace)::ManagedMedia, std::less<unsigned int>, std::allocator<std::pair<unsigned int const, zypp::media::(anonymous namespace)::ManagedMedia> > >::clear (this=0x55984eaf9278) at /usr/include/c++/13/bits/stl_map.h:1184
#26 zypp::media::MediaManager_Impl::~MediaManager_Impl (this=<optimized out>, this=<optimized out>)
at /usr/src/debug/libzypp-17.31.15/zypp/media/MediaManager.cc:241
#27 boost::checked_delete<zypp::media::MediaManager_Impl> (x=0x55984eaf9270) at /usr/include/boost/core/checked_delete.hpp:36
#28 boost::detail::sp_counted_impl_p<zypp::media::MediaManager_Impl>::dispose (this=<optimized out>)
at /usr/include/boost/smart_ptr/detail/sp_counted_impl.hpp:89
#29 0x00007fde361db50a in boost::detail::sp_counted_base::release (this=0x55984eaefc60)
at /usr/include/boost/smart_ptr/detail/sp_counted_base_gcc_atomic.hpp:120
#30 boost::detail::sp_counted_base::release (this=0x55984eaefc60)
at /usr/include/boost/smart_ptr/detail/sp_counted_base_gcc_atomic.hpp:116
#31 boost::detail::shared_count::~shared_count (this=<optimized out>, this=<optimized out>)
at /usr/include/boost/smart_ptr/detail/shared_count.hpp:432
#32 boost::shared_ptr<zypp::OnMediaLocation::Impl>::~shared_ptr (this=<optimized out>, this=<optimized out>)
at /usr/include/boost/smart_ptr/shared_ptr.hpp:336
#33 0x00007fde35843681 in __cxa_finalize (d=0x7fde365cb000) at cxa_finalize.c:82
#34 0x00007fde36170627 in __do_global_dtors_aux () from /lib64/libzypp.so.1722
#35 0x00007fde36640d40 in ?? ()
#36 0x00007fde36643102 in _dl_call_fini (closure_map=0x7ffdc35fbae0, closure_map@entry=0x7fde36640d40) at dl-call_fini.c:43
#37 0x00007fde3664713e in _dl_fini () at dl-fini.c:114
#38 0x00007fde35843c55 in __run_exit_handlers (status=8, listp=0x7fde359ea840 <__exit_funcs>,
run_list_atexit=run_list_atexit@entry=true, run_dtors=run_dtors@entry=true) at exit.c:108
#39 0x00007fde35843dd0 in __GI_exit (status=<optimized out>) at exit.c:138
#40 0x00005598466259d8 in Zypper::immediateExit (this=0x5598467f3d00 <Zypper::instance()::_instance>,
fromWithinSigHandler_r=<optimized out>) at /usr/src/debug/zypper-1.14.61/src/Zypper.h:213
#41 0x0000559846644409 in Zypper::immediateExitCheck (this=0x5598467f3d00 <Zypper::instance()::_instance>)
at /usr/src/debug/zypper-1.14.61/src/Zypper.h:194
#42 Zypper::instance () at /usr/src/debug/zypper-1.14.61/src/Zypper.cc:204
#43 0x000055984662c5b9 in ZmartRecipients::DownloadResolvableReportReceiver::finish (this=<optimized out>, error=<optimized out>,
reason=...) at /usr/src/debug/zypper-1.14.61/src/callbacks/repo.h:259
#44 0x00007fde361ee06f in zypp::repo::PackageProviderImpl<zypp::Package>::providePackage (this=0x55984eb0e560)
at /usr/src/debug/libzypp-17.31.15/zypp/repo/PackageProvider.cc:512
#45 0x00007fde361e53c1 in zypp::repo::PackageProvider::providePackage (this=<optimized out>)
at /usr/src/debug/libzypp-17.31.15/zypp/repo/PackageProvider.cc:696
#46 0x00007fde3622410d in zypp::target::RepoProvidePackage::operator() (this=0x55984e7f8f28, pi_r=..., fromCache_r=<optimized out>)
at /usr/src/debug/libzypp-17.31.15/zypp/target/CommitPackageCache.cc:95
#47 0x00007fde36243a80 in boost::detail::function::function_obj_invoker2<zypp::target::RepoProvidePackage, zypp::AutoDispose<zypp::filesystem::Pathname const>, zypp::PoolItem const&, bool>::invoke (function_obj_ptr=..., a0=..., a1=<optimized out>)
at /usr/include/boost/function/function_template.hpp:137
#48 0x00007fde362239bb in boost::function2<zypp::AutoDispose<zypp::filesystem::Pathname const>, zypp::PoolItem const&, bool>::operator()
(a1=false, a0=..., this=<optimized out>) at /usr/include/boost/function/function_template.hpp:772
#49 zypp::target::CommitPackageCache::Impl::sourceProvidePackage (this=<optimized out>, pi=...)
at /usr/src/debug/libzypp-17.31.15/zypp/target/CommitPackageCacheImpl.h:82
#50 0x00007fde36224dec in zypp::target::CommitPackageCacheReadAhead::get (this=0x55984e7f8f00, citem_r=...)
at /usr/src/debug/libzypp-17.31.15/zypp/target/CommitPackageCacheReadAhead.cc:177
#51 0x00007fde3621f641 in zypp::target::CommitPackageCache::get (this=<optimized out>, citem_r=...)
at /usr/src/debug/libzypp-17.31.15/zypp/target/CommitPackageCache.cc:143
#52 0x00007fde36231bf3 in zypp::target::TargetImpl::commit (this=0x559847f44360, pool_r=..., policy_rX=...)
at /usr/src/debug/libzypp-17.31.15/zypp/target/TargetImpl.cc:1477
#53 0x00007fde363154ea in zypp::zypp_detail::ZYppImpl::commit (this=0x559847efb330, policy_r=...)
at /usr/src/debug/libzypp-17.31.15/zypp/zypp_detail/ZYppImpl.cc:172
#54 0x00007fde3630bd50 in zypp::ZYpp::commit (this=<optimized out>, policy_r=...) at /usr/include/boost/smart_ptr/shared_ptr.hpp:782
#55 0x000055984673338d in solve_and_commit (zypper=..., policy=...) at /usr/src/debug/zypper-1.14.61/src/solve-commit.cc:877
#56 0x00005598466cb804 in InstallCmd::execute (this=0x559847f86d00, zypper=..., positionalArgs_r=...)
at /usr/src/debug/zypper-1.14.61/src/commands/installremove.cc:300
#57 0x0000559846687a74 in ZypperBaseCommand::run (this=0x559847f86d00, zypper=...)
at /usr/src/debug/zypper-1.14.61/src/commands/basecommand.cc:262
#58 0x000055984664602b in Zypper::doCommand (this=0x5598467f3d00 <Zypper::instance()::_instance>, cmdArgc=3, cmdArgv=0x7ffdc35fe318,
firstFlag=1) at /usr/src/debug/zypper-1.14.61/src/Zypper.cc:674
#59 0x000055984661daf9 in Zypper::main (this=0x5598467f3d00 <Zypper::instance()::_instance>, argc=3, argv=0x7ffdc35fe318)
at /usr/src/debug/zypper-1.14.61/src/Zypper.cc:217
#60 0x000055984661c66e in main (argc=3, argv=0x7ffdc35fe318) at /usr/src/debug/zypper-1.14.61/src/main.cc:163
(libcurl without detailed line info because download.opensuse.org's /debug published a new libcurl4-debuginfo before /tumbleweed actually published the new corresponding libcurl4)
Looked into this, it seems to be an issue related to curl. I get a similar gdb trace:
#0 0x00007ffff70965b6 in pthread_rwlock_wrlock@GLIBC_2.2.5 () at /lib64/libc.so.6
#1 0x00007ffff69acac9 in CRYPTO_THREAD_write_lock () at /lib64/glibc-hwcaps/x86-64-v3/libcrypto.so.3.1.4
#2 0x00007ffff69d9963 in RAND_get_rand_method () at /lib64/glibc-hwcaps/x86-64-v3/libcrypto.so.3.1.4
#3 0x00007ffff69da896 in RAND_status () at /lib64/glibc-hwcaps/x86-64-v3/libcrypto.so.3.1.4
#4 0x00007ffff6fc3c9c in () at /lib64/libcurl.so.4
#5 0x00007ffff6f7155e in () at /lib64/libcurl.so.4
#6 0x00007ffff6f67f61 in () at /lib64/libcurl.so.4
#7 0x00007ffff6fd6618 in () at /lib64/libcurl.so.4
#8 0x00007ffff6f6dba4 in curl_easy_cleanup () at /lib64/libcurl.so.4
#9 0x00007ffff79d7806 in zypp::media::MediaMultiCurl::~MediaMultiCurl() () at /lib64/libzypp.so.1722
#10 0x00007ffff79d7939 in zypp::media::MediaMultiCurl::~MediaMultiCurl() () at /lib64/libzypp.so.1722
...
My assumption is that as curl_easy_cleanup
is trying to handle SIGPIPE
, which isn't possible as the parent process has already been instructed to terminate.
A solution might be to check for SIGINT
in libzypp before calling the curl function.
My first hypothesis would be that this is a double-free/use-after-free ("static deinitialization fiasco"). Control has entered global_dtors and it looks a bit like libssl got unwound before MediaCurl (but now libcurl tries to once again invoke ssl functions).