lists.openwall.net | lists / announce owl-users owl-dev john-users john-dev passwdqc-users yescrypt popa3d-users / oss-security kernel-hardening musl sabotage tlsify passwords / crypt-dev xvendor / Bugtraq Full-Disclosure linux-kernel linux-netdev linux-ext4 linux-hardening linux-cve-announce PHC | |
Open Source and information security mailing list archives
| ||
|
Date: Mon, 22 Aug 2016 19:24:32 -0400 From: Brijesh Singh <brijesh.singh@....com> To: <simon.guinot@...uanux.org>, <linux-efi@...r.kernel.org>, <brijesh.singh@....com>, <kvm@...r.kernel.org>, <rkrcmar@...hat.com>, <matt@...eblueprint.co.uk>, <linus.walleij@...aro.org>, <linux-mm@...ck.org>, <paul.gortmaker@...driver.com>, <hpa@...or.com>, <dan.j.williams@...el.com>, <aarcange@...hat.com>, <sfr@...b.auug.org.au>, <andriy.shevchenko@...ux.intel.com>, <herbert@...dor.apana.org.au>, <bhe@...hat.com>, <xemul@...allels.com>, <joro@...tes.org>, <x86@...nel.org>, <mingo@...hat.com>, <msalter@...hat.com>, <ross.zwisler@...ux.intel.com>, <bp@...e.de>, <dyoung@...hat.com>, <thomas.lendacky@....com>, <jroedel@...e.de>, <keescook@...omium.org>, <toshi.kani@....com>, <mathieu.desnoyers@...icios.com>, <devel@...uxdriverproject.org>, <tglx@...utronix.de>, <mchehab@...nel.org>, <iamjoonsoo.kim@....com>, <labbott@...oraproject.org>, <tony.luck@...el.com>, <alexandre.bounine@....com>, <kuleshovmail@...il.com>, <linux-kernel@...r.kernel.org>, <mcgrof@...nel.org>, <linux-crypto@...r.kernel.org>, <pbonzini@...hat.com>, <akpm@...ux-foundation.org>, <davem@...emloft.net> Subject: [RFC PATCH v1 05/28] KVM: SVM: prepare for new bit definition in nested_ctl From: Tom Lendacky <thomas.lendacky@....com> Currently the nested_ctl variable in the vmcb_control_area structure is used to indicate nested paging support. The nested paging support field is actually defined as bit 0 of the this field. In order to support a new feature flag the usage of the nested_ctl and nested paging support must be converted to operate on a single bit. Signed-off-by: Tom Lendacky <thomas.lendacky@....com> --- arch/x86/include/asm/svm.h | 2 ++ arch/x86/kvm/svm.c | 7 ++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/arch/x86/include/asm/svm.h b/arch/x86/include/asm/svm.h index 14824fc..2aca535 100644 --- a/arch/x86/include/asm/svm.h +++ b/arch/x86/include/asm/svm.h @@ -136,6 +136,8 @@ struct __attribute__ ((__packed__)) vmcb_control_area { #define SVM_VM_CR_SVM_LOCK_MASK 0x0008ULL #define SVM_VM_CR_SVM_DIS_MASK 0x0010ULL +#define SVM_NESTED_CTL_NP_ENABLE BIT(0) + struct __attribute__ ((__packed__)) vmcb_seg { u16 selector; u16 attrib; diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c index 9b2de7c..9b59260 100644 --- a/arch/x86/kvm/svm.c +++ b/arch/x86/kvm/svm.c @@ -1177,7 +1177,7 @@ static void init_vmcb(struct vcpu_svm *svm) if (npt_enabled) { /* Setup VMCB for Nested Paging */ - control->nested_ctl = 1; + control->nested_ctl |= SVM_NESTED_CTL_NP_ENABLE; clr_intercept(svm, INTERCEPT_INVLPG); clr_exception_intercept(svm, PF_VECTOR); clr_cr_intercept(svm, INTERCEPT_CR3_READ); @@ -2701,7 +2701,8 @@ static bool nested_vmcb_checks(struct vmcb *vmcb) if (vmcb->control.asid == 0) return false; - if (vmcb->control.nested_ctl && !npt_enabled) + if ((vmcb->control.nested_ctl & SVM_NESTED_CTL_NP_ENABLE) && + !npt_enabled) return false; return true; @@ -2776,7 +2777,7 @@ static bool nested_svm_vmrun(struct vcpu_svm *svm) else svm->vcpu.arch.hflags &= ~HF_HIF_MASK; - if (nested_vmcb->control.nested_ctl) { + if (nested_vmcb->control.nested_ctl & SVM_NESTED_CTL_NP_ENABLE) { kvm_mmu_unload(&svm->vcpu); svm->nested.nested_cr3 = nested_vmcb->control.nested_cr3; nested_svm_init_mmu_context(&svm->vcpu);
Powered by blists - more mailing lists