Skip to content

Instantly share code, notes, and snippets.

@StephanDollberg
Created February 12, 2019 22:52
Show Gist options
  • Save StephanDollberg/a1ab914d806d3aa4406c5cf840dd2e00 to your computer and use it in GitHub Desktop.
Save StephanDollberg/a1ab914d806d3aa4406c5cf840dd2e00 to your computer and use it in GitHub Desktop.
coroutine asan
before
done
==17872==WARNING: ASan is ignoring requested __asan_handle_no_return: stack top: 0x7fff058e0000; bottom 0x631000022000; size:
0x1cef058be000 (31812915814400)
False positive error reports may follow
For details see https://github.com/google/sanitizers/issues/189
excep handler
before
=================================================================
==17872==ERROR: AddressSanitizer: stack-buffer-underflow on address 0x631000024010 at pc 0x7f2fe90ea191 bp 0x631000024000 sp
0x6310000237a8
WRITE of size 16 at 0x631000024010 thread T0
#0 0x7f2fe90ea190 in __interceptor_clock_gettime /build/gcc/src/gcc/libsanitizer/sanitizer_common/sanitizer_common_interc
eptors.inc:2001
#1 0x7f2fe8f3a6c5 in std::chrono::_V2::steady_clock::now() /build/gcc/src/gcc/libstdc++-v3/src/c++11/chrono.cc:90
#2 0x55c8b740f13c in boost::asio::detail::chrono_time_traits<std::chrono::_V2::steady_clock, boost::asio::wait_traits<std
::chrono::_V2::steady_clock> >::now() /usr/include/boost/asio/detail/chrono_time_traits.hpp:52
#3 0x55c8b7404521 in boost::asio::detail::deadline_timer_service<boost::asio::detail::chrono_time_traits<std::chrono::_V2
::steady_clock, boost::asio::wait_traits<std::chrono::_V2::steady_clock> > >::expires_after(boost::asio::detail::deadline_tim
er_service<boost::asio::detail::chrono_time_traits<std::chrono::_V2::steady_clock, boost::asio::wait_traits<std::chrono::_V2:
:steady_clock> > >::implementation_type&, std::chrono::duration<long, std::ratio<1l, 1000000000l> > const&, boost::system::er
ror_code&) /usr/include/boost/asio/detail/deadline_timer_service.hpp:204
#4 0x55c8b73fb326 in boost::asio::basic_waitable_timer<std::chrono::_V2::steady_clock, boost::asio::wait_traits<std::chro
no::_V2::steady_clock> >::expires_after(std::chrono::duration<long, std::ratio<1l, 1000000000l> > const&) /usr/include/boost/
asio/basic_waitable_timer.hpp:538
#5 0x55c8b73d9d87 in operator() ../bastelbox.cpp:18
#6 0x55c8b73dd487 in operator() /usr/include/boost/asio/impl/spawn.hpp:382
#7 0x55c8b73dd170 in run /usr/include/boost/coroutine/detail/push_coroutine_object.hpp:293
#8 0x55c8b73dcf2e in trampoline_push_void<boost::coroutines::detail::push_coroutine_object<boost::coroutines::pull_corout
ine<void>, void, boost::asio::detail::coro_entry_point<boost::asio::executor_binder<void (*)(), boost::asio::strand<boost::as
io::io_context::executor_type> >, main(int, char**)::<lambda(boost::asio::yield_context)> >&, boost::coroutines::basic_standa
rd_stack_allocator<boost::coroutines::stack_traits> > > /usr/include/boost/coroutine/detail/trampoline_push.hpp:70
#9 0x7f2fe8b0213e in make_fcontext (/usr/lib/libboost_context.so.1.69.0+0x213e)
0x631000024010 is located 63504 bytes inside of 65536-byte region [0x631000014800,0x631000024800)
allocated by thread T0 here:
#0 0x7f2fe9141019 in __interceptor_malloc /build/gcc/src/gcc/libsanitizer/asan/asan_malloc_linux.cc:86
#1 0x55c8b7423a3f in boost::coroutines::basic_standard_stack_allocator<boost::coroutines::stack_traits>::allocate(boost::
coroutines::stack_context&, unsigned long) /usr/include/boost/coroutine/standard_stack_allocator.hpp:42
#2 0x55c8b73dc80d in push_coroutine<boost::asio::detail::coro_entry_point<boost::asio::executor_binder<void (*)(), boost:
:asio::strand<boost::asio::io_context::executor_type> >, main(int, char**)::<lambda(boost::asio::yield_context)> >&> /usr/inc
lude/boost/coroutine/asymmetric_coroutine.hpp:1953
#3 0x55c8b73dc59b in operator() /usr/include/boost/asio/impl/spawn.hpp:397
#4 0x55c8b73dc38b in asio_handler_invoke<boost::asio::detail::spawn_helper<boost::asio::executor_binder<void (*)(), boost
::asio::strand<boost::asio::io_context::executor_type> >, main(int, char**)::<lambda(boost::asio::yield_context)> > > /usr/include/boost/asio/handler_invoke_hook.hpp:69
#5 0x55c8b73dc288 in invoke<boost::asio::detail::spawn_helper<boost::asio::executor_binder<void (*)(), boost::asio::strand<boost::asio::io_context::executor_type> >, main(int, char**)::<lambda(boost::asio::yield_context)> >, boost::asio::executor_binder<void (*)(), boost::asio::strand<boost::asio::io_context::executor_type> > > /usr/include/boost/asio/detail/handler_invoke_helpers.hpp:37
#6 0x55c8b73dba8b in asio_handler_invoke<boost::asio::detail::spawn_helper<boost::asio::executor_binder<void (*)(), boost::asio::strand<boost::asio::io_context::executor_type> >, main(int, char**)::<lambda(boost::asio::yield_context)> >, boost::asio::executor_binder<void (*)(), boost::asio::strand<boost::asio::io_context::executor_type> >, main(int, char**)::<lambda(boost::asio::yield_context)> > /usr/include/boost/asio/impl/spawn.hpp:410
#7 0x55c8b73db779 in invoke<boost::asio::detail::spawn_helper<boost::asio::executor_binder<void (*)(), boost::asio::strand<boost::asio::io_context::executor_type> >, main(int, char**)::<lambda(boost::asio::yield_context)> >, boost::asio::detail::spawn_helper<boost::asio::executor_binder<void (*)(), boost::asio::strand<boost::asio::io_context::executor_type> >, main(int, char**)::<lambda(boost::asio::yield_context)> > > /usr/include/boost/asio/detail/handler_invoke_helpers.hpp:37
#8 0x55c8b73dc059 in do_complete /usr/include/boost/asio/detail/executor_op.hpp:70
#9 0x55c8b73e24ee in boost::asio::detail::scheduler_operation::complete(void*, boost::system::error_code const&, unsigned long) /usr/include/boost/asio/detail/scheduler_operation.hpp:40
#10 0x55c8b7422c55 in boost::asio::detail::strand_executor_service::invoker<boost::asio::io_context::executor_type const>::operator()() /usr/include/boost/asio/detail/impl/strand_executor_service.hpp:90
#11 0x55c8b7421fa3 in void boost::asio::asio_handler_invoke<boost::asio::detail::strand_executor_service::invoker<boost::asio::io_context::executor_type const> >(boost::asio::detail::strand_executor_service::invoker<boost::asio::io_context::executor_type const>&, ...) /usr/include/boost/asio/handler_invoke_hook.hpp:69
#12 0x55c8b7420e8d in void boost_asio_handler_invoke_helpers::invoke<boost::asio::detail::strand_executor_service::invoker<boost::asio::io_context::executor_type const>, boost::asio::detail::strand_executor_service::invoker<boost::asio::io_context::executor_type const> >(boost::asio::detail::strand_executor_service::invoker<boost::asio::io_context::executor_type const>&, boost::asio::detail::strand_executor_service::invoker<boost::asio::io_context::executor_type const>&) /usr/include/boost/asio/detail/handler_invoke_helpers.hpp:37
#13 0x55c8b74224e3 in boost::asio::detail::executor_op<boost::asio::detail::strand_executor_service::invoker<boost::asio::io_context::executor_type const>, std::allocator<void>, boost::asio::detail::scheduler_operation>::do_complete(void*, boost::asio::detail::scheduler_operation*, boost::system::error_code const&, unsigned long) /usr/include/boost/asio/detail/executor_op.hpp:70
#14 0x55c8b73e24ee in boost::asio::detail::scheduler_operation::complete(void*, boost::system::error_code const&, unsigned long) /usr/include/boost/asio/detail/scheduler_operation.hpp:40
#15 0x55c8b73eb8c8 in boost::asio::detail::scheduler::do_run_one(boost::asio::detail::conditionally_enabled_mutex::scoped_lock&, boost::asio::detail::scheduler_thread_info&, boost::system::error_code const&) /usr/include/boost/asio/detail/impl/scheduler.ipp:401
#16 0x55c8b73eabb6 in boost::asio::detail::scheduler::run_one(boost::system::error_code&) /usr/include/boost/asio/detail/impl/scheduler.ipp:175
#17 0x55c8b73ec4da in boost::asio::io_context::run_one() /usr/include/boost/asio/impl/io_context.ipp:77
#18 0x55c8b73da02d in main ../bastelbox.cpp:29
#19 0x7f2fe8b46222 in __libc_start_main (/usr/lib/libc.so.6+0x24222)
SUMMARY: AddressSanitizer: stack-buffer-underflow /build/gcc/src/gcc/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc:2001 in __interceptor_clock_gettime
Shadow bytes around the buggy address:
0x0c627fffc7b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c627fffc7c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c627fffc7d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c627fffc7e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c627fffc7f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
=>0x0c627fffc800: f1 f1[f1]f1 00 00 f2 f2 00 00 00 00 00 00 f1 f1
0x0c627fffc810: f1 f1 00 f2 f2 f2 f2 f2 f2 f2 00 f2 f2 f2 00 00
0x0c627fffc820: f1 f1 f1 f1 00 00 00 00 00 00 00 00 f1 f1 f1 f1
0x0c627fffc830: 00 00 f2 f2 00 00 00 00 00 00 00 00 00 00 00 00
0x0c627fffc840: 00 00 f1 f1 f1 f1 04 f2 f2 f2 f2 f2 f2 f2 00 f2
0x0c627fffc850: f2 f2 f2 f2 f2 f2 00 f2 f2 f2 f2 f2 f2 f2 00 00
Shadow byte legend (one shadow byte represents 8 application bytes):
Addressable: 00
Partially addressable: 01 02 03 04 05 06 07
Heap left redzone: fa
Freed heap region: fd
Stack left redzone: f1
Stack mid redzone: f2
Stack right redzone: f3
Stack after return: f5
Stack use after scope: f8
Global redzone: f9
Global init order: f6
Poisoned by user: f7
Container overflow: fc
Array cookie: ac
Intra object redzone: bb
ASan internal: fe
Left alloca redzone: ca
Right alloca redzone: cb
==17872==ABORTING
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment