xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Xen-devel <xen-devel@lists.xen.org>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>,
	Keir Fraser <keir@xen.org>, Jan Beulich <JBeulich@suse.com>,
	Tim Deegan <tim@xen.org>
Subject: [RFC Patch 0/2] Improvements to stack traces
Date: Thu, 8 Aug 2013 17:19:08 +0100	[thread overview]
Message-ID: <1375978750-25898-1-git-send-email-andrew.cooper3@citrix.com> (raw)

This series is RFC for two reasons; firstly because I have not dev-tested it
yet, but mainly because of a specific question.

In the algorithm using frame pointers, the lower bound is adjusted by two
words from the provided stack pointer.

This appears to be the behaiour right from its introduction in:

    commit aa24d38a469b59abf1b95b732b6ea9ed86e511cf
    Author: kaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
    Date:   Thu Sep 1 15:31:12 2005 +0000

What is the reason for the adjustment?  Tim and I couldn't think of a case
where a valid frame pointer could be outside the stack. Any well formed use of
frame pointers should require the callee to push the old frame pointer at
entry, and pop it on right before exit.

Am I missing something obvious?

The potential problem comes in the stack overflow case, where rsp points to
the boundary of the primary stack, and rbp points just below it, at which
point the bounday condition will pass but referencing rbp will cause a triple
fault.

This can be detected and worked around, but if the adjustment is erronious
then by far the easiest solution is to just discard the adjustment.

~Andrew

CC: Keir Fraser <keir@xen.org>
CC: Jan Beulich <JBeulich@suse.com>
CC: Tim Deegan <tim@xen.org>

--
1.7.10.4

             reply	other threads:[~2013-08-08 16:19 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-08 16:19 Andrew Cooper [this message]
2013-08-08 16:19 ` [RFC Patch 1/2] x86/traps: Refactor show_trace() Andrew Cooper
2013-08-08 16:19 ` [RFC Patch 2/2] x86/traps: Change show_stack_overflow() to use frame pointers if available Andrew Cooper
2013-08-08 17:23 ` [RFC Patch 0/2] Improvements to stack traces Keir Fraser

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=1375978750-25898-1-git-send-email-andrew.cooper3@citrix.com \
    --to=andrew.cooper3@citrix.com \
    --cc=JBeulich@suse.com \
    --cc=keir@xen.org \
    --cc=tim@xen.org \
    --cc=xen-devel@lists.xen.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 NNTP newsgroup(s).