https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66874
Bug ID: 66874 Summary: RFE: x86_64_fallback_frame_state more robust Product: gcc Version: 5.1.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libgcc Assignee: unassigned at gcc dot gnu.org Reporter: jreiser at bitwagon dot com Target Milestone: --- In libgcc/config/i386/linux-unwind.h function x86_64_fallback_frame_state() please check the value of pc before accessing memory in the statement: ----- unsigned char *pc = context->ra; // snip if (*(unsigned char *)(pc+0) == 0x48 && *(unsigned long long *)(pc+1) == RT_SIGRETURN_SYSCALL) ----- I have seen pc values of 0, 2, 0xffffffff, etc due to missing or incorrect debug info, particularly when the code that is being unwound was compiled with no frame pointer, or was compiled by other compilers. The result is SIGSEGV, which is a major disappointment. I suggest a check in the spirit of: if ((unsigned long)pc < 4096) return _URC_END_OF_STACK; or similar. Obviously this is heuristic, but it is much better than SIGSEGV.