On 06/13/2010 03:27 PM, Nadav Har'El wrote:
This patch implements the VMCLEAR instruction.

+
+/* Emulate the VMCLEAR instruction */
+static int handle_vmclear(struct kvm_vcpu *vcpu)
+{
+       struct vcpu_vmx *vmx = to_vmx(vcpu);
+       gpa_t guest_vmcs_addr, save_current_vmptr;
+
+       if (!nested_vmx_check_permission(vcpu))
+               return 1;
+
+       if (read_guest_vmcs_gpa(vcpu,&guest_vmcs_addr))
+               return 1;
+
+       save_current_vmptr = vmx->nested.current_vmptr;
+
+       vmx->nested.current_vmptr = guest_vmcs_addr;
+       if (!nested_map_current(vcpu))
+               return 1;

Haven't you leaked current_vmptr here?

If I read the code correctly, you are implementing a sort of stack here and pushing the current vmptr into save_current_vmptr. Perhaps it's simper to have an nvmxptr structure which holds a vmptr and a kmap'ed pointer to it, and pass that around to functions.

+       vmx->nested.current_l2_page->launch_state = 0;
+       nested_unmap_current(vcpu);
+
+       nested_free_current_vmcs(vcpu);
+
+       if (save_current_vmptr == guest_vmcs_addr)
+               vmx->nested.current_vmptr = -1ull;
+       else
+               vmx->nested.current_vmptr = save_current_vmptr;
+
+       skip_emulated_instruction(vcpu);
+       clear_rflags_cf_zf(vcpu);
+       return 1;
+}
+

--
error compiling committee.c: too many arguments to function

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to