From: Juergen Gross <jgross@suse.com>
To: xen-devel@lists.xenproject.org
Cc: Juergen Gross <jgross@suse.com>,
andrew.cooper3@citrix.com, dfaggioli@suse.com, jbeulich@suse.com
Subject: [PATCH v3 01/17] x86: don't use hypervisor stack size for dumping guest stacks
Date: Fri, 9 Feb 2018 15:01:35 +0100 [thread overview]
Message-ID: <20180209140151.24714-2-jgross@suse.com> (raw)
In-Reply-To: <20180209140151.24714-1-jgross@suse.com>
show_guest_stack() and compat_show_guest_stack() stop dumping the
stack of the guest whenever its virtual address reaches the same
alignment which is used for the hypervisor stacks.
Remove this arbitrary limit and try to dump a fixed number of lines
instead.
Signed-off-by: Juergen Gross <jgross@suse.com>
---
xen/arch/x86/traps.c | 26 +++++++++++---------------
1 file changed, 11 insertions(+), 15 deletions(-)
diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
index 2e022b09b8..13a852ca4e 100644
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -219,7 +219,8 @@ static void compat_show_guest_stack(struct vcpu *v,
const struct cpu_user_regs *regs,
int debug_stack_lines)
{
- unsigned int i, *stack, addr, mask = STACK_SIZE;
+ unsigned int i, *stack, addr;
+ unsigned long last_addr = -1L;
stack = (unsigned int *)(unsigned long)regs->esp;
printk("Guest stack trace from esp=%08lx:\n ", (unsigned long)stack);
@@ -248,13 +249,13 @@ static void compat_show_guest_stack(struct vcpu *v,
printk("Inaccessible guest memory.\n");
return;
}
- mask = PAGE_SIZE;
+ last_addr = round_pgup((unsigned long)stack);
}
}
for ( i = 0; i < debug_stack_lines * 8; i++ )
{
- if ( (((long)stack - 1) ^ ((long)(stack + 1) - 1)) & mask )
+ if ( (unsigned long)stack >= last_addr )
break;
if ( __get_user(addr, stack) )
{
@@ -269,11 +270,9 @@ static void compat_show_guest_stack(struct vcpu *v,
printk(" %08x", addr);
stack++;
}
- if ( mask == PAGE_SIZE )
- {
- BUILD_BUG_ON(PAGE_SIZE == STACK_SIZE);
+ if ( last_addr != -1L )
unmap_domain_page(stack);
- }
+
if ( i == 0 )
printk("Stack empty.");
printk("\n");
@@ -282,8 +281,7 @@ static void compat_show_guest_stack(struct vcpu *v,
static void show_guest_stack(struct vcpu *v, const struct cpu_user_regs *regs)
{
int i;
- unsigned long *stack, addr;
- unsigned long mask = STACK_SIZE;
+ unsigned long *stack, addr, last_addr = -1L;
/* Avoid HVM as we don't know what the stack looks like. */
if ( is_hvm_vcpu(v) )
@@ -318,13 +316,13 @@ static void show_guest_stack(struct vcpu *v, const struct cpu_user_regs *regs)
printk("Inaccessible guest memory.\n");
return;
}
- mask = PAGE_SIZE;
+ last_addr = round_pgup((unsigned long)stack);
}
}
for ( i = 0; i < (debug_stack_lines*stack_words_per_line); i++ )
{
- if ( (((long)stack - 1) ^ ((long)(stack + 1) - 1)) & mask )
+ if ( (unsigned long)stack >= last_addr )
break;
if ( __get_user(addr, stack) )
{
@@ -339,11 +337,9 @@ static void show_guest_stack(struct vcpu *v, const struct cpu_user_regs *regs)
printk(" %p", _p(addr));
stack++;
}
- if ( mask == PAGE_SIZE )
- {
- BUILD_BUG_ON(PAGE_SIZE == STACK_SIZE);
+ if ( last_addr != -1L )
unmap_domain_page(stack);
- }
+
if ( i == 0 )
printk("Stack empty.");
printk("\n");
--
2.13.6
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
next prev parent reply other threads:[~2018-02-09 14:02 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-09 14:01 [PATCH v3 00/17] Alternative Meltdown mitigation Juergen Gross
2018-02-09 14:01 ` Juergen Gross [this message]
2018-02-09 14:01 ` [PATCH v3 02/17] x86: do a revert of e871e80c38547d9faefc6604532ba3e985e65873 Juergen Gross
2018-02-13 10:14 ` Jan Beulich
2018-02-09 14:01 ` [PATCH v3 03/17] x86: revert 5784de3e2067ed73efc2fe42e62831e8ae7f46c4 Juergen Gross
2018-02-09 14:01 ` [PATCH v3 04/17] x86: don't access saved user regs via rsp in trap handlers Juergen Gross
2018-02-09 14:01 ` [PATCH v3 05/17] x86: add a xpti command line parameter Juergen Gross
2018-02-09 14:01 ` [PATCH v3 06/17] x86: allow per-domain mappings without NX bit or with specific mfn Juergen Gross
2018-02-09 14:01 ` [PATCH v3 07/17] xen/x86: split _set_tssldt_desc() into ldt and tss specific functions Juergen Gross
2018-02-09 14:01 ` [PATCH v3 08/17] x86: add support for spectre mitigation with local thunk Juergen Gross
2018-02-09 14:01 ` [PATCH v3 09/17] x86: create syscall stub for per-domain mapping Juergen Gross
2018-02-09 14:01 ` [PATCH v3 10/17] x86: allocate per-vcpu stacks for interrupt entries Juergen Gross
2018-02-09 14:01 ` [PATCH v3 11/17] x86: modify interrupt handlers to support stack switching Juergen Gross
2018-02-09 14:01 ` [PATCH v3 12/17] x86: activate per-vcpu stacks in case of xpti Juergen Gross
2018-02-09 14:01 ` [PATCH v3 13/17] x86: allocate hypervisor L4 page table for XPTI Juergen Gross
2018-02-09 14:01 ` [PATCH v3 14/17] xen: add domain pointer to fill_ro_mpt() and zap_ro_mpt() functions Juergen Gross
2018-02-09 14:01 ` [PATCH v3 15/17] x86: fill XPTI shadow pages and keep them in sync with guest L4 Juergen Gross
2018-02-09 14:01 ` [PATCH v3 16/17] x86: do page table switching when entering/leaving hypervisor Juergen Gross
2018-02-09 14:01 ` [PATCH v3 17/17] x86: hide most hypervisor mappings in XPTI shadow page tables Juergen Gross
2018-02-12 17:54 ` [PATCH v3 00/17] Alternative Meltdown mitigation Dario Faggioli
2018-02-13 11:36 ` Juergen Gross
2018-02-13 14:16 ` Jan Beulich
[not found] ` <5A83014E02000078001A7619@suse.com>
2018-02-13 14:29 ` Juergen Gross
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=20180209140151.24714-2-jgross@suse.com \
--to=jgross@suse.com \
--cc=andrew.cooper3@citrix.com \
--cc=dfaggioli@suse.com \
--cc=jbeulich@suse.com \
--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).