public inbox for linux-ia64@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Fix race condition in the rt_sigprocmask fastcall for IA64.
@ 2005-06-09 19:29 Christoph Lameter
  2005-06-09 20:08 ` David Mosberger
  0 siblings, 1 reply; 2+ messages in thread
From: Christoph Lameter @ 2005-06-09 19:29 UTC (permalink / raw)
  To: linux-ia64

current->blocked will be set to the value of current->thread_info->flags if the
cmpxchg to update thread_info->flags fails. For performance reasons the store into
current->blocked was placed in the cmpxchg loop. However, the cmpxchg overwrites the
register holding the value to be stored. In the rare case of a retry the value of
thread_info->flags will be written into current->blocked.

The fix is to use another register so that the register containing the current->blocked
value is not overwritten.

Signed-off-by: Christoph Lameter <clameter@sgi.com>

Index: linux-2.6.11/arch/ia64/kernel/fsys.S
=================================--- linux-2.6.11.orig/arch/ia64/kernel/fsys.S	2005-03-01 23:38:34.000000000 -0800
+++ linux-2.6.11/arch/ia64/kernel/fsys.S	2005-06-09 11:46:30.000000000 -0700
@@ -460,9 +460,9 @@ EX(.fail_efault, ld8 r14=[r33])			// r14
 	;;
 
 	st8 [r2]=r14				// update current->blocked with new mask
-	cmpxchg4.acq r14=[r9],r18,ar.ccv	// current->thread_info->flags <- r18
+	cmpxchg4.acq r8=[r9],r18,ar.ccv		// current->thread_info->flags <- r18
 	;;
-	cmp.ne p6,p0=r17,r14			// update failed?
+	cmp.ne p6,p0=r17,r8			// update failed?
 (p6)	br.cond.spnt.few 1b			// yes -> retry
 
 #ifdef CONFIG_SMP

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] Fix race condition in the rt_sigprocmask fastcall for IA64.
  2005-06-09 19:29 [PATCH] Fix race condition in the rt_sigprocmask fastcall for IA64 Christoph Lameter
@ 2005-06-09 20:08 ` David Mosberger
  0 siblings, 0 replies; 2+ messages in thread
From: David Mosberger @ 2005-06-09 20:08 UTC (permalink / raw)
  To: linux-ia64

Good catch.  Patch looks fine to me.

Thanks,

	--david

>>>>> On Thu, 9 Jun 2005 12:29:10 -0700 (PDT), Christoph Lameter <clameter@engr.sgi.com> said:

  current-> blocked will be set to the value of
  current-> thread_info->flags if the cmpxchg to update
  thread_info-> flags fails. For performance reasons the store into
  current-> blocked was placed in the cmpxchg loop. However, the cmpxchg
  Christoph> overwrites the register holding the value to be stored. In the rare
  Christoph> case of a retry the value of thread_info->flags will be written into
  current-> blocked.

  Christoph> The fix is to use another register so that the register containing the
  current-> blocked value is not overwritten.

  Christoph> Signed-off-by: Christoph Lameter <clameter@sgi.com>

  Christoph> Index: linux-2.6.11/arch/ia64/kernel/fsys.S
  Christoph> =================================  Christoph> --- linux-2.6.11.orig/arch/ia64/kernel/fsys.S	2005-03-01 23:38:34.000000000 -0800
  Christoph> +++ linux-2.6.11/arch/ia64/kernel/fsys.S	2005-06-09 11:46:30.000000000 -0700
  Christoph> @@ -460,9 +460,9 @@ EX(.fail_efault, ld8 r14=[r33])			// r14
  Christoph> ;;
 
  Christoph> st8 [r2]=r14				// update current->blocked with new mask
  Christoph> -	cmpxchg4.acq r14=[r9],r18,ar.ccv	// current->thread_info->flags <- r18
  Christoph> +	cmpxchg4.acq r8=[r9],r18,ar.ccv		// current->thread_info->flags <- r18
  Christoph> ;;
  Christoph> -	cmp.ne p6,p0=r17,r14			// update failed?
  Christoph> +	cmp.ne p6,p0=r17,r8			// update failed?
  Christoph> (p6)	br.cond.spnt.few 1b			// yes -> retry
 
  Christoph> #ifdef CONFIG_SMP

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2005-06-09 20:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-06-09 19:29 [PATCH] Fix race condition in the rt_sigprocmask fastcall for IA64 Christoph Lameter
2005-06-09 20:08 ` David Mosberger

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