* Re: [PATCH v1 5/6] VMX: Disable SMAP feature when guest is in non-paging mode
2014-04-15 13:02 [PATCH v1 5/6] VMX: Disable SMAP feature when guest is in non-paging mode Feng Wu
@ 2014-04-15 10:38 ` Andrew Cooper
2014-04-15 11:50 ` Jan Beulich
1 sibling, 0 replies; 6+ messages in thread
From: Andrew Cooper @ 2014-04-15 10:38 UTC (permalink / raw)
To: Feng Wu; +Cc: jun.nakajima, eddie.dong, Ian.Campbell, JBeulich, xen-devel
On 15/04/14 14:02, Feng Wu wrote:
> SMAP is disabled if CPU is in non-paging mode in hardware.
> However Xen always uses paging mode to emulate guest non-paging
> mode with HAP. To emulate this behavior, SMAP needs to be manually
> disabled when guest switches to non-paging mode.
>
> This logic is similiar with SMEP.
>
> Signed-off-by: Feng Wu <feng.wu@intel.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
> ---
> xen/arch/x86/hvm/vmx/vmx.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
> index 94f3db2..79dd272 100644
> --- a/xen/arch/x86/hvm/vmx/vmx.c
> +++ b/xen/arch/x86/hvm/vmx/vmx.c
> @@ -1310,12 +1310,12 @@ static void vmx_update_guest_cr(struct vcpu *v, unsigned int cr)
> if ( !hvm_paging_enabled(v) )
> {
> /*
> - * SMEP is disabled if CPU is in non-paging mode in hardware.
> + * SMEP/SMAP is disabled if CPU is in non-paging mode in hardware.
> * However Xen always uses paging mode to emulate guest non-paging
> - * mode. To emulate this behavior, SMEP needs to be manually
> + * mode. To emulate this behavior, SMEP/SMAP needs to be manually
> * disabled when guest VCPU is in non-paging mode.
> */
> - v->arch.hvm_vcpu.hw_cr[4] &= ~X86_CR4_SMEP;
> + v->arch.hvm_vcpu.hw_cr[4] &= ~(X86_CR4_SMEP | X86_CR4_SMAP);
> }
> __vmwrite(GUEST_CR4, v->arch.hvm_vcpu.hw_cr[4]);
> break;
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v1 5/6] VMX: Disable SMAP feature when guest is in non-paging mode
2014-04-15 13:02 [PATCH v1 5/6] VMX: Disable SMAP feature when guest is in non-paging mode Feng Wu
2014-04-15 10:38 ` Andrew Cooper
@ 2014-04-15 11:50 ` Jan Beulich
2014-04-16 2:07 ` Wu, Feng
1 sibling, 1 reply; 6+ messages in thread
From: Jan Beulich @ 2014-04-15 11:50 UTC (permalink / raw)
To: Feng Wu; +Cc: eddie.dong, Ian.Campbell, jun.nakajima, xen-devel
>>> On 15.04.14 at 15:02, <feng.wu@intel.com> wrote:
> SMAP is disabled if CPU is in non-paging mode in hardware.
> However Xen always uses paging mode to emulate guest non-paging
> mode with HAP. To emulate this behavior, SMAP needs to be manually
> disabled when guest switches to non-paging mode.
>
> This logic is similiar with SMEP.
The change is certainly fine, but shouldn't this be done earlier in the
series (i.e. the patch moved up)?
Jan
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v1 5/6] VMX: Disable SMAP feature when guest is in non-paging mode
@ 2014-04-15 13:02 Feng Wu
2014-04-15 10:38 ` Andrew Cooper
2014-04-15 11:50 ` Jan Beulich
0 siblings, 2 replies; 6+ messages in thread
From: Feng Wu @ 2014-04-15 13:02 UTC (permalink / raw)
To: JBeulich, Ian.Campbell, xen-devel; +Cc: Feng Wu, eddie.dong, jun.nakajima
SMAP is disabled if CPU is in non-paging mode in hardware.
However Xen always uses paging mode to emulate guest non-paging
mode with HAP. To emulate this behavior, SMAP needs to be manually
disabled when guest switches to non-paging mode.
This logic is similiar with SMEP.
Signed-off-by: Feng Wu <feng.wu@intel.com>
---
xen/arch/x86/hvm/vmx/vmx.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index 94f3db2..79dd272 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -1310,12 +1310,12 @@ static void vmx_update_guest_cr(struct vcpu *v, unsigned int cr)
if ( !hvm_paging_enabled(v) )
{
/*
- * SMEP is disabled if CPU is in non-paging mode in hardware.
+ * SMEP/SMAP is disabled if CPU is in non-paging mode in hardware.
* However Xen always uses paging mode to emulate guest non-paging
- * mode. To emulate this behavior, SMEP needs to be manually
+ * mode. To emulate this behavior, SMEP/SMAP needs to be manually
* disabled when guest VCPU is in non-paging mode.
*/
- v->arch.hvm_vcpu.hw_cr[4] &= ~X86_CR4_SMEP;
+ v->arch.hvm_vcpu.hw_cr[4] &= ~(X86_CR4_SMEP | X86_CR4_SMAP);
}
__vmwrite(GUEST_CR4, v->arch.hvm_vcpu.hw_cr[4]);
break;
--
1.8.3.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v1 5/6] VMX: Disable SMAP feature when guest is in non-paging mode
2014-04-15 11:50 ` Jan Beulich
@ 2014-04-16 2:07 ` Wu, Feng
2014-04-16 8:51 ` Jan Beulich
0 siblings, 1 reply; 6+ messages in thread
From: Wu, Feng @ 2014-04-16 2:07 UTC (permalink / raw)
To: Jan Beulich
Cc: Dong, Eddie, Ian.Campbell@citrix.com, Nakajima, Jun,
xen-devel@lists.xen.org
> -----Original Message-----
> From: Jan Beulich [mailto:JBeulich@suse.com]
> Sent: Tuesday, April 15, 2014 7:51 PM
> To: Wu, Feng
> Cc: Ian.Campbell@citrix.com; Dong, Eddie; Nakajima, Jun;
> xen-devel@lists.xen.org
> Subject: Re: [PATCH v1 5/6] VMX: Disable SMAP feature when guest is in
> non-paging mode
>
> >>> On 15.04.14 at 15:02, <feng.wu@intel.com> wrote:
> > SMAP is disabled if CPU is in non-paging mode in hardware.
> > However Xen always uses paging mode to emulate guest non-paging
> > mode with HAP. To emulate this behavior, SMAP needs to be manually
> > disabled when guest switches to non-paging mode.
> >
> > This logic is similiar with SMEP.
>
> The change is certainly fine, but shouldn't this be done earlier in the
> series (i.e. the patch moved up)?
Yes, maybe we should put it right before "v1-0004-x86-hvm-Add-SMAP-support-to-HVM-guest.patch",
since this changes is for HVM guest. what do you think of this? Thanks!
>
> Jan
Thanks,
Feng
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v1 5/6] VMX: Disable SMAP feature when guest is in non-paging mode
2014-04-16 2:07 ` Wu, Feng
@ 2014-04-16 8:51 ` Jan Beulich
2014-04-16 8:56 ` Wu, Feng
0 siblings, 1 reply; 6+ messages in thread
From: Jan Beulich @ 2014-04-16 8:51 UTC (permalink / raw)
To: Feng Wu
Cc: Eddie Dong, Ian.Campbell@citrix.com, Jun Nakajima,
xen-devel@lists.xen.org
>>> On 16.04.14 at 04:07, <feng.wu@intel.com> wrote:
>
>> -----Original Message-----
>> From: Jan Beulich [mailto:JBeulich@suse.com]
>> Sent: Tuesday, April 15, 2014 7:51 PM
>> To: Wu, Feng
>> Cc: Ian.Campbell@citrix.com; Dong, Eddie; Nakajima, Jun;
>> xen-devel@lists.xen.org
>> Subject: Re: [PATCH v1 5/6] VMX: Disable SMAP feature when guest is in
>> non-paging mode
>>
>> >>> On 15.04.14 at 15:02, <feng.wu@intel.com> wrote:
>> > SMAP is disabled if CPU is in non-paging mode in hardware.
>> > However Xen always uses paging mode to emulate guest non-paging
>> > mode with HAP. To emulate this behavior, SMAP needs to be manually
>> > disabled when guest switches to non-paging mode.
>> >
>> > This logic is similiar with SMEP.
>>
>> The change is certainly fine, but shouldn't this be done earlier in the
>> series (i.e. the patch moved up)?
>
> Yes, maybe we should put it right before
> "v1-0004-x86-hvm-Add-SMAP-support-to-HVM-guest.patch",
> since this changes is for HVM guest. what do you think of this? Thanks!
The change here needs to be done prior (or along with) the feature
getting enabled for the host, whenever that is in the series.
Jan
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v1 5/6] VMX: Disable SMAP feature when guest is in non-paging mode
2014-04-16 8:51 ` Jan Beulich
@ 2014-04-16 8:56 ` Wu, Feng
0 siblings, 0 replies; 6+ messages in thread
From: Wu, Feng @ 2014-04-16 8:56 UTC (permalink / raw)
To: Jan Beulich
Cc: Dong, Eddie, Ian.Campbell@citrix.com, Nakajima, Jun,
xen-devel@lists.xen.org
> -----Original Message-----
> From: Jan Beulich [mailto:JBeulich@suse.com]
> Sent: Wednesday, April 16, 2014 4:52 PM
> To: Wu, Feng
> Cc: Ian.Campbell@citrix.com; Dong, Eddie; Nakajima, Jun;
> xen-devel@lists.xen.org
> Subject: RE: [PATCH v1 5/6] VMX: Disable SMAP feature when guest is in
> non-paging mode
>
> >>> On 16.04.14 at 04:07, <feng.wu@intel.com> wrote:
>
> >
> >> -----Original Message-----
> >> From: Jan Beulich [mailto:JBeulich@suse.com]
> >> Sent: Tuesday, April 15, 2014 7:51 PM
> >> To: Wu, Feng
> >> Cc: Ian.Campbell@citrix.com; Dong, Eddie; Nakajima, Jun;
> >> xen-devel@lists.xen.org
> >> Subject: Re: [PATCH v1 5/6] VMX: Disable SMAP feature when guest is in
> >> non-paging mode
> >>
> >> >>> On 15.04.14 at 15:02, <feng.wu@intel.com> wrote:
> >> > SMAP is disabled if CPU is in non-paging mode in hardware.
> >> > However Xen always uses paging mode to emulate guest non-paging
> >> > mode with HAP. To emulate this behavior, SMAP needs to be manually
> >> > disabled when guest switches to non-paging mode.
> >> >
> >> > This logic is similiar with SMEP.
> >>
> >> The change is certainly fine, but shouldn't this be done earlier in the
> >> series (i.e. the patch moved up)?
> >
> > Yes, maybe we should put it right before
> > "v1-0004-x86-hvm-Add-SMAP-support-to-HVM-guest.patch",
> > since this changes is for HVM guest. what do you think of this? Thanks!
>
> The change here needs to be done prior (or along with) the feature
> getting enabled for the host, whenever that is in the series.
Okay, will change the order in the next version.
>
> Jan
Thanks,
Feng
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2014-04-16 8:56 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-04-15 13:02 [PATCH v1 5/6] VMX: Disable SMAP feature when guest is in non-paging mode Feng Wu
2014-04-15 10:38 ` Andrew Cooper
2014-04-15 11:50 ` Jan Beulich
2014-04-16 2:07 ` Wu, Feng
2014-04-16 8:51 ` Jan Beulich
2014-04-16 8:56 ` Wu, Feng
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.