Re: fpu_emulator can lose fpu on get_user/put_user

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Oct 06, 2004 at 10:19:20AM +0900, Atsushi Nemoto wrote:
> I found a potential problem in math emulation.  The math-emu uses
> put_user/get_user to fetch the instruction or to emulate load/store
> fp-regs.  The put_user/get_user can sleep then we can lose fpu
> ownership on it.  It it happened, subsequent restore_fp will cause CpU
> exception which not allowed in kernel.
> 
> Here is a quick fix.  Can be applied bath 2.4 and 2.6.  Could you apply?
> 

I don't feel good about this patch.  If emulator loses FPU ownership it should
get it back, not the caller of emulator.

Jun
 
> --- linux-mips/arch/mips/kernel/traps.c	Sat Aug 14 19:55:20 2004
> +++ linux/arch/mips/kernel/traps.c	Wed Oct  6 09:50:26 2004
> @@ -509,6 +509,10 @@
>  		/* Run the emulator */
>  		sig = fpu_emulator_cop1Handler (0, regs,
>  			&current->thread.fpu.soft);
> +		if (!is_fpu_owner()) {
> +			/* We might lose fpu in fpu_emulator. */
> +			own_fpu();
> +		}
>  
>  		/*
>  		 * We can't allow the emulated instruction to leave any of
> 
> 
> Also, there is another problem in the math-emu.  While math-emu is not
> reentrant, it will not work properly if a process lose ownership in
> the math-emu and another process uses the math-emu.  One possible fix
> is to save/restore ieee754_csr on get_user/put_user.  I will post a
> patch later.
> 
> ---
> Atsushi Nemoto


[Index of Archives]     [Linux MIPS Home]     [LKML Archive]     [Linux ARM Kernel]     [Linux ARM]     [Linux]     [Git]     [Yosemite News]     [Linux SCSI]     [Linux Hams]

  Powered by Linux