All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Fix hypervisor crash when writing to VPMU MSR
@ 2017-04-20 17:49 Mohit Gambhir
  2017-04-20 17:49 ` [PATCH] x86/vpmu_intel: Fix hypervisor crash by catching wrmsr fault Mohit Gambhir
  0 siblings, 1 reply; 7+ messages in thread
From: Mohit Gambhir @ 2017-04-20 17:49 UTC (permalink / raw)
  To: jun.nakajima, kevin.tian, xen-devel; +Cc: boris.ostrovsky, Mohit Gambhir

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2017-04-24 18:49 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-20 17:49 [PATCH] Fix hypervisor crash when writing to VPMU MSR Mohit Gambhir
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

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.