public inbox for linux-ia64@vger.kernel.org
 help / color / mirror / Atom feed
From: David Mosberger <davidm@hpl.hp.com>
To: linux-ia64@vger.kernel.org
Subject: [Linux-ia64] [patch] fix for fph corner case
Date: Wed, 22 Aug 2001 16:49:57 +0000	[thread overview]
Message-ID: <marc-linux-ia64-105590698805096@msgid-missing> (raw)

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;
 }


                 reply	other threads:[~2001-08-22 16:49 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=marc-linux-ia64-105590698805096@msgid-missing \
    --to=davidm@hpl.hp.com \
    --cc=linux-ia64@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox