(gdb) bt#0 0x0000000000391182 in processor::cli_hlt () at arch/x64/processor.hh:247#1 arch::halt_no_interrupts () at arch/x64/arch.hh:48#2 osv::halt () at arch/x64/power.cc:24#3 0x00000000002258f7 in abort (fmt=fmt@entry=0x69f91e "Aborted\n") at runtime.cc:132#4 0x0000000000225920 in abort () at runtime.cc:98#5 0x00000000003d89eb in syscall (number=number@entry=267) at linux.cc:416#6 0x00000000003d8b54 in syscall_wrapper (number=267, p1=-100, p2=842350526864, p3=842350845952, p4=128, p5=0, p6=0) at linux.cc:431#7 0x000000000038abc8 in syscall_entry () at arch/x64/entry.S:261#8 0x00001000010a861a in syscall.Syscall6 () at /home/wkozaczuk/tools/go/src/syscall/asm_linux_amd64.s:52Backtrace stopped: previous frame inner to this frame (corrupt stack?) 840 /* As a safety net to avoid unnecessary backtracing while trying 841 to find an invalid ID, we check for a common situation where 842 we can detect from comparing stack addresses that no other 843 frame in the current frame chain can have this ID. See the 844 comment at frame_id_inner for details. */
/* Safety net to check whether frame ID L should be inner to 722 frame ID R, according to their stack addresses. 724 This method cannot be used to compare arbitrary frames, as the 725 ranges of valid stack addresses may be discontiguous (e.g. due 726 to sigaltstack). 728 However, it can be used as safety net to discover invalid frame 729 IDs in certain circumstances. Assuming that NEXT is the immediate 730 inner frame to THIS and that NEXT and THIS are both NORMAL frames: 732 * The stack address of NEXT must be inner-than-or-equal to the stack 733 address of THIS. 735 Therefore, if frame_id_inner (THIS, NEXT) holds, some unwind 736 error has occurred. 738 * If NEXT and THIS have different stack addresses, no other frame 739 in the frame chain may have a stack address in between. 741 Therefore, if frame_id_inner (TEST, THIS) holds, but 742 frame_id_inner (TEST, NEXT) does not hold, TEST cannot refer 743 to a valid frame in the frame chain. 745 The sanity checks above cannot be performed when a SIGTRAMP frame 746 is involved, because signal handlers might be executed on a different 747 stack than the stack used by the routine that caused the signal 748 to be raised. This can happen for instance when a thread exceeds 749 its maximum stack size. In this case, certain compilers implement 750 a stack overflow strategy that cause the handler to be run on a 751 different stack. */ 753 static int 755 {(gdb) bt#0 0x0000000000391182 in processor::cli_hlt () at arch/x64/processor.hh:247#1 arch::halt_no_interrupts () at arch/x64/arch.hh:48#2 osv::halt () at arch/x64/power.cc:24#3 0x00000000002258f7 in abort ( fmt=fmt@entry=0x6a0938 "Assertion failed: %s (%s: %s: %d)\n") at runtime.cc:132#4 0x0000000000225939 in __assert_fail ( expr=expr@entry=0x7303ae "!(e & ~SUPPORTED_EVENTS)", file=file@entry=0x7303a0 "core/epoll.cc", line=line@entry=55, func=func@entry=0x7304a0 <events_poll_to_epoll(unsigned int)::__func__> "events_poll_to_epoll") at runtime.cc:139#5 0x0000000000408460 in events_poll_to_epoll (e=32) at core/epoll.cc:55#6 epoll_file::process_activity (maxevents=128, events=0x20000047f880, activity=std::unordered_set with 1 elements = {...}, this= 0xffffa000029b7e00) at core/epoll.cc:199#7 epoll_file::wait (this=0xffffa000029b7e00, events=events@entry=0x20000047f880, maxevents=maxevents@entry=128, timeout_ms=timeout_ms@entry=0) at core/epoll.cc:161#8 0x0000000000406831 in epoll_wait (epfd=<optimized out>, events=0x20000047f880, maxevents=128, timeout_ms=0) at core/epoll.cc:344#9 0x00000000003d8236 in syscall (number=number@entry=232) at linux.cc:374#10 0x00000000003d8b34 in syscall_wrapper (number=232, p1=4, p2=35184376805504, p3=128, p4=0, p5=4, p6=17592204000280) at linux.cc:432---Type <return> to continue, or q <return> to quit---#11 0x000000000038abc8 in syscall_entry () at arch/x64/entry.S:261#12 0x00001000010c5409 in runtime.epollwait () at /home/wkozaczuk/tools/go-1.9.2/go/src/runtime/sys_linux_amd64.s:575#13 0x0000100001096876 in runtime.netpoll (block=false, ~r1=0x0) at /home/wkozaczuk/tools/go-1.9.2/go/src/runtime/netpoll_epoll.go:74#14 0x00001000010a5183 in runtime.sysmon () at /home/wkozaczuk/tools/go-1.9.2/go/src/runtime/proc.go:3897#15 0x000010000109def2 in runtime.mstart1 () at /home/wkozaczuk/tools/go-1.9.2/go/src/runtime/proc.go:1182#16 0x000010000109ddc6 in runtime.mstart () at /home/wkozaczuk/tools/go-1.9.2/go/src/runtime/proc.go:1152#17 0x000010000111fbe3 in crosscall_amd64 () at gcc_amd64.S:35#18 0xffff800000f2c040 in ?? ()#19 0xffff800000f2f798 in ?? ()#20 0xffff800002e1e190 in ?? ()#21 0xffffa000014a31c0 in ?? ()#22 0x000000c420000900 in ?? ()#23 0x000010000109dd60 in runtime.startTheWorldWithSema () at /home/wkozaczuk/tools/go-1.9.2/go/src/runtime/proc.go:1070#24 0x000010000111f73b in threadentry (v=<optimized out>) at gcc_linux_amd64.c:102#25 0x0000000000448816 in pthread_private::pthread::<lambda()>::operator() ( __closure=0xffffa000029b9600) at libc/pthread.cc:115---Type <return> to continue, or q <return> to quit---#26 std::_Function_handler<void(), pthread_private::pthread::pthread(void* (*)(void*), void*, sigset_t, const pthread_private::thread_attr*)::<lambda()> >::_M_invoke(const std::_Any_data &) (__functor=...) at /usr/include/c++/5/functional:1871#27 0x00000000003e67c7 in sched::thread_main_c (t=0xffff800002e19040) at arch/x64/arch-switch.hh:198#28 0x000000000038ab53 in thread_main () at arch/x64/entry.S:113So I hacked some code in pthreads.cc to make syscal stack to be allocated before regular with a hope to make syscall stack lower than regular stack. Btw I realized that regular stack when using pthreads API is allocated using mmap ANONYMOUS which makes its address much lower than anything returned from alloc. What was the reason to use mmap vs regular malloc?
- Add some CFI trickery to entry.S to make gdb ignore non-contiguous stack when stack unwinding.
- Implement osv backtrace like other gdb extensions in scripts/loader.py