• I
    x86/fpu/math-emu: Fix math-emu boot crash · 5fc96038
    Ingo Molnar 提交于
    On a math-emu bootup the following crash occurs:
    
    	Initializing CPU#0
    	------------[ cut here ]------------
    	kernel BUG at arch/x86/kernel/traps.c:779!
    	invalid opcode: 0000 [#1] SMP
    	[...]
    	EIP is at do_device_not_available+0xe/0x70
    	[...]
    	Call Trace:
    	 [<c18238e6>] error_code+0x5a/0x60
    	 [<c1002bd0>] ? math_error+0x140/0x140
    	 [<c100bbd9>] ? fpu__init_cpu+0x59/0xa0
    	 [<c1012322>] cpu_init+0x202/0x330
    	 [<c104509f>] ? __native_set_fixmap+0x1f/0x30
    	 [<c1b56ab0>] trap_init+0x305/0x346
    	 [<c1b548af>] start_kernel+0x1a5/0x35d
    	 [<c1b542b4>] i386_start_kernel+0x82/0x86
    
    The reason is that in the following commit:
    
      b1276c48 ("x86/fpu: Initialize fpregs in fpu__init_cpu_generic()")
    
    I failed to consider math-emu's limitation that it cannot execute the
    FNINIT instruction in kernel mode.
    
    The long term fix might be to allow math-emu to execute (certain) kernel
    mode FPU instructions, but for now apply the safe (albeit somewhat ugly)
    fix: initialize the emulation state explicitly without trapping out to
    the FPU emulator.
    
    Cc: Andy Lutomirski <luto@amacapital.net>
    Cc: Borislav Petkov <bp@alien8.de>
    Cc: Brian Gerst <brgerst@gmail.com>
    Cc: Dave Hansen <dave.hansen@linux.intel.com>
    Cc: Denys Vlasenko <dvlasenk@redhat.com>
    Cc: Fenghua Yu <fenghua.yu@intel.com>
    Cc: H. Peter Anvin <hpa@zytor.com>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: Oleg Nesterov <oleg@redhat.com>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Quentin Casasnovas <quentin.casasnovas@oracle.com>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Cc: linux-kernel@vger.kernel.org
    Signed-off-by: NIngo Molnar <mingo@kernel.org>
    5fc96038
init.c 10.2 KB