# HG changeset patch
# User maf46@xxxxxxxxxxxxxxxxx
# Node ID 390e4d63cdb1de2a86c60cecdc4f82c5d69f3aca
# Parent 43564304cf9448ad8978df6d2d0d6721b4615143
Shadow mode's writable-PTs should only allow guest kernels access to PTs
diff -r 43564304cf94 -r 390e4d63cdb1 xen/arch/x86/shadow32.c
--- a/xen/arch/x86/shadow32.c Mon Jul 18 20:22:11 2005
+++ b/xen/arch/x86/shadow32.c Tue Jul 19 10:40:26 2005
@@ -2612,7 +2612,7 @@
if ( unlikely(!(l1e_get_flags(gpte) & _PAGE_RW)) )
{
- if ( shadow_mode_page_writable(d, l1e_get_pfn(gpte)) )
+ if ( shadow_mode_page_writable(va, regs, l1e_get_pfn(gpte)) )
{
allow_writes = 1;
l1e_add_flags(gpte, _PAGE_RW);
diff -r 43564304cf94 -r 390e4d63cdb1 xen/arch/x86/shadow.c
--- a/xen/arch/x86/shadow.c Mon Jul 18 20:22:11 2005
+++ b/xen/arch/x86/shadow.c Tue Jul 19 10:40:26 2005
@@ -1684,7 +1684,7 @@
if ( unlikely(!(l1e_get_flags(gpte) & _PAGE_RW)) )
{
- if ( shadow_mode_page_writable(d, l1e_get_pfn(gpte)) )
+ if ( shadow_mode_page_writable(va, regs, l1e_get_pfn(gpte)) )
{
allow_writes = 1;
l1e_add_flags(gpte, _PAGE_RW);
diff -r 43564304cf94 -r 390e4d63cdb1 xen/include/asm-x86/shadow.h
--- a/xen/include/asm-x86/shadow.h Mon Jul 18 20:22:11 2005
+++ b/xen/include/asm-x86/shadow.h Tue Jul 19 10:40:26 2005
@@ -1691,8 +1691,10 @@
/************************************************************************/
static inline int
-shadow_mode_page_writable(struct domain *d, unsigned long gpfn)
-{
+shadow_mode_page_writable(unsigned long va, struct cpu_user_regs *regs,
unsigned long gpfn)
+{
+ struct vcpu *v = current;
+ struct domain *d = v->domain;
unsigned long mfn = __gpfn_to_mfn(d, gpfn);
u32 type = frame_table[mfn].u.inuse.type_info & PGT_type_mask;
@@ -1701,11 +1703,14 @@
type = shadow_max_pgtable_type(d, gpfn, NULL);
if ( VM_ASSIST(d, VMASST_TYPE_writable_pagetables) &&
- (type == PGT_l1_page_table) )
+ (type == PGT_l1_page_table) &&
+ (va < HYPERVISOR_VIRT_START) &&
+ KERNEL_MODE(v, regs) )
return 1;
if ( shadow_mode_write_all(d) &&
- type && (type <= PGT_l4_page_table) )
+ type && (type <= PGT_l4_page_table) &&
+ KERNEL_MODE(v, regs) )
return 1;
return 0;
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|