fix for fph corner case
PATCH 1/1 fix for fph corner case
Attached is a small patch that fixes an SMP corner case where the fph (register f32-f127) could get corrupted during signal handling. The sequence of events that led to the corruption is as follows:
- program uses f32-f127 and then gets interrupted by a signal
- signal handler executes and then returns
- on the way back to user-level, the CPU decides it's time for a context switch
- the context switch sees that psr.mfh is set and saves the fph partition, thus overwriting the old state with the register contents from the signal handler
This bug affects SMP only, UP should be fine.
Thanks to Asit for finding and fixing this.
--david
arch/ia64/kernel/signal.c +2 -3
@@ -139,10 +139,9 @@struct ia64_psr *psr =ia64_psr (&scr->pt);__copy_from_user (current->thread.fph, &sc->sc_fr[32 ],96 *16 ); -if (!psr->dfh) { - psr->mfh =0 ; + psr->mfh =0 ;/* drop signal handler's fph contents... */ +if (!psr->dfh)__ia64_load_fpu (current->thread.fph); - } }return err; }