Skip to contentSkip to conversation

pvh bug fixes

PATCH In review Mukesh Rathor 1 participant 3 messages Feb 22, 2014 – Feb 24, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 pvh bug fixes

Some rearrangement in linux code causes it to go thru certain hypercalls that will cause corruption in xen and crash. I like having a white list for a big feature while it goes thru it's adolescence to catch such bugs, but whatever. Since, it affects pvh dom0 paths only, I didnt' think it was necessary for 4.4.

Attached patch adds check for it, and also certain paths (iirc it was from xentrace) causes panic in hvm_hap_nested_page_fault. add a check in there too.

thanks
Mukesh

#1 lore raw

PATCH 1/1 pvh bug fixes

Nested hvm is presently not supported for pvh. Calling hvm_hap_nested_page_fault in certain paths will crash.

The rearrange in linux code causes it to go thru paths that will corrupt hvm_domain structs and xen to panic for dom0 pvh.

---
 xen/arch/x86/hvm/hvm.c | 3 +++
 xen/arch/x86/irq.c     | 4 ++--
 xen/arch/x86/physdev.c | 4 ++++
 3 files changed, 9 insertions(+), 2 deletions(-)
xen/arch/x86/hvm/hvm.c +3 -0
index 69f7e74..a4a3dcf 100644
@@ -1416,6 +1416,9 @@ int hvm_hap_nested_page_fault(paddr_t gpa,
     int sharing_enomem = 0;
     mem_event_request_t *req_ptr = NULL;
 
+    if ( is_pvh_vcpu(v) )
+        return 0;
+
     /* On Nested Virtualization, walk the guest page table.
      * If this succeeds, all is fine.
      * If this fails, inject a nested page fault into the guest.
xen/arch/x86/irq.c +2 -2
index db70077..88444be 100644
@@ -1068,13 +1068,13 @@ bool_t cpu_has_pending_apic_eoi(void)
 
 static inline void set_pirq_eoi(struct domain *d, unsigned int irq)
 {
-    if ( !is_hvm_domain(d) && d->arch.pv_domain.pirq_eoi_map )
+    if ( is_pv_domain(d) && d->arch.pv_domain.pirq_eoi_map )
         set_bit(irq, d->arch.pv_domain.pirq_eoi_map);
 }
 
 static inline void clear_pirq_eoi(struct domain *d, unsigned int irq)
 {
-    if ( !is_hvm_domain(d) && d->arch.pv_domain.pirq_eoi_map )
+    if ( is_pv_domain(d) && d->arch.pv_domain.pirq_eoi_map )
         clear_bit(irq, d->arch.pv_domain.pirq_eoi_map);
 }
 
xen/arch/x86/physdev.c +4 -0
index bc0634c..9f85857 100644
@@ -339,6 +339,10 @@ ret_t do_physdev_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
         unsigned long mfn;
         struct page_info *page;
 
+        ret = -ENOSYS;
+        if ( is_pvh_vcpu(current) )
+            break;
+
         ret = -EFAULT;
         if ( copy_from_guest(&info, arg, 1) != 0 )
             break;
Signature · 1 line
1.8.3.1
#2 lore raw
In reply to Mukesh Rathor
Quoted 6 lines · On Fri, 21 Feb 2014 18:23:22 -0800 Mukesh Rathor <[email protected]>…

Some rearrangement in linux code causes it to go thru certain hypercalls that will cause corruption in xen and crash. I like having a white list for a big feature while it goes thru it's adolescence to catch such bugs, but whatever. Since, it affects pvh dom0 paths only, I didnt' think it was necessary for 4.4.

Quoted 7 lines

Attached patch adds check for it, and also certain paths (iirc it was from xentrace) causes panic in hvm_hap_nested_page_fault. add a check in there too.

thanks
Mukesh

Please ignore this. Resending with separate patches instead of one.