From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: xen-devel <xen-devel@lists.xenproject.org>,
Keir Fraser <keir@xen.org>, Tim Deegan <tim@xen.org>
Subject: Re: [xen-devel] [Patch 2/4] x86/stack: Adjust boundary conditions for printed stacks.
Date: Mon, 12 Aug 2013 10:43:19 +0100 [thread overview]
Message-ID: <5208AE37.9040307@citrix.com> (raw)
In-Reply-To: <5208BD0002000078000EB0A2@nat28.tlf.novell.com>
On 12/08/13 09:46, Jan Beulich wrote:
>>>> On 09.08.13 at 21:55, Andrew Cooper <andrew.cooper3@citrix.com> wrote:
>> --- a/xen/include/asm-x86/current.h
>> +++ b/xen/include/asm-x86/current.h
>> @@ -50,6 +50,15 @@ static inline struct cpu_info *get_cpu_info(void)
>> #define get_stack_bottom() \
>> ((unsigned long)&get_cpu_info()->guest_cpu_user_regs.es)
>>
>> +/*
>> + * Get the bottom-of-stack, as useful for printing stack traces. This is an
>> + * equivalent place on the stack as guest_cpu_user_regs(), but works on an
>> + * arbitrary stack pointer rather than the current stack.
>> + */
>> +#define get_printable_stack_bottom(sp) \
>> + ((sp & (~(STACK_SIZE-1))) + \
>> + (STACK_SIZE - sizeof(struct cpu_info) - 2*sizeof(unsigned long)))
> Iirc in the prior RFC version of these patches you were convinced
> that the adjustment by 2 stack slots was wrong (and that was the
> primary reason why you had asked for comments). Now you're
> keeping it, without making clear what made you change your
> opinion.
>
> Jan
>
I was concerned about the -2 adjustment to 'low', which could end up
causing a triple fault.
The adjustment here covers call instructions out of assembly code, which
lack a traditional stack layout. Specifically, removing the -2 causes
the frame pointer code to find a frame pointer of value 0x0...001 as an
unknown text symbol.
I suppose one side effect would be that the non-frame pointer case will
miss the bottom return address; That could be worked around by having
the -2 conditional on the frame pointer case. This would still have the
advantage of the non-frame pointer case not attempting to interpret the
guest_cpu_user_regs for xen return addresses.
~Andrew
next prev parent reply other threads:[~2013-08-12 9:43 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-09 19:55 [xen-devel] [Patch 0/4] Xen stack trace printing improvements Andrew Cooper
2013-08-09 19:55 ` [xen-devel] [Patch 1/4] x86/stack: Refactor show_trace() Andrew Cooper
2013-08-09 19:55 ` [xen-devel] [Patch 2/4] x86/stack: Adjust boundary conditions for printed stacks Andrew Cooper
2013-08-12 8:46 ` Jan Beulich
2013-08-12 9:43 ` Andrew Cooper [this message]
2013-08-12 9:49 ` Jan Beulich
2013-08-12 12:15 ` [xen-devel] [Patch v2 " Andrew Cooper
2013-08-12 13:44 ` Jan Beulich
2013-08-12 13:53 ` Andrew Cooper
2013-08-09 19:55 ` [xen-devel] [Patch 3/4] x86/stack: Change show_stack_overflow() to use frame pointers if available Andrew Cooper
2013-08-09 19:55 ` [xen-devel] [Patch 4/4] DO NOT APPLY: Test code for interesting stack overflows Andrew Cooper
2013-09-09 11:09 ` [xen-devel] [Patch 0/4] Xen stack trace printing improvements Keir Fraser
2013-09-09 12:28 ` Andrew Cooper
2013-09-09 12:44 ` Jan Beulich
2013-09-09 12:50 ` Andrew Cooper
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=5208AE37.9040307@citrix.com \
--to=andrew.cooper3@citrix.com \
--cc=JBeulich@suse.com \
--cc=keir@xen.org \
--cc=tim@xen.org \
--cc=xen-devel@lists.xenproject.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).