# HG changeset patch
# User Tim Deegan <Tim.Deegan@xxxxxxxxxxxxx>
# Date 1172146889 0
# Node ID 0a970a431bbcbf91162698580f6cbd7578fe8114
# Parent f62a052384a54a379580a95aa79a70e3fcf86a6d
[XEN] don't emulate stack operations on shadowed pages
Signed-off-by: Tim Deegan <Tim.Deegan@xxxxxxxxxxxxx>
---
xen/arch/x86/mm/shadow/multi.c | 18 +++++++++++++++++-
1 files changed, 17 insertions(+), 1 deletion(-)
diff -r f62a052384a5 -r 0a970a431bbc xen/arch/x86/mm/shadow/multi.c
--- a/xen/arch/x86/mm/shadow/multi.c Wed Feb 21 18:38:11 2007 -0800
+++ b/xen/arch/x86/mm/shadow/multi.c Thu Feb 22 12:21:29 2007 +0000
@@ -2902,7 +2902,23 @@ static int sh_page_fault(struct vcpu *v,
if ( is_hvm_domain(d) )
hvm_store_cpu_guest_regs(v, regs, NULL);
- SHADOW_PRINTK("emulate: eip=%#lx\n", (unsigned long)regs->eip);
+ SHADOW_PRINTK("emulate: eip=%#lx esp=%#lx\n",
+ (unsigned long)regs->eip, (unsigned long)regs->esp);
+
+ /* Check whether this looks like a stack operation. */
+ if ( (va & PAGE_MASK) == (regs->esp & PAGE_MASK) )
+ {
+ /* Forcibly unshadow and return. It's important to do this before
+ * we emulate: if the faulting stack operation was the guest handling
+ * an interrupt, then
+ * (a) the instruction at %eip is irrelevant; and
+ * (b) we might inject some other fault and mask the real one */
+ gdprintk(XENLOG_DEBUG, "guest stack is on a shadowed frame: "
+ "%%esp=%#lx, cr2=%#lx, mfn=%#lx\n",
+ (unsigned long)regs->esp, va, mfn_x(gmfn));
+ sh_remove_shadows(v, gmfn, 0 /* thorough */, 1 /* must succeed */);
+ goto done;
+ }
emul_ops = shadow_init_emulation(&emul_ctxt, regs);
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|