# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1231420866 0
# Node ID 6cec460c3290ebe4f33916d7315d9cb61c8f2dd9
# Parent 7df072566b8c90914aa71bc5ef0d4f7ec33d70a7
x86: Re-instate warnings for HVM guest writes to read-only memory.
Signed-off-by: Keir Fraser <keir.fraser@xxxxxxxxxx>
---
xen/arch/x86/hvm/hvm.c | 10 +++++++++-
xen/arch/x86/mm/shadow/multi.c | 7 +++++++
2 files changed, 16 insertions(+), 1 deletion(-)
diff -r 7df072566b8c -r 6cec460c3290 xen/arch/x86/hvm/hvm.c
--- a/xen/arch/x86/hvm/hvm.c Thu Jan 08 13:15:49 2009 +0000
+++ b/xen/arch/x86/hvm/hvm.c Thu Jan 08 13:21:06 2009 +0000
@@ -1503,7 +1503,15 @@ static enum hvm_copy_result __hvm_copy(
if ( flags & HVMCOPY_to_guest )
{
- if ( p2mt != p2m_ram_ro )
+ if ( p2mt == p2m_ram_ro )
+ {
+ static unsigned long lastpage;
+ if ( xchg(&lastpage, gfn) != gfn )
+ gdprintk(XENLOG_DEBUG, "guest attempted write to read-only"
+ " memory page. gfn=%#lx, mfn=%#lx\n",
+ gfn, mfn);
+ }
+ else
{
memcpy(p, buf, count);
paging_mark_dirty(curr->domain, mfn);
diff -r 7df072566b8c -r 6cec460c3290 xen/arch/x86/mm/shadow/multi.c
--- a/xen/arch/x86/mm/shadow/multi.c Thu Jan 08 13:15:49 2009 +0000
+++ b/xen/arch/x86/mm/shadow/multi.c Thu Jan 08 13:21:06 2009 +0000
@@ -3230,7 +3230,14 @@ static int sh_page_fault(struct vcpu *v,
/* Ignore attempts to write to read-only memory. */
if ( (p2mt == p2m_ram_ro) && (ft == ft_demand_write) )
+ {
+ static unsigned long lastpage;
+ if ( xchg(&lastpage, va & PAGE_MASK) != (va & PAGE_MASK) )
+ gdprintk(XENLOG_DEBUG, "guest attempted write to read-only memory"
+ " page. va page=%#lx, mfn=%#lx\n",
+ va & PAGE_MASK, mfn_x(gmfn));
goto emulate_readonly; /* skip over the instruction */
+ }
/* In HVM guests, we force CR0.WP always to be set, so that the
* pagetables are always write-protected. If the guest thinks
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|