diff options
-rw-r--r-- | arch/x86/lguest/boot.c | 10 | ||||
-rw-r--r-- | drivers/lguest/core.c | 16 |
2 files changed, 18 insertions, 8 deletions
diff --git a/arch/x86/lguest/boot.c b/arch/x86/lguest/boot.c index 13ee258442ae..f63da5ef217c 100644 --- a/arch/x86/lguest/boot.c +++ b/arch/x86/lguest/boot.c | |||
@@ -70,6 +70,7 @@ | |||
70 | #include <asm/i387.h> | 70 | #include <asm/i387.h> |
71 | #include <asm/stackprotector.h> | 71 | #include <asm/stackprotector.h> |
72 | #include <asm/reboot.h> /* for struct machine_ops */ | 72 | #include <asm/reboot.h> /* for struct machine_ops */ |
73 | #include <asm/kvm_para.h> | ||
73 | 74 | ||
74 | /*G:010 | 75 | /*G:010 |
75 | * Welcome to the Guest! | 76 | * Welcome to the Guest! |
@@ -455,6 +456,15 @@ static void lguest_cpuid(unsigned int *ax, unsigned int *bx, | |||
455 | *ax &= 0xFFFFF0FF; | 456 | *ax &= 0xFFFFF0FF; |
456 | *ax |= 0x00000500; | 457 | *ax |= 0x00000500; |
457 | break; | 458 | break; |
459 | |||
460 | /* | ||
461 | * This is used to detect if we're running under KVM. We might be, | ||
462 | * but that's a Host matter, not us. So say we're not. | ||
463 | */ | ||
464 | case KVM_CPUID_SIGNATURE: | ||
465 | *bx = *cx = *dx = 0; | ||
466 | break; | ||
467 | |||
458 | /* | 468 | /* |
459 | * 0x80000000 returns the highest Extended Function, so we futureproof | 469 | * 0x80000000 returns the highest Extended Function, so we futureproof |
460 | * like we do above by limiting it to known fields. | 470 | * like we do above by limiting it to known fields. |
diff --git a/drivers/lguest/core.c b/drivers/lguest/core.c index 2535933c49f8..b5fdcb78a75b 100644 --- a/drivers/lguest/core.c +++ b/drivers/lguest/core.c | |||
@@ -232,6 +232,13 @@ int run_guest(struct lg_cpu *cpu, unsigned long __user *user) | |||
232 | } | 232 | } |
233 | } | 233 | } |
234 | 234 | ||
235 | /* | ||
236 | * All long-lived kernel loops need to check with this horrible | ||
237 | * thing called the freezer. If the Host is trying to suspend, | ||
238 | * it stops us. | ||
239 | */ | ||
240 | try_to_freeze(); | ||
241 | |||
235 | /* Check for signals */ | 242 | /* Check for signals */ |
236 | if (signal_pending(current)) | 243 | if (signal_pending(current)) |
237 | return -ERESTARTSYS; | 244 | return -ERESTARTSYS; |
@@ -246,13 +253,6 @@ int run_guest(struct lg_cpu *cpu, unsigned long __user *user) | |||
246 | try_deliver_interrupt(cpu, irq, more); | 253 | try_deliver_interrupt(cpu, irq, more); |
247 | 254 | ||
248 | /* | 255 | /* |
249 | * All long-lived kernel loops need to check with this horrible | ||
250 | * thing called the freezer. If the Host is trying to suspend, | ||
251 | * it stops us. | ||
252 | */ | ||
253 | try_to_freeze(); | ||
254 | |||
255 | /* | ||
256 | * Just make absolutely sure the Guest is still alive. One of | 256 | * Just make absolutely sure the Guest is still alive. One of |
257 | * those hypercalls could have been fatal, for example. | 257 | * those hypercalls could have been fatal, for example. |
258 | */ | 258 | */ |
@@ -313,7 +313,7 @@ static int __init init(void) | |||
313 | int err; | 313 | int err; |
314 | 314 | ||
315 | /* Lguest can't run under Xen, VMI or itself. It does Tricky Stuff. */ | 315 | /* Lguest can't run under Xen, VMI or itself. It does Tricky Stuff. */ |
316 | if (paravirt_enabled()) { | 316 | if (get_kernel_rpl() != 0) { |
317 | printk("lguest is afraid of being a guest\n"); | 317 | printk("lguest is afraid of being a guest\n"); |
318 | return -EPERM; | 318 | return -EPERM; |
319 | } | 319 | } |