[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] SVM: handle page faults in emulated instruction fetches
# HG changeset patch # User Keir Fraser <keir.fraser@xxxxxxxxxx> # Date 1205753990 0 # Node ID 8325f200e19414d998b7625f2e3cf786a6d3d3a3 # Parent f82baf1755ac6b4e1b77a35f160d26d30a094a1c SVM: handle page faults in emulated instruction fetches Deal with failures in hvm_copy_from_guest_virt when fetching instructions in the various SVM emulation paths. Since we know that the instruction was fetchable by the hardware, we can usually just return from the VMEXIT and try again; whatever caused us to fail will cause the hardware to fail next time and we'll get the correct exit code. Signed-off-by: Tim Deegan <Tim.Deegan@xxxxxxxxxx> --- xen/arch/x86/hvm/svm/emulate.c | 4 +++- xen/arch/x86/hvm/svm/svm.c | 9 ++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff -r f82baf1755ac -r 8325f200e194 xen/arch/x86/hvm/svm/emulate.c --- a/xen/arch/x86/hvm/svm/emulate.c Mon Mar 17 11:18:06 2008 +0000 +++ b/xen/arch/x86/hvm/svm/emulate.c Mon Mar 17 11:39:50 2008 +0000 @@ -117,7 +117,9 @@ int __get_instruction_length_from_list(s } else { - inst_copy_from_guest(buffer, svm_rip2pointer(v), MAX_INST_LEN); + if ( inst_copy_from_guest(buffer, svm_rip2pointer(v), MAX_INST_LEN) + != MAX_INST_LEN ) + return 0; buf = buffer; } diff -r f82baf1755ac -r 8325f200e194 xen/arch/x86/hvm/svm/svm.c --- a/xen/arch/x86/hvm/svm/svm.c Mon Mar 17 11:18:06 2008 +0000 +++ b/xen/arch/x86/hvm/svm/svm.c Mon Mar 17 11:39:50 2008 +0000 @@ -943,6 +943,10 @@ static void svm_vmexit_do_cpuid(struct c { unsigned int eax, ebx, ecx, edx, inst_len; + inst_len = __get_instruction_length(current, INSTR_CPUID, NULL); + if ( inst_len == 0 ) + return; + eax = regs->eax; ebx = regs->ebx; ecx = regs->ecx; @@ -955,7 +959,6 @@ static void svm_vmexit_do_cpuid(struct c regs->ecx = ecx; regs->edx = edx; - inst_len = __get_instruction_length(current, INSTR_CPUID, NULL); __update_guest_eip(regs, inst_len); } @@ -1166,6 +1169,8 @@ static void svm_vmexit_do_hlt(struct vmc unsigned int inst_len; inst_len = __get_instruction_length(curr, INSTR_HLT, NULL); + if ( inst_len == 0 ) + return 0; __update_guest_eip(regs, inst_len); /* Check for pending exception or new interrupt. */ @@ -1354,6 +1359,8 @@ asmlinkage void svm_vmexit_handler(struc case VMEXIT_VMMCALL: inst_len = __get_instruction_length(v, INSTR_VMCALL, NULL); + if ( inst_len == 0 ) + break; HVMTRACE_1D(VMMCALL, v, regs->eax); rc = hvm_do_hypercall(regs); if ( rc != HVM_HCALL_preempted ) _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |