xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Mohit Gambhir <mohit.gambhir@oracle.com>
To: jun.nakajima@intel.com, kevin.tian@intel.com, xen-devel@lists.xen.org
Cc: boris.ostrovsky@oracle.com, Mohit Gambhir <mohit.gambhir@oracle.com>
Subject: [PATCH] Fix hypervisor crash when writing to VPMU MSR
Date: Thu, 20 Apr 2017 13:49:41 -0400	[thread overview]
Message-ID: <20170420174942.12913-1-mohit.gambhir@oracle.com> (raw)

In order to address the concerns raised in XSA-163, I am writing XTF based
tests to validate PMU MSR read/writes from HVM guests. 

While testing, I found a scenario where setting the Pin Control Flag bit (19) 
of IA32_PERF_EVTSELx results in a General Protection Fault followed by a
hypervisor crash. While Intel SDM Vol 3B, Section 18.2.1.1 Architectural 
Performance Monitoring Version 1 Facilities, describes the bit functionality, 
it is unclear why the fault happens. 

There are two possible solutions to prevent the hypervisor from crashing:

1. Mask the PC bit in the VPMU so as to not allow any writes to it from guests
on any Intel machine. 

2. Use wrmsr_safe() function to write to IA32_PERF_EVTSELx register and return
any resulting fault to the guest OS.

The attached patch uses solution 2 so as to not disable PC flag bit on machines
that do not fault. 

Mohit Gambhir (1):
  x86/vpmu_intel: Fix hypervisor crash by catching wrmsr fault

 xen/arch/x86/cpu/vpmu_intel.c | 20 +++++++++++++-------
 1 file changed, 13 insertions(+), 7 deletions(-)

-- 
2.9.3


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

             reply	other threads:[~2017-04-20 17:49 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-20 17:49 Mohit Gambhir [this message]
2017-04-20 17:49 ` [PATCH] x86/vpmu_intel: Fix hypervisor crash by catching wrmsr fault Mohit Gambhir
2017-04-21  7:14   ` Jan Beulich
2017-04-24 15:44     ` Mohit Gambhir
2017-04-24 16:00       ` Boris Ostrovsky
2017-04-24 18:49         ` Mohit Gambhir
2017-04-24 16:04       ` Jan Beulich

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=20170420174942.12913-1-mohit.gambhir@oracle.com \
    --to=mohit.gambhir@oracle.com \
    --cc=boris.ostrovsky@oracle.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).