Skip to contentSkip to conversation

kvm: pass error code to handler

PATCH In review Lai Jiangshan 2 participants 2 messages Jul 16, 2010 – Jul 18, 2010

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/6 kvm: pass error code to handler

handle_ept_violation() does not pass error code to the handler tdp_page_fault().

It means tdp_page_fault() handles the page fault with ignoring the error code, It will not handle the page fault completely correctly, and may causes endless page fault.

---

arch/x86/kvm/vmx.c +2 -1
index 856e427..b40731e 100644
@@ -3521,7 +3521,8 @@ static int handle_ept_violation(struct kvm_vcpu *vcpu)
 
 	gpa = vmcs_read64(GUEST_PHYSICAL_ADDRESS);
 	trace_kvm_page_fault(gpa, exit_qualification);
-	return kvm_mmu_page_fault(vcpu, gpa & PAGE_MASK, 0);
+	return kvm_mmu_page_fault(vcpu, gpa & PAGE_MASK,
+			exit_qualification & 0x2);
 }
 
 static u64 ept_rsvd_mask(u64 spte, int level)
#1 lore raw
Quoted 8 lines · Lai Jiangshan

handle_ept_violation() does not pass error code to the handler tdp_page_fault().

It means tdp_page_fault() handles the page fault with ignoring the error code, It will not handle the page fault completely correctly, and may causes endless page fault.

Please describe the fail scenario more accurately in the change log?

Can it happen now, or only with the next patches in the series?

arch/x86/kvm/vmx.c static int handle_ept_violation(struct kvm_vcpu *vcpu) · line 3528

Quoted 10 lines
arch/x86/kvm/vmx.c +2 -1
@@ -3521,7 +3521,8 @@ static int handle_ept_violation(struct kvm_vcpu *vcpu)
 
  	gpa = vmcs_read64(GUEST_PHYSICAL_ADDRESS);
  	trace_kvm_page_fault(gpa, exit_qualification);
-	return kvm_mmu_page_fault(vcpu, gpa&  PAGE_MASK, 0);
+	return kvm_mmu_page_fault(vcpu, gpa&  PAGE_MASK,
+			exit_qualification&  0x2);
  }
 
 

Symbolic constant please.

I don't really like how kvm_mmu_page_fault() is overloaded, for !tdp the parameter is a gva, for tdp it is a gpa. We need to break it into two (but later).

Signature · 1 line
error compiling committee.c: too many arguments to function