ia64/xen-unstable

changeset 6251:082a537ff4de

Fix __get_user() and friends to work correctly for
64-bit quantities on x86/32. Should fix writable
pagetables on PAE.

Signed-off-by: Keir Fraser <keir@xensource.com>
author kaf24@firebug.cl.cam.ac.uk
date Thu Aug 18 17:04:48 2005 +0000 (2005-08-18)
parents 684d81933442
children 67a13c0ac87d
files xen/arch/x86/mm.c xen/include/asm-x86/uaccess.h
line diff
     1.1 --- a/xen/arch/x86/mm.c	Thu Aug 18 16:04:00 2005 +0000
     1.2 +++ b/xen/arch/x86/mm.c	Thu Aug 18 17:04:48 2005 +0000
     1.3 @@ -3299,8 +3299,8 @@ int ptwr_do_page_fault(struct domain *d,
     1.4      
     1.5      /* Finally, make the p.t. page writable by the guest OS. */
     1.6      l1e_add_flags(pte, _PAGE_RW);
     1.7 -    if ( unlikely(__copy_to_user(&linear_pg_table[l1_linear_offset(addr)],
     1.8 -                                 &pte, sizeof(pte))) )
     1.9 +    if ( unlikely(__put_user(pte.l1,
    1.10 +                             &linear_pg_table[l1_linear_offset(addr)].l1)) )
    1.11      {
    1.12          MEM_LOG("ptwr: Could not update pte at %p", (unsigned long *)
    1.13                  &linear_pg_table[l1_linear_offset(addr)]);
     2.1 --- a/xen/include/asm-x86/uaccess.h	Thu Aug 18 16:04:00 2005 +0000
     2.2 +++ b/xen/include/asm-x86/uaccess.h	Thu Aug 18 17:04:48 2005 +0000
     2.3 @@ -125,22 +125,20 @@ extern void __put_user_bad(void);
     2.4  	__pu_err;							\
     2.5  })							
     2.6  
     2.7 -#define __get_user_nocheck(x,ptr,size)				\
     2.8 -({								\
     2.9 -	long __gu_err, __gu_val;				\
    2.10 -	__get_user_size(__gu_val,(ptr),(size),__gu_err,-EFAULT);\
    2.11 -	(x) = (__typeof__(*(ptr)))__gu_val;			\
    2.12 -	__gu_err;						\
    2.13 +#define __get_user_nocheck(x,ptr,size)                          \
    2.14 +({                                                              \
    2.15 +	long __gu_err;                                          \
    2.16 +	__get_user_size((x),(ptr),(size),__gu_err,-EFAULT);     \
    2.17 +	__gu_err;                                               \
    2.18  })
    2.19  
    2.20 -#define __get_user_check(x,ptr,size)					\
    2.21 -({									\
    2.22 -	long __gu_err, __gu_val;					\
    2.23 -	__typeof__(*(ptr)) __user *__gu_addr = (ptr);			\
    2.24 -	__get_user_size(__gu_val,__gu_addr,(size),__gu_err,-EFAULT);	\
    2.25 -	(x) = (__typeof__(*(ptr)))__gu_val;				\
    2.26 -	if (!__addr_ok(__gu_addr)) __gu_err = -EFAULT;			\
    2.27 -	__gu_err;							\
    2.28 +#define __get_user_check(x,ptr,size)                            \
    2.29 +({                                                              \
    2.30 +	long __gu_err;                                          \
    2.31 +	__typeof__(*(ptr)) __user *__gu_addr = (ptr);           \
    2.32 +	__get_user_size((x),__gu_addr,(size),__gu_err,-EFAULT); \
    2.33 +	if (!__addr_ok(__gu_addr)) __gu_err = -EFAULT;          \
    2.34 +	__gu_err;                                               \
    2.35  })							
    2.36  
    2.37  struct __large_struct { unsigned long buf[100]; };