ia64/xen-unstable

changeset 18432:1e98ea5c8604

x86: Fix guest_handle_okay/guest_handle_subrange_okay

The guest handle checks should use paging_* predicates, not shadow_*.
Also tidy up a few places where p2m definitions were being imported
via asm/guest_access.h -> asm/shadow.h -> asm/p2m.h

Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Wed Sep 03 14:16:35 2008 +0100 (2008-09-03)
parents c759a6cef79f
children c9db93b0660a
files xen/arch/x86/domain.c xen/arch/x86/domain_build.c xen/arch/x86/domctl.c xen/arch/x86/hvm/hvm.c xen/arch/x86/mm/hap/hap.c xen/arch/x86/traps.c xen/include/asm-x86/guest_access.h
line diff
     1.1 --- a/xen/arch/x86/domain.c	Wed Sep 03 14:14:18 2008 +0100
     1.2 +++ b/xen/arch/x86/domain.c	Wed Sep 03 14:16:35 2008 +0100
     1.3 @@ -31,6 +31,7 @@
     1.4  #include <xen/compat.h>
     1.5  #include <xen/acpi.h>
     1.6  #include <xen/pci.h>
     1.7 +#include <xen/paging.h>
     1.8  #include <asm/regs.h>
     1.9  #include <asm/mc146818rtc.h>
    1.10  #include <asm/system.h>
    1.11 @@ -40,7 +41,6 @@
    1.12  #include <asm/i387.h>
    1.13  #include <asm/mpspec.h>
    1.14  #include <asm/ldt.h>
    1.15 -#include <asm/paging.h>
    1.16  #include <asm/hypercall.h>
    1.17  #include <asm/hvm/hvm.h>
    1.18  #include <asm/hvm/support.h>
     2.1 --- a/xen/arch/x86/domain_build.c	Wed Sep 03 14:14:18 2008 +0100
     2.2 +++ b/xen/arch/x86/domain_build.c	Wed Sep 03 14:16:35 2008 +0100
     2.3 @@ -26,6 +26,7 @@
     2.4  #include <asm/desc.h>
     2.5  #include <asm/i387.h>
     2.6  #include <asm/paging.h>
     2.7 +#include <asm/p2m.h>
     2.8  #include <asm/e820.h>
     2.9  
    2.10  #include <public/version.h>
     3.1 --- a/xen/arch/x86/domctl.c	Wed Sep 03 14:14:18 2008 +0100
     3.2 +++ b/xen/arch/x86/domctl.c	Wed Sep 03 14:16:35 2008 +0100
     3.3 @@ -20,7 +20,7 @@
     3.4  #include <xen/trace.h>
     3.5  #include <xen/console.h>
     3.6  #include <xen/iocap.h>
     3.7 -#include <asm/paging.h>
     3.8 +#include <xen/paging.h>
     3.9  #include <asm/irq.h>
    3.10  #include <asm/hvm/hvm.h>
    3.11  #include <asm/hvm/support.h>
     4.1 --- a/xen/arch/x86/hvm/hvm.c	Wed Sep 03 14:14:18 2008 +0100
     4.2 +++ b/xen/arch/x86/hvm/hvm.c	Wed Sep 03 14:16:35 2008 +0100
     4.3 @@ -31,10 +31,11 @@
     4.4  #include <xen/hypercall.h>
     4.5  #include <xen/guest_access.h>
     4.6  #include <xen/event.h>
     4.7 +#include <xen/paging.h>
     4.8 +#include <asm/shadow.h>
     4.9  #include <asm/current.h>
    4.10  #include <asm/e820.h>
    4.11  #include <asm/io.h>
    4.12 -#include <asm/paging.h>
    4.13  #include <asm/regs.h>
    4.14  #include <asm/cpufeature.h>
    4.15  #include <asm/processor.h>
     5.1 --- a/xen/arch/x86/mm/hap/hap.c	Wed Sep 03 14:14:18 2008 +0100
     5.2 +++ b/xen/arch/x86/mm/hap/hap.c	Wed Sep 03 14:16:35 2008 +0100
     5.3 @@ -37,6 +37,7 @@
     5.4  #include <asm/shared.h>
     5.5  #include <asm/hap.h>
     5.6  #include <asm/paging.h>
     5.7 +#include <asm/p2m.h>
     5.8  #include <asm/domain.h>
     5.9  #include <xen/numa.h>
    5.10  
     6.1 --- a/xen/arch/x86/traps.c	Wed Sep 03 14:14:18 2008 +0100
     6.2 +++ b/xen/arch/x86/traps.c	Wed Sep 03 14:16:35 2008 +0100
     6.3 @@ -47,7 +47,7 @@
     6.4  #include <xen/version.h>
     6.5  #include <xen/kexec.h>
     6.6  #include <xen/trace.h>
     6.7 -#include <asm/paging.h>
     6.8 +#include <xen/paging.h>
     6.9  #include <asm/system.h>
    6.10  #include <asm/io.h>
    6.11  #include <asm/atomic.h>
     7.1 --- a/xen/include/asm-x86/guest_access.h	Wed Sep 03 14:14:18 2008 +0100
     7.2 +++ b/xen/include/asm-x86/guest_access.h	Wed Sep 03 14:16:35 2008 +0100
     7.3 @@ -8,7 +8,7 @@
     7.4  #define __ASM_X86_GUEST_ACCESS_H__
     7.5  
     7.6  #include <asm/uaccess.h>
     7.7 -#include <asm/shadow.h>
     7.8 +#include <asm/paging.h>
     7.9  #include <asm/hvm/support.h>
    7.10  #include <asm/hvm/guest_access.h>
    7.11  
    7.12 @@ -87,10 +87,10 @@
    7.13   * Allows use of faster __copy_* functions.
    7.14   */
    7.15  #define guest_handle_okay(hnd, nr)                      \
    7.16 -    (shadow_mode_external(current->domain) ||           \
    7.17 +    (paging_mode_external(current->domain) ||           \
    7.18       array_access_ok((hnd).p, (nr), sizeof(*(hnd).p)))
    7.19  #define guest_handle_subrange_okay(hnd, first, last)    \
    7.20 -    (shadow_mode_external(current->domain) ||           \
    7.21 +    (paging_mode_external(current->domain) ||           \
    7.22       array_access_ok((hnd).p + (first),                 \
    7.23                       (last)-(first)+1,                  \
    7.24                       sizeof(*(hnd).p)))