public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* 2.6.10-rc3, i386: fpu handling on sigreturn
@ 2004-12-22 17:42 Bodo Stroesser
  0 siblings, 0 replies; 6+ messages in thread
From: Bodo Stroesser @ 2004-12-22 17:42 UTC (permalink / raw)
  To: linux-kernel

Maybe, there is a problem in i386 fpu/signal handling:

On i386, if a signal handler is started, the kernel saves the fpu-state
of the interrupted routine in the sigcontext on the stack. Calling
unlazy_fpu() and setting current->used_math=0, the kernel supplies the
signal-handler with a cleared virtual fpu.
On sigreturn(), the old fpu-state of the interrupted routine is
restored.

If a process never used the fpu, it virtually has a cleared fpu.
If such a process is interrupted by a signal handler, no fpu-context is
saved and sigcontext->fpstate is set to NULL.

Assume, that the signal handler uses the fpu. Then, AFAICS, on sigreturn
current->used_math will be 1. Since sigcontext->fpstate still is NULL,
restore_sigcontext() doesn't call restore_i387(). Thus, no
clear_fpu() is done, current->used_math is not reset.

Now, the interrupted processes fpu no longer is cleared!

I don't know, if this could cause trouble, since I'm not an expert for
i386-fpu. But it seems to be not clean.

Best regards
Bodo



^ permalink raw reply	[flat|nested] 6+ messages in thread
[parent not found: <41C9B21F.90802@fujitsu-siemens.com.suse.lists.linux.kernel>]

end of thread, other threads:[~2004-12-23 11:29 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-12-22 17:42 2.6.10-rc3, i386: fpu handling on sigreturn Bodo Stroesser
     [not found] <41C9B21F.90802@fujitsu-siemens.com.suse.lists.linux.kernel>
2004-12-22 23:24 ` Andi Kleen
2004-12-22 23:49   ` Bodo Stroesser
2004-12-22 23:54     ` Andi Kleen
2004-12-23  9:33       ` Bodo Stroesser
2004-12-23 11:29         ` Andi Kleen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox