public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "jreiser at bitwagon dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug libgcc/66874] New: RFE: x86_64_fallback_frame_state more robust
Date: Tue, 14 Jul 2015 23:58:00 -0000	[thread overview]
Message-ID: <bug-66874-4@http.gcc.gnu.org/bugzilla/> (raw)

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.


             reply	other threads:[~2015-07-14 23:58 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-14 23:58 jreiser at bitwagon dot com [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-66874-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).