direct-io.hg

changeset 12465:d0e9da9cc84a

[HVM] Disallow PTE updates and MMIO accesses from hypervisor mode
(prevents copy_to/from_guest from causing problems, for example).
Signed-off-by: Keir Fraser <keir@xensource.com>
author kfraser@localhost.localdomain
date Thu Nov 16 10:52:03 2006 +0000 (2006-11-16)
parents 2dea3be89513
children c677f4e75608
files xen/arch/x86/mm/shadow/multi.c
line diff
     1.1 --- a/xen/arch/x86/mm/shadow/multi.c	Thu Nov 16 10:50:21 2006 +0000
     1.2 +++ b/xen/arch/x86/mm/shadow/multi.c	Thu Nov 16 10:52:03 2006 +0000
     1.3 @@ -2798,8 +2798,9 @@ static int sh_page_fault(struct vcpu *v,
     1.4       * We do not emulate user writes. Instead we use them as a hint that the
     1.5       * page is no longer a page table. This behaviour differs from native, but
     1.6       * it seems very unlikely that any OS grants user access to page tables.
     1.7 +     * We also disallow guest PTE updates from within Xen.
     1.8       */
     1.9 -    if ( (regs->error_code & PFEC_user_mode) ||
    1.10 +    if ( (regs->error_code & PFEC_user_mode) || !guest_mode(regs) ||
    1.11           x86_emulate_memop(&emul_ctxt, &shadow_emulator_ops) )
    1.12      {
    1.13          SHADOW_PRINTK("emulator failure, unshadowing mfn %#lx\n", 
    1.14 @@ -2839,6 +2840,8 @@ static int sh_page_fault(struct vcpu *v,
    1.15      goto done;
    1.16  
    1.17   mmio:
    1.18 +    if ( !guest_mode(regs) )
    1.19 +        goto not_a_shadow_fault;
    1.20      perfc_incrc(shadow_fault_mmio);
    1.21      sh_audit_gw(v, &gw);
    1.22      unmap_walk(v, &gw);