diff options
author | Rusty Russell <rusty@rustcorp.com.au> | 2009-05-26 07:24:41 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-05-26 15:13:11 -0400 |
commit | 564346224daaa8f7222d7a92cdbb7bafde59ae6e (patch) | |
tree | d91ddfa810c3d9aaf3b33f00d7ae80bd541b1f4b /drivers/lguest | |
parent | ab2b7ebaad16226c9a5e85c5f384d19fa58a7459 (diff) |
lguest: fix on Intel when KVM loaded (unhandled trap 13)
When KVM is loaded, and hence VT set up, the vmcall instruction in an
lguest guest causes a #GP, not #UD.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/lguest')
-rw-r--r-- | drivers/lguest/x86/core.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/drivers/lguest/x86/core.c b/drivers/lguest/x86/core.c index 1a83910f674f..eaf722fe309a 100644 --- a/drivers/lguest/x86/core.c +++ b/drivers/lguest/x86/core.c | |||
@@ -358,6 +358,16 @@ void lguest_arch_handle_trap(struct lg_cpu *cpu) | |||
358 | if (emulate_insn(cpu)) | 358 | if (emulate_insn(cpu)) |
359 | return; | 359 | return; |
360 | } | 360 | } |
361 | /* If KVM is active, the vmcall instruction triggers a | ||
362 | * General Protection Fault. Normally it triggers an | ||
363 | * invalid opcode fault (6): */ | ||
364 | case 6: | ||
365 | /* We need to check if ring == GUEST_PL and | ||
366 | * faulting instruction == vmcall. */ | ||
367 | if (is_hypercall(cpu)) { | ||
368 | rewrite_hypercall(cpu); | ||
369 | return; | ||
370 | } | ||
361 | break; | 371 | break; |
362 | case 14: /* We've intercepted a Page Fault. */ | 372 | case 14: /* We've intercepted a Page Fault. */ |
363 | /* The Guest accessed a virtual address that wasn't mapped. | 373 | /* The Guest accessed a virtual address that wasn't mapped. |
@@ -403,15 +413,6 @@ void lguest_arch_handle_trap(struct lg_cpu *cpu) | |||
403 | * up the pointer now to indicate a hypercall is pending. */ | 413 | * up the pointer now to indicate a hypercall is pending. */ |
404 | cpu->hcall = (struct hcall_args *)cpu->regs; | 414 | cpu->hcall = (struct hcall_args *)cpu->regs; |
405 | return; | 415 | return; |
406 | case 6: | ||
407 | /* kvm hypercalls trigger an invalid opcode fault (6). | ||
408 | * We need to check if ring == GUEST_PL and | ||
409 | * faulting instruction == vmcall. */ | ||
410 | if (is_hypercall(cpu)) { | ||
411 | rewrite_hypercall(cpu); | ||
412 | return; | ||
413 | } | ||
414 | break; | ||
415 | } | 416 | } |
416 | 417 | ||
417 | /* We didn't handle the trap, so it needs to go to the Guest. */ | 418 | /* We didn't handle the trap, so it needs to go to the Guest. */ |