[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH v4 06/10] x86: Temporary disable SMAP to legally access user pages in kernel mode



>>> On 05.05.14 at 10:22, <feng.wu@xxxxxxxxx> wrote:
> --- a/xen/arch/x86/usercopy.c
> +++ b/xen/arch/x86/usercopy.c
> @@ -15,6 +15,7 @@ unsigned long __copy_to_user_ll(void __user *to, const void 
> *from, unsigned n)
>      unsigned long __d0, __d1, __d2, __n = n;
>  
>      asm volatile (
> +        ASM_STAC"\n"
>          "    cmp  $"STR(2*BYTES_PER_LONG-1)",%0\n"
>          "    jbe  1f\n"
>          "    mov  %1,%0\n"
> @@ -30,6 +31,7 @@ unsigned long __copy_to_user_ll(void __user *to, const void 
> *from, unsigned n)
>          "    mov  %3,%0\n"
>          "1:  rep movsb\n" /* ...remainder copied as bytes */
>          "2:\n"
> +        ASM_CLAC"\n"
>          ".section .fixup,\"ax\"\n"
>          "5:  add %3,%0\n"
>          "    jmp 2b\n"

Here and elsewhere I'd much prefer you using stac()/clac() - their
memory clobbers should prevent them from getting moved to non-
suitable places.

Jan


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.