WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

Re: [Xen-devel] [PATCH] add SMEP support to HVM guest

To: <xin.li@xxxxxxxxx>,<xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: Re: [Xen-devel] [PATCH] add SMEP support to HVM guest
From: "Jan Beulich" <jbeulich@xxxxxxxxxx>
Date: Sun, 05 Jun 2011 09:03:31 +0100
Cc: keir.xen@xxxxxxxxx, keir@xxxxxxx, Tim.Deegan@xxxxxxxxxx
Delivery-date: Sun, 05 Jun 2011 01:05:14 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
>>> "Li, Xin" <xin.li@xxxxxxxxx> 06/05/11 2:12 AM >>>
>--- a/xen/arch/x86/hvm/hvm.c    Fri Jun 03 21:39:00 2011 +0100
>+++ b/xen/arch/x86/hvm/hvm.c    Sun Jun 05 08:07:48 2011 +0800
>@@ -1664,7 +1664,8 @@ int hvm_set_cr4(unsigned long value)
>hvm_update_guest_cr(v, 4);
>
>/* Modifying CR4.{PSE,PAE,PGE} invalidates all TLB entries, inc. Global. */
>- if ( (old_cr ^ value) & (X86_CR4_PSE | X86_CR4_PGE | X86_CR4_PAE) ) {
>+ if ( (old_cr ^ value) & (X86_CR4_PSE | X86_CR4_PGE |
>+ X86_CR4_PAE | X86_CR4_SMEP) ) {

Not having access to the specification - why?

>if ( !nestedhvm_vmswitch_in_progress(v) && nestedhvm_vcpu_in_guestmode(v) )
>paging_update_nestedmode(v);
>else
>@@ -2312,7 +2313,8 @@ enum hvm_copy_result hvm_copy_from_guest
>enum hvm_copy_result hvm_fetch_from_guest_virt(
>void *buf, unsigned long vaddr, int size, uint32_t pfec)
>{
>- if ( hvm_nx_enabled(current) )
>+ if ( hvm_nx_enabled(current) ||
>+ (!(pfec | PFEC_user_mode) && hvm_smep_enabled(current)) )

Perhaps rather "!(pfec & PFEC_user_mode)"?

>pfec |= PFEC_insn_fetch;
>return __hvm_copy(buf, vaddr, size,
>HVMCOPY_from_guest | HVMCOPY_fault | HVMCOPY_virt,
>@@ -2338,7 +2340,8 @@ enum hvm_copy_result hvm_copy_from_guest
>enum hvm_copy_result hvm_fetch_from_guest_virt_nofault(
>void *buf, unsigned long vaddr, int size, uint32_t pfec)
>{
>- if ( hvm_nx_enabled(current) )
>+ if ( hvm_nx_enabled(current) ||
>+ (!(pfec | PFEC_user_mode) && hvm_smep_enabled(current)) )

Same here.

Jan
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
<Prev in Thread] Current Thread [Next in Thread>