[PATCH] Fix SMEP issues

2011-08-09 Thread Yang, Wei Y
This patch fix kvm-unit-tests hanging and incorrect PT_ACCESSED_MASK bit set in the case of SMEP fault. Signed-off-by: Yang, Wei --- arch/x86/kvm/paging_tmpl.h | 22 +- 1 files changed, 13 insertions(+), 9 deletions(-) diff --git a/arch/x86/kvm/paging_tmpl.h b/arch

[PATCH kvm-unit-tests v4] Check SMEP when cr0.wp=0

2011-07-05 Thread Yang, Wei
-off-by: Yang, Wei Signed-off-by: Shan, Haitao Signed-off-by: Li, Xin Reviewed-by: Xiao Guangrong --- x86/access.c | 112 ++- x86/cstart64.S |1 + 2 files changed, 110 insertions(+), 3 deletions(-) diff --git a/x86/access.c b/x86

[PATCH kvm-unit-tests v3] Check SMEP when cr0.wp=0

2011-07-05 Thread Yang, Wei
This patch adds SMEP to all test cases and checks SMEP when cr0.wp=0. changes since v2: Recover U/S bit after turning off SMEP and correct the title changes since v1: Add SMEP to all test cases and verify it before setting cr4 Signed-off-by: Yang, Wei Signed-off-by: Shan

RE: [PATCH kvm-unit-tests v2] access: check SMEP on prefetch pte path

2011-07-04 Thread Yang, Wei Y
> -Original Message- > From: kvm-ow...@vger.kernel.org [mailto:kvm-ow...@vger.kernel.org] On > Behalf Of Xiao Guangrong > Sent: Friday, July 01, 2011 4:06 PM > To: Yang, Wei Y > Cc: a...@redhat.com; kvm@vger.kernel.org > Subject: Re: [PATCH kvm-unit-tests v2]

[PATCH kvm-unit-tests v2] access: check SMEP on prefetch pte path

2011-06-29 Thread Yang, Wei
This patch adds SMEP to all test cases and checks SMEP on prefetch pte path when cr0.wp=0. changes since v1: Add SMEP to all test cases and verify it before setting cr4 Signed-off-by: Yang, Wei Signed-off-by: Shan, Haitao Signed-off-by: Li, Xin --- x86/access.c | 108

RE: [PATCH kvm-unit-tests] access: check SMEP on prefetch pte path

2011-06-24 Thread Yang, Wei Y
> > > +void set_cr4_smep(int smep) > > +{ > > +unsigned long cr4 = read_cr4(); > > + > > +cr4 &= ~CR4_SMEP_MASK; > > +if (smep) > > + cr4 |= CR4_SMEP_MASK; > > +write_cr4(cr4); > > +} > > + > > It can work if the box does not support SMEP? It will report unhandled exception 13

[PATCH kvm-unit-tests] access: check SMEP on prefetch pte path

2011-06-24 Thread Yang, Wei
This patch checks SMEP on prefetch pte path when cr0.wp=1 and cr0.wp=0. Signed-off-by: Yang, Wei Signed-off-by: Li, Xin Signed-off-by: Shan, Haitao --- x86/access.c | 92 ++-- x86/cstart64.S |1 + 2 files changed, 90 insertions

[PATCH 3/3] Expose RDWRGSFS bit to KVM guests

2011-06-14 Thread Yang, Wei
This patch exposes RDWRGSFS bit to KVM guests. Signed-off-by: Yang, Wei --- arch/x86/kvm/x86.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 59d25ce..357e63a 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c

[PATCH 2/3] Add RDWRGSFS support when setting CR4

2011-06-14 Thread Yang, Wei
This patch adds RDWRGSFS support when setting CR4. Signed-off-by: Yang, Wei --- arch/x86/kvm/x86.c | 11 +++ 1 files changed, 11 insertions(+), 0 deletions(-) diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index ff4623b..59d25ce 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86

[PATCH 1/3] Remove RDWRGSFS bit from CR4_RESERVED_BITS

2011-06-14 Thread Yang, Wei
This patch removes RDWRGSFS bit from CR4_RESERVED_BITS. Signed-off-by: Yang, Wei --- arch/x86/include/asm/kvm_host.h|2 +- arch/x86/include/asm/processor-flags.h |1 + 2 files changed, 2 insertions(+), 1 deletions(-) diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86

[PATCH 0/3] Enable RDWRGSFS feature support for KVM

2011-06-14 Thread Yang, Wei
This patch enalbes RDWRGSFS feature to KVM guests. Write/read FS/GS base instructions enable user level code to read/write FS & GS segment base registers for thread local storage. Signed-off-by: Yang, Wei --- arch/x86/include/asm/kvm_host.h|2 +- arch/x86/include/asm/proce

[PATCH] Enable ERMS feature support for KVM

2011-06-14 Thread Yang, Wei
This patch exposes ERMS feature to KVM guests. The REP MOVSB/STOSB instruction can enhance fast strings attempts to move as much of the data with larger size load/stores as possible. Signed-off-by: Yang, Wei --- arch/x86/kvm/x86.c |2 +- 1 files changed, 1 insertions(+), 1 deletions

[PATCH] Enable DRNG feature support for KVM

2011-06-13 Thread Yang, Wei Y
This patch exposes DRNG feature to KVM guests. The RDRAND instruction can provide software with sequences of random numbers generated from white noise. Signed-off-by: Yang, Wei --- arch/x86/kvm/x86.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/arch/x86/kvm/x86

[PATCH v8 4/4] Add instruction fetch checking when walking guest page table

2011-06-02 Thread Yang, Wei Y
This patch adds instruction fetch checking when walking guest page table. Signed-off-by: Yang, Wei Signed-off-by: Shan, Haitao Signed-off-by: Li, Xin --- arch/x86/kvm/paging_tmpl.h |9 - 1 files changed, 8 insertions(+), 1 deletions(-) diff --git a/arch/x86/kvm/paging_tmpl.h

[PATCH v8 2/4] Add SMEP support when setting CR4

2011-06-02 Thread Yang, Wei Y
This patch adds SMEP handling when setting CR4. Signed-off-by: Yang, Wei Signed-off-by: Shan, Haitao Signed-off-by: Li, Xin --- arch/x86/kvm/x86.c | 15 +-- 1 files changed, 13 insertions(+), 2 deletions(-) diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 77c9d86

[PATCH v8 0/4] Enable SMEP feature support for KVM

2011-06-02 Thread Yang, Wei Y
This patchset enables a new CPU feature SMEP (Supervisor Mode Execution Protection) in KVM. SMEP prevents kernel from executing code in application. Updated Intel SDM describes this CPU feature. The document will be published soon. This patchset is based on Fenghua's SMEP patch series, as referr

[PATCH v8 3/4] Mask function7 ebx against host capability word9

2011-06-02 Thread Yang, Wei Y
This patch masks CPUID leaf 7 ebx against host capability word9. Signed-off-by: Yang, Wei Signed-off-by: Shan, Haitao Signed-off-by: Li, Xin --- arch/x86/kvm/x86.c | 20 +++- 1 files changed, 19 insertions(+), 1 deletions(-) diff --git a/arch/x86/kvm/x86.c b/arch/x86

[PATCH v8 1/4] Remove SMEP bit from CR4_RESERVED_BITS

2011-06-02 Thread Yang, Wei Y
This patch removes SMEP bit from CR4_RESERVED_BITS. Signed-off-by: Yang, Wei Signed-off-by: Shan, Haitao Signed-off-by: Li, Xin --- arch/x86/include/asm/kvm_host.h |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include

[PATCH v7] Enable CPU SMEP feature for QEMU-KVM

2011-06-01 Thread Yang, Wei Y
before. Get the right value by query KVM kernel module, so that guest can get SMEP through CPUID. Changes since v6: no changes. Changes since v5: no changes. Changes since v4: no changes. Changes since v3: no changes. Changes since v2: no changes. Signed-off-by: Yang, Wei Singed-off-by: Shan

[PATCH v7 4/4] Add instruction fetch checking when walking guest page table

2011-06-01 Thread Yang, Wei Y
This patch adds instruction fetch checking when walking guest page table. Signed-off-by: Yang, Wei Signed-off-by: Shan, Haitao Signed-off-by: Li, Xin --- arch/x86/kvm/paging_tmpl.h |9 - 1 files changed, 8 insertions(+), 1 deletions(-) diff --git a/arch/x86/kvm/paging_tmpl.h

[PATCH v7 3/4] Mask function7 ebx against host capability word9

2011-06-01 Thread Yang, Wei Y
This patch masks CPUID leaf 7 ebx against host capability word9. Signed-off-by: Yang, Wei Signed-off-by: Shan, Haitao Signed-off-by: Li, Xin --- arch/x86/kvm/x86.c | 21 - 1 files changed, 20 insertions(+), 1 deletions(-) diff --git a/arch/x86/kvm/x86.c b/arch/x86

[PATCH v7 2/4] Add SMEP support when setting CR4

2011-06-01 Thread Yang, Wei Y
This patch adds SMEP handling when setting CR4. Signed-off-by: Yang, Wei Signed-off-by: Shan, Haitao Signed-off-by: Li, Xin --- arch/x86/kvm/x86.c | 15 +-- 1 files changed, 13 insertions(+), 2 deletions(-) diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 77c9d86

[PATCH v7 1/4] Remove SMEP bit from CR4_RESERVED_BITS

2011-06-01 Thread Yang, Wei Y
This patch removes SMEP bit from CR4_RESERVED_BITS. Signed-off-by: Yang, Wei Signed-off-by: Shan, Haitao Signed-off-by: Li, Xin --- arch/x86/include/asm/kvm_host.h |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include

[PATCH v7 0/4] Enable SMEP feature support for KVM

2011-06-01 Thread Yang, Wei Y
This patchset enables a new CPU feature SMEP (Supervisor Mode Execution Protection) in KVM. SMEP prevents kernel from executing code in application. Updated Intel SDM describes this CPU feature. The document will be published soon. This patchset is based on Fenghua's SMEP patch series, as referre

[PATCH v6 1/4] Remove SMEP bit from CR4_RESERVED_BITS

2011-05-30 Thread Yang, Wei Y
This patch removes SMEP bit from CR4_RESERVED_BITS. Signed-off-by: Yang, Wei Signed-off-by: Shan, Haitao Signed-off-by: Li, Xin --- arch/x86/include/asm/kvm_host.h |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include

[PATCH v6 0/4] Enable SMEP feature support for KVM

2011-05-30 Thread Yang, Wei Y
This patchset enables a new CPU feature SMEP (Supervisor Mode Execution Protection) in KVM. SMEP prevents kernel from executing code in application. Updated Intel SDM describes this CPU feature. The document will be published soon. This patchset is based on Fenghua's SMEP patch series, as referred

[PATCH v6] Enable CPU SMEP feature for QEMU-KVM

2011-05-30 Thread Yang, Wei Y
before. Get the right value by query KVM kernel module, so that guest can get SMEP through CPUID. Changes since v5: no changes. Changes since v4: no changes. Changes since v3: no changes. Changes since v2: no changes. Signed-off-by: Yang, Wei Singed-off-by: Shan, Haitao Singed-off-by: Li, Xin

[PATCH v6 4/4] Add instruction fetch checking when walking guest page table

2011-05-30 Thread Yang, Wei Y
This patch adds instruction fetch checking when walking guest page table. Signed-off-by: Yang, Wei Signed-off-by: Shan, Haitao Signed-off-by: Li, Xin --- arch/x86/kvm/paging_tmpl.h |9 - 1 files changed, 8 insertions(+), 1 deletions(-) diff --git a/arch/x86/kvm/paging_tmpl.h

[PATCH v6 3/4] Mask function7 ebx against host capability word9

2011-05-30 Thread Yang, Wei Y
This patch masks CPUID leaf 7 ebx against host capability word9. Signed-off-by: Yang, Wei Signed-off-by: Shan, Haitao Signed-off-by: Li, Xin --- arch/x86/kvm/x86.c | 15 ++- 1 files changed, 14 insertions(+), 1 deletions(-) diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86

[PATCH v6 2/4] Add SMEP support when setting CR4

2011-05-30 Thread Yang, Wei Y
This patch adds SMEP handling when setting CR4. Signed-off-by: Yang, Wei Signed-off-by: Shan, Haitao Signed-off-by: Li, Xin --- arch/x86/kvm/x86.c | 15 +-- 1 files changed, 13 insertions(+), 2 deletions(-) diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 77c9d86

[PATCH v5] Enable CPU SMEP feature support for QEMU-KVM

2011-05-29 Thread Yang, Wei Y
before. Get the right value by query KVM kernel module, so that guest can get SMEP through CPUID. Changes since v4: no changes. Changes since v3: no changes. Changes since v2: no changes. Signed-off-by: Yang, Wei Singed-off-by: Shan, Haitao Signed-off-by: Li, Xin --- target-i386/cpuid.c

[Patch v5 4/4] Add instruction fetch checking when walking guest page table

2011-05-29 Thread Yang, Wei Y
This patch adds instruction fetch checking when walking guest page table. Signed-off-by: Yang, Wei Signed-off-by: Shan, Haitao Signed-off-by: Li, Xin --- arch/x86/kvm/paging_tmpl.h |9 - 1 files changed, 8 insertions(+), 1 deletions(-) diff --git a/arch/x86/kvm/paging_tmpl.h

[Patch v5 3/4] Mask function7 ebx against host capability word9

2011-05-29 Thread Yang, Wei Y
This patch masks CPUID leaf 7 ebx against host capability word9. Signed-off-by: Yang, Wei Signed-off-by: Shan, Haitao Signed-off-by: Li, Xin --- arch/x86/kvm/x86.c |7 ++- 1 files changed, 6 insertions(+), 1 deletions(-) diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c

[Patch v5 2/4] Add SMEP handling when setting CR4

2011-05-29 Thread Yang, Wei Y
This patch adds SMEP handling when setting CR4. Signed-off-by: Yang, Wei Signed-off-by: Shan, Haitao Signed-off-by: Li, Xin --- arch/x86/kvm/x86.c | 15 +-- 1 files changed, 13 insertions(+), 2 deletions(-) diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index

[Patch v5 1/4] Remove SMEP bit from CR4_RESERVED_BITS

2011-05-29 Thread Yang, Wei Y
This patch removes SMEP bit from CR4_RESERVED_BITS. Signed-off-by: Yang, Wei Signed-off-by: Shan, Haitao Signed-off-by: Li, Xin --- arch/x86/include/asm/kvm_host.h |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include

[Patch v5 0/4] Enable SMEP feature support for kvm

2011-05-29 Thread Yang, Wei Y
This patchset enables a new CPU feature SMEP (Supervisor Mode Execution Protection) in KVM. SMEP prevents kernel from executing code in application. Updated Intel SDM describes this CPU feature. The document will be published soon. This patchset is based on Fenghua's SMEP patch series, as referr

[PATCH v4] Enable CPU SMEP feature support for QEMU-KVM

2011-05-29 Thread Yang, Wei Y
before. Get the right value by query KVM kernel module, so that guest can get SMEP through CPUID. Changes since v3: no changes. Changes since v2: no changes. Signed-off-by: Yang, Wei Singed-off-by: Shan, Haitao Signed-off-by: Li, Xin --- target-i386/cpuid.c |8 1 files changed, 8

[Patch v4 2/4] Add SMEP handling when setting CR4

2011-05-29 Thread Yang, Wei Y
This patch adds SMEP handling when setting CR4. Signed-off-by: Yang, Wei Signed-off-by: Shan, Haitao Signed-off-by: Li, Xin --- arch/x86/kvm/x86.c | 15 +-- 1 files changed, 13 insertions(+), 2 deletions(-) diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 77c9d86

[Patch v4 4/4] Add instruction fetch checking when walking guest page table

2011-05-29 Thread Yang, Wei Y
This patch adds instruction fetch checking when walking guest page table. Signed-off-by: Yang, Wei Signed-off-by: Shan, Haitao Signed-off-by: Li, Xin --- arch/x86/kvm/paging_tmpl.h |9 - 1 files changed, 8 insertions(+), 1 deletions(-) diff --git a/arch/x86/kvm/paging_tmpl.h

[Patch v4 3/4] Mask function7 ebx against host capability word9

2011-05-29 Thread Yang, Wei Y
This patch masks CPUID leaf 7 ebx against host capability word9. Signed-off-by: Yang, Wei Signed-off-by: Shan, Haitao Signed-off-by: Li, Xin --- arch/x86/kvm/x86.c |7 ++- 1 files changed, 6 insertions(+), 1 deletions(-) diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index

[Patch v4 1/4] Add SMEP bit to CR4_RESERVED_BITS

2011-05-29 Thread Yang, Wei Y
This patch adds SMEP bit to CR4_RESERVED_BITS. Signed-off-by: Yang, Wei Signed-off-by: Shan, Haitao Signed-off-by: Li, Xin --- arch/x86/include/asm/kvm_host.h |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm

[Patch v4 0/4] Enable SMEP feature support for kvm

2011-05-29 Thread Yang, Wei Y
This patchset enables a new CPU feature SMEP (Supervisor Mode Execution Protection) in KVM. SMEP prevents kernel from executing code in application. Updated Intel SDM describes this CPU feature. The document will be published soon. This patchset is based on Fenghua's SMEP patch series, as referre

[PATCH v3] Enable CPU SMEP feature support for QEMU-KVM

2011-05-26 Thread Yang, Wei Y
before. Get the right value by query KVM kernel module, so that guest can get SMEP through CPUID. Changes since v2: no changes. Signed-off-by: Yang, Wei Singed-off-by: Shan, Haitao --- target-i386/cpuid.c |8 1 files changed, 8 insertions(+), 0 deletions(-) diff --git a/target

[Patch v3] Enable CPU SMEP feature for KVM

2011-05-26 Thread Yang, Wei Y
s, as referred by: https://lkml.org/lkml/2011/5/17/523 Changes since v2: enable SMEP for spt mode. Signed-off-by: Yang Wei Signed-off-by: Shan Haitao --- arch/x86/include/asm/kvm_host.h |1 + arch/x86/kvm/paging_tmpl.h | 15 +-- arch/x86/kvm/vmx.c |

RE: [PATCH v2] Enable CPU SMEP feature for KVM

2011-05-22 Thread Yang, Wei Y
> This patch matches with "[PATCH v2] Enable CPU SMEP feature support for > QEMU-KVM", no changes since v1. > > Enable newly documented SMEP (Supervisor Mode Execution Protection) CPU > feature in KVM module. > > Intel new CPU supports SMEP (Supervisor Mode Execution Protection). SMEP > prevents

[PATCH v2] Enable CPU SMEP feature for KVM

2011-05-21 Thread Yang, Wei Y
we don't enable this feature for guests with shadow page tables. Signed-off-by: Yang Wei diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index 5b4cdcb..7b88e76 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c @@ -2743,8 +2743,11 @@ static int vmx_vcpu_setup(struct vcpu_vmx *v

[PATCH v2] Enable CPU SMEP feature support for QEMU-KVM

2011-05-20 Thread Yang, Wei Y
published soon. SMEP is identified by CPUID leaf 7 EBX[7], which is 0 before. Get the right value by query KVM kernel module, so that guest can get SMEP through CPUID. Signed off by: Yang, Wei diff --git a/target-i386/cpuid.c b/target-i386/cpuid.c index 091d812..cd20dbf 100644 --- a/target-i386

[PATCH] Enable CPU SMEP feature for KVM

2011-05-20 Thread Yang, Wei Y
soon. This patch is based on Fenghua's SMEP patch series, as referred by: https://lkml.org/lkml/2011/5/17/523 This patch enables guests' usage of SMEP. Currently, we don't enable this feature for guests with shadow page tables. Signed-off-by: Yang Wei diff --git a/arch/

[PATCH] Enable CPU SMEP feature support for QEMU-KVM

2011-05-20 Thread Yang, Wei Y
soon. SMEP is identified by CPUID leaf 7 EBX[7], which is 0 before. Get the right value by query KVM kernel module, so that guest can get SMEP through CPUID. Signed-off-by: Yang Wei diff --git a/target-i386/cpuid.c b/target-i386/cpuid.c index 091d812..2fff88b 100644 --- a/target-i386