Spurious SEGFAULTs with libtar
Libtar seems to be buggy w.r.t. memory management.
The following test almost consistently crashes urd
when running in interactive mode (e.g. urd -f -C
):
./api_interactive [api::norns_submit_push_errors],
[api::norns_submit_push_to_posix_file],
[api::norns_submit_push_to_posix_subdir],
[api::norns_submit_push_memory_to_posix_file],
[api::norns_submit_push_memory_to_posix_file_errors],
[api::norns_submit_push_links],
[api::norns_submit_pull_errors],
[api::norns_submit_pull_to_posix_file],
[api::norns_submit_pull_to_posix_subdir],
[api::norns_submit_pull_links],
[api::nornsctl_submit_push_errors],
[api::nornsctl_submit_push_to_posix_file],
[api::nornsctl_submit_push_to_posix_subdir],
[api::nornsctl_submit_push_memory_to_posix_file],
[api::nornsctl_submit_push_memory_to_posix_file_errors],
[api::nornsctl_submit_push_links],
[api::nornsctl_submit_pull_errors],
[api::nornsctl_submit_pull_to_posix_file],
[api::nornsctl_submit_pull_to_posix_subdir],
[api::nornsctl_submit_pull_links]
And produces (at least) the following backtrace:
Core was generated by `./urd -f -C'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0 0x00007fb1e7ba0809 in ?? () from /lib/x86_64-linux-gnu/libc.so.6
[Current thread is 1 (Thread 0x7fb1e5c3a700 (LWP 2623))]
(gdb) bt
#0 0x00007fb1e7ba0809 in ?? () from /lib/x86_64-linux-gnu/libc.so.6
#1 0x00007fb1e7ba28b8 in ?? () from /lib/x86_64-linux-gnu/libc.so.6
#2 0x00007fb1e7ba55fc in calloc () from /lib/x86_64-linux-gnu/libc.so.6
#3 0x00007fb1e87238d8 in libtar_hash_new () from /usr/lib/libtar.so.0
#4 0x00007fb1e87236d1 in ?? () from /usr/lib/libtar.so.0
#5 0x00007fb1e872372e in tar_open () from /usr/lib/libtar.so.0
#6 0x000000000056b0b1 in norns::utils::tar::tar (this=0x7fb1e5c39800, filename=..., op=norns::utils::tar::openmode::open, ec=...) at ../../src/utils/tar-archive.cpp:71
#7 0x00000000005475a5 in (anonymous namespace)::unpack_archive (archive_path=..., parent_path=...) at ../../src/io/transferors/remote-resource-to-local-path.cpp:87
#8 0x00000000005486a9 in norns::io::remote_resource_to_local_path_transferor::transfer (this=0xd6c4f0, auth=..., task_info=..., src=..., dst=...)
at ../../src/io/transferors/remote-resource-to-local-path.cpp:259
#9 0x000000000047a87b in norns::io::task<(norns::iotask_type)0>::operator() (this=0xd81158) at ../../src/io/task-copy.hpp:83
#10 0x000000000047ca96 in norns::io::generic_task::operator() (this=0xd81148) at ../../src/io/task.hpp:191
#11 0x000000000052211e in std::_Bind<norns::io::generic_task ()>::__call<void>(std::tuple<>&&, std::_Index_tuple<>) (this=0xd81148, __args=...) at /usr/include/c++/4.9/functional:1264
#12 0x0000000000521ed4 in std::_Bind<norns::io::generic_task ()>::operator()<, void>() (this=0xd81148) at /usr/include/c++/4.9/functional:1323
#13 0x000000000051277e in pool::task<std::_Bind<norns::io::generic_task()>, std::_Bind<norns::io::task_manager::enqueue_task(norns::io::generic_task&&)::<lambda()>()> >::execute(void) (
this=0xd81140) at ../../src/io/thread-pool/thread-pool.hpp:87
#14 0x0000000000512a85 in pool::worker (this=0xc86e88) at ../../src/io/thread-pool/thread-pool.hpp:201
#15 0x00000000005221fd in std::_Mem_fn<void (pool::*)()>::operator()<, void>(pool*) const (this=0xc85080, __object=0xc86e88) at /usr/include/c++/4.9/functional:569
#16 0x00000000005220f5 in std::_Bind_simple<std::_Mem_fn<void (pool::*)()> (pool*)>::_M_invoke<0ul>(std::_Index_tuple<0ul>) (this=0xc85078) at /usr/include/c++/4.9/functional:1700
#17 0x0000000000521ea3 in std::_Bind_simple<std::_Mem_fn<void (pool::*)()> (pool*)>::operator()() (this=0xc85078) at /usr/include/c++/4.9/functional:1688
#18 0x0000000000521c68 in std::thread::_Impl<std::_Bind_simple<std::_Mem_fn<void (pool::*)()> (pool*)> >::_M_run() (this=0xc85060) at /usr/include/c++/4.9/thread:115
#19 0x00007fb1e849ac10 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#20 0x00007fb1e8930184 in start_thread () from /lib/x86_64-linux-gnu/libpthread.so.0
#21 0x00007fb1e7c2003d in clone () from /lib/x86_64-linux-gnu/libc.so.6
Edited by Alberto Miranda