public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libgcc/66874] New: RFE: x86_64_fallback_frame_state more robust
@ 2015-07-14 23:58 jreiser at bitwagon dot com
  2015-07-15  3:04 ` [Bug libgcc/66874] " hjl.tools at gmail dot com
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: jreiser at bitwagon dot com @ 2015-07-14 23:58 UTC (permalink / raw)
  To: gcc-bugs

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.


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2024-02-26 15:08 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-14 23:58 [Bug libgcc/66874] New: RFE: x86_64_fallback_frame_state more robust jreiser at bitwagon dot com
2015-07-15  3:04 ` [Bug libgcc/66874] " hjl.tools at gmail dot com
2024-02-23 17:19 ` [Bug target/66874] " sjames at gcc dot gnu.org
2024-02-23 17:24 ` jakub at gcc dot gnu.org
2024-02-23 17:25 ` sjames at gcc dot gnu.org
2024-02-23 19:39 ` schwab@linux-m68k.org
2024-02-26 15:08 ` sjames at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).