On Thu, Jul 24, 2008 at 11:31:42AM -0700, Linus Torvalds wrote:
init_fpu() will set it to sane init state, from where we can restore.
Yes, this was what I had in mind earlier and should be ok for signal handling
case. But as you also noted below:
We are doing init_fpu(), which should make the data sane again.
This is a paranoid case, just to make sure that the next
math_state_restore() doesn't cause #GP, after someone sets illegal values
through ptrace() or 32bit signal handling (which modifies fpu state in thread
struct). I say paranoid, because we already do the necessary checks
in the corresponding locations like ptrace/32-bit signal handling.
If we don't do init_fpu() + restore from the sane init state, process has
to be killed, in the paranoid failing scenario of math_state_restore()
thanks,
suresh
--