From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Xen-devel <xen-devel@lists.xen.org>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>,
Kevin Tian <kevin.tian@intel.com>,
Jun Nakajima <jun.nakajima@intel.com>,
Jan Beulich <JBeulich@suse.com>
Subject: [PATCH 6/6] x86/vvmx: Fix auditing of MSR_BITMAP parameter
Date: Wed, 19 Jul 2017 12:57:57 +0100 [thread overview]
Message-ID: <1500465477-23793-7-git-send-email-andrew.cooper3@citrix.com> (raw)
In-Reply-To: <1500465477-23793-1-git-send-email-andrew.cooper3@citrix.com>
The MSR_BITMAP field is required to be page aligned. Also switch gpa to be a
uint64_t, as the MSR_BITMAP is strictly a 64bit VMCS field.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
CC: Jan Beulich <JBeulich@suse.com>
CC: Jun Nakajima <jun.nakajima@intel.com>
CC: Kevin Tian <kevin.tian@intel.com>
---
xen/arch/x86/hvm/vmx/vvmx.c | 17 +++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)
diff --git a/xen/arch/x86/hvm/vmx/vvmx.c b/xen/arch/x86/hvm/vmx/vvmx.c
index f84478e..6ee5385 100644
--- a/xen/arch/x86/hvm/vmx/vvmx.c
+++ b/xen/arch/x86/hvm/vmx/vvmx.c
@@ -754,14 +754,27 @@ static void __clear_current_vvmcs(struct vcpu *v)
__vmpclear(nvcpu->nv_n2vmcx_pa);
}
-static bool_t __must_check _map_msr_bitmap(struct vcpu *v)
+/*
+ * Refreshes the MSR bitmap mapping for the current nested vcpu. Returns true
+ * for a success mapping, and returns false for MSR_BITMAP parameter errors or
+ * gfn mapping errors.
+ */
+static bool __must_check _map_msr_bitmap(struct vcpu *v)
{
struct nestedvmx *nvmx = &vcpu_2_nvmx(v);
- unsigned long gpa;
+ uint64_t gpa;
if ( nvmx->msrbitmap )
+ {
hvm_unmap_guest_frame(nvmx->msrbitmap, 1);
+ nvmx->msrbitmap = NULL;
+ }
+
gpa = get_vvmcs(v, MSR_BITMAP);
+
+ if ( !IS_ALIGNED(gpa, PAGE_SIZE) )
+ return false;
+
nvmx->msrbitmap = hvm_map_guest_frame_ro(gpa >> PAGE_SHIFT, 1);
return nvmx->msrbitmap != NULL;
--
2.1.4
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
next prev parent reply other threads:[~2017-07-19 11:57 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-19 11:57 [PATCH 0/6] x86/vvmx: Fixes to MSR_BITMAP interception handling Andrew Cooper
2017-07-19 11:57 ` [PATCH 1/6] x86/vmx: Improvements to vmx_{dis, en}able_intercept_for_msr() Andrew Cooper
2017-07-27 5:43 ` Tian, Kevin
2017-07-19 11:57 ` [PATCH 2/6] x86/vpmu: Use vmx_{clear, set}_msr_intercept() rather than opencoding them Andrew Cooper
2017-07-19 12:17 ` Andrew Cooper
2017-07-27 5:46 ` Tian, Kevin
2017-07-19 13:33 ` Boris Ostrovsky
2017-07-19 11:57 ` [PATCH 3/6] x86/vmx: Introduce and use struct vmx_msr_bitmap Andrew Cooper
2017-07-27 6:02 ` Tian, Kevin
2017-07-27 8:30 ` Andrew Cooper
2017-07-27 9:01 ` Tian, Kevin
2017-07-19 11:57 ` [PATCH 4/6] x86/vvmx: Switch nested MSR intercept handling to " Andrew Cooper
2017-07-27 6:09 ` Tian, Kevin
2017-07-19 11:57 ` [PATCH 5/6] x86/vvmx: Fix handing of the MSR_BITMAP field with VMCS shadowing Andrew Cooper
2017-07-26 8:50 ` Sergey Dyasli
2017-07-27 6:11 ` Tian, Kevin
2017-07-19 11:57 ` Andrew Cooper [this message]
2017-07-27 6:13 ` [PATCH 6/6] x86/vvmx: Fix auditing of MSR_BITMAP parameter Tian, Kevin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1500465477-23793-7-git-send-email-andrew.cooper3@citrix.com \
--to=andrew.cooper3@citrix.com \
--cc=JBeulich@suse.com \
--cc=jun.nakajima@intel.com \
--cc=kevin.tian@intel.com \
--cc=xen-devel@lists.xen.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).