]> nv-tegra.nvidia Code Review - linux-2.6.git/commitdiff
lguest: fix crash 'unhandled trap 13 at <native_read_msr_safe>'
authorRusty Russell <rusty@rustcorp.com.au>
Mon, 9 Mar 2009 16:06:22 +0000 (10:06 -0600)
committerRusty Russell <rusty@rustcorp.com.au>
Sun, 8 Mar 2009 23:36:28 +0000 (10:06 +1030)
Impact: fix lguest boot crash on modern Intel machines

The code in early_init_intel does:

if (c->x86 > 6 || (c->x86 == 6 && c->x86_model >= 0xd)) {
u64 misc_enable;

rdmsrl(MSR_IA32_MISC_ENABLE, misc_enable);

And that rdmsr faults (not allowed from non-0 PL).  We can get around
this by mugging the family ID part of the cpuid.  5 seems like a good
number.

Of course, this is a hack (how very lguest!).  We could just indicate
that we don't support MSRs, or implement lguest_rdmst.

Reported-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Tested-by: Patrick McHardy <kaber@trash.net>
arch/x86/lguest/boot.c

index 92f1c6f3e19d48b594fa5fcd4694784ae4b324af..ba5c05e97f10068a0dea9a97568ad224ae1bd126 100644 (file)
@@ -343,6 +343,11 @@ static void lguest_cpuid(unsigned int *ax, unsigned int *bx,
                 * flush_tlb_user() for both user and kernel mappings unless
                 * the Page Global Enable (PGE) feature bit is set. */
                *dx |= 0x00002000;
+               /* We also lie, and say we're family id 5.  6 or greater
+                * leads to a rdmsr in early_init_intel which we can't handle.
+                * Family ID is returned as bits 8-12 in ax. */
+               *ax &= 0xFFFFF0FF;
+               *ax |= 0x00000500;
                break;
        case 0x80000000:
                /* Futureproof this a little: if they ask how much extended