public inbox for linux-ia64@vger.kernel.org
 help / color / mirror / Atom feed
* [Linux-ia64] [patch] fix for fph corner case
@ 2001-08-22 16:49 David Mosberger
  0 siblings, 0 replies; only message in thread
From: David Mosberger @ 2001-08-22 16:49 UTC (permalink / raw)
  To: linux-ia64

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

--- lia64/arch/ia64/kernel/signal.c	Wed Apr 11 14:21:32 2001
+++ lia64-kdb/arch/ia64/kernel/signal.c	Tue Aug 21 18:23:50 2001
@@ -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;
 }


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2001-08-22 16:49 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-08-22 16:49 [Linux-ia64] [patch] fix for fph corner case David Mosberger

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