public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] lguest: fix on Intel when KVM loaded (unhandled trap 13)
@ 2009-05-26 11:24 Rusty Russell
  2009-05-26 11:39 ` Alan Cox
  0 siblings, 1 reply; 3+ messages in thread
From: Rusty Russell @ 2009-05-26 11:24 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: kvm-devel, lguest, linux-kernel

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>
---
 drivers/lguest/x86/core.c |   19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/drivers/lguest/x86/core.c b/drivers/lguest/x86/core.c
--- a/drivers/lguest/x86/core.c
+++ b/drivers/lguest/x86/core.c
@@ -358,6 +358,16 @@ void lguest_arch_handle_trap(struct lg_c
 			if (emulate_insn(cpu))
 				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;
 	case 14: /* We've intercepted a Page Fault. */
 		/* The Guest accessed a virtual address that wasn't mapped.
@@ -403,15 +413,6 @@ void lguest_arch_handle_trap(struct lg_c
 		 * up the pointer now to indicate a hypercall is pending. */
 		cpu->hcall = (struct hcall_args *)cpu->regs;
 		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. */


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] lguest: fix on Intel when KVM loaded (unhandled trap 13)
  2009-05-26 11:24 [PATCH] lguest: fix on Intel when KVM loaded (unhandled trap 13) Rusty Russell
@ 2009-05-26 11:39 ` Alan Cox
  2009-05-26 13:54   ` [Lguest] " Avi Kivity
  0 siblings, 1 reply; 3+ messages in thread
From: Alan Cox @ 2009-05-26 11:39 UTC (permalink / raw)
  To: Rusty Russell; +Cc: Linus Torvalds, kvm-devel, lguest, linux-kernel

On Tue, 26 May 2009 20:54:41 +0930
Rusty Russell <rusty@rustcorp.com.au> wrote:

> 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>

Shouldn't that be fixed in KVM ?

Alan

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Lguest] [PATCH] lguest: fix on Intel when KVM loaded (unhandled trap 13)
  2009-05-26 11:39 ` Alan Cox
@ 2009-05-26 13:54   ` Avi Kivity
  0 siblings, 0 replies; 3+ messages in thread
From: Avi Kivity @ 2009-05-26 13:54 UTC (permalink / raw)
  To: Alan Cox; +Cc: Rusty Russell, kvm-devel, lguest, Linus Torvalds, linux-kernel

Alan Cox wrote:
> On Tue, 26 May 2009 20:54:41 +0930
> Rusty Russell <rusty@rustcorp.com.au> wrote:
>
>   
>> 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>
>>     
>
> Shouldn't that be fixed in KVM ?
>   

KVM never saw that VMCALL or #GP.

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-05-26 13:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-05-26 11:24 [PATCH] lguest: fix on Intel when KVM loaded (unhandled trap 13) Rusty Russell
2009-05-26 11:39 ` Alan Cox
2009-05-26 13:54   ` [Lguest] " Avi Kivity

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox