Re: 2.6.10-rc3, i386: fpu handling on sigreturn

From: Bodo Stroesser
Date: Thu Dec 23 2004 - 04:35:54 EST


Andi Kleen wrote:
On Thu, Dec 23, 2004 at 12:49:39AM +0100, Bodo Stroesser wrote:

Andi Kleen wrote:

Bodo Stroesser <bstroesser@xxxxxxxxxxxxxxxxxxx> writes:


Now, the interrupted processes fpu no longer is cleared!


I agree it's a bug, although it's probably pretty obscure so people
didn't notice it. The right fix would be to just clear_fpu again
in this case. The problem has been in Linux forever.

Wouldn't it be better to also reset used_math to 0? (As it has been,
before the sighandler was started)


It would only be an optimization, and i doubt it's worth to optimize for such an obscure case.

-Andi
Sorry, I don't agree. AFAICS, if used_math isn't reset, on the next
attempt of the process to use the fpu, it will be reloaded with the
values, that come from the sighandler and that still reside in
thread.i387. Thus, clear_cpu() without resetting used_math has no
effect to the userspace task.
Resetting current->used_math to 0 would make math_state_restore()
calling init_fpu(), that clears thread.i387 before the fpu is loaded.

Bodo
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/