mirror of
https://github.com/adulau/aha.git
synced 2024-12-28 11:46:19 +00:00
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>
This commit is contained in:
parent
ab2b7ebaad
commit
564346224d
1 changed files with 10 additions and 9 deletions
|
@ -358,6 +358,16 @@ void lguest_arch_handle_trap(struct lg_cpu *cpu)
|
||||||
if (emulate_insn(cpu))
|
if (emulate_insn(cpu))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
/* If KVM is active, the vmcall instruction triggers a
|
||||||
|
* General Protection Fault. Normally it triggers an
|
||||||
|
* invalid opcode fault (6): */
|
||||||
|
case 6:
|
||||||
|
/* We need to check if ring == GUEST_PL and
|
||||||
|
* faulting instruction == vmcall. */
|
||||||
|
if (is_hypercall(cpu)) {
|
||||||
|
rewrite_hypercall(cpu);
|
||||||
|
return;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 14: /* We've intercepted a Page Fault. */
|
case 14: /* We've intercepted a Page Fault. */
|
||||||
/* The Guest accessed a virtual address that wasn't mapped.
|
/* The Guest accessed a virtual address that wasn't mapped.
|
||||||
|
@ -403,15 +413,6 @@ void lguest_arch_handle_trap(struct lg_cpu *cpu)
|
||||||
* up the pointer now to indicate a hypercall is pending. */
|
* up the pointer now to indicate a hypercall is pending. */
|
||||||
cpu->hcall = (struct hcall_args *)cpu->regs;
|
cpu->hcall = (struct hcall_args *)cpu->regs;
|
||||||
return;
|
return;
|
||||||
case 6:
|
|
||||||
/* kvm hypercalls trigger an invalid opcode fault (6).
|
|
||||||
* We need to check if ring == GUEST_PL and
|
|
||||||
* faulting instruction == vmcall. */
|
|
||||||
if (is_hypercall(cpu)) {
|
|
||||||
rewrite_hypercall(cpu);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* We didn't handle the trap, so it needs to go to the Guest. */
|
/* We didn't handle the trap, so it needs to go to the Guest. */
|
||||||
|
|
Loading…
Reference in a new issue