public inbox for linux-ia64@vger.kernel.org
 help / color / mirror / Atom feed
* [Linux-ia64] [patch] 2.4.21-rc1 Close rmmod race on ia64
@ 2003-05-13  6:43 Keith Owens
  2003-05-13 10:52 ` Andreas Schwab
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Keith Owens @ 2003-05-13  6:43 UTC (permalink / raw)
  To: linux-ia64

ia64 is not taking the spinlock that closes the race between module
removal and traversal of exception tables.  It can result in oops when
one cpu takes an exception while another is unloading a module.

Other architectures take this lock.  The patch is almost a cut and
paste from i386, plus it removes a dead variable.

diff -urp 2.4.21-rc1-ia64.orig/arch/ia64/mm/extable.c 2.4.21-rc1-ia64/arch/ia64/mm/extable.c
--- 2.4.21-rc1-ia64.orig/arch/ia64/mm/extable.c	Sat Aug  3 11:07:44 2002
+++ 2.4.21-rc1-ia64/arch/ia64/mm/extable.c	Tue May 13 16:37:30 2003
@@ -38,6 +38,8 @@ search_one_table (const struct exception
 register unsigned long main_gp __asm__("gp");
 #endif
 
+extern spinlock_t modlist_lock;
+
 struct exception_fixup
 search_exception_table (unsigned long addr)
 {
@@ -51,10 +53,11 @@ search_exception_table (unsigned long ad
 		fix.cont = entry->cont + main_gp;
 	return fix;
 #else
-	struct archdata *archdata;
+	unsigned long flags;
 	struct module *mp;
 
 	/* The kernel is the last "module" -- no need to treat it special. */
+	spin_lock_irqsave(&modlist_lock, flags);
 	for (mp = module_list; mp; mp = mp->next) {
 		if (!mp->ex_table_start)
 			continue;
@@ -65,9 +68,10 @@ search_exception_table (unsigned long ad
 					 addr, (unsigned long) archdata->gp);
 		if (entry) {
 			fix.cont = entry->cont + (unsigned long) archdata->gp;
-			return fix;
+			break;
 		}
 	}
+	spin_unlock_irqrestore(&modlist_lock, flags);
 #endif
 	return fix;
 }



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

* Re: [Linux-ia64] [patch] 2.4.21-rc1 Close rmmod race on ia64
  2003-05-13  6:43 [Linux-ia64] [patch] 2.4.21-rc1 Close rmmod race on ia64 Keith Owens
@ 2003-05-13 10:52 ` Andreas Schwab
  2003-05-13 21:02 ` Bjorn Helgaas
  2003-05-14  2:06 ` Keith Owens
  2 siblings, 0 replies; 4+ messages in thread
From: Andreas Schwab @ 2003-05-13 10:52 UTC (permalink / raw)
  To: linux-ia64

Keith Owens <kaos@sgi.com> writes:

|> @@ -51,10 +53,11 @@ search_exception_table (unsigned long ad
|>  		fix.cont = entry->cont + main_gp;
|>  	return fix;
|>  #else
|> -	struct archdata *archdata;

??? archdata is still needed.

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux AG, Deutschherrnstr. 15-19, D-90429 Nürnberg
Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."


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

* Re: [Linux-ia64] [patch] 2.4.21-rc1 Close rmmod race on ia64
  2003-05-13  6:43 [Linux-ia64] [patch] 2.4.21-rc1 Close rmmod race on ia64 Keith Owens
  2003-05-13 10:52 ` Andreas Schwab
@ 2003-05-13 21:02 ` Bjorn Helgaas
  2003-05-14  2:06 ` Keith Owens
  2 siblings, 0 replies; 4+ messages in thread
From: Bjorn Helgaas @ 2003-05-13 21:02 UTC (permalink / raw)
  To: linux-ia64

On Tuesday 13 May 2003 12:43 am, Keith Owens wrote:
> ia64 is not taking the spinlock that closes the race between module
> removal and traversal of exception tables.  It can result in oops when
> one cpu takes an exception while another is unloading a module.
> 
> Other architectures take this lock.  The patch is almost a cut and
> paste from i386, plus it removes a dead variable.

Applied for 2.4 (except I left in the archdata decl).  Thanks!


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

* Re: [Linux-ia64] [patch] 2.4.21-rc1 Close rmmod race on ia64
  2003-05-13  6:43 [Linux-ia64] [patch] 2.4.21-rc1 Close rmmod race on ia64 Keith Owens
  2003-05-13 10:52 ` Andreas Schwab
  2003-05-13 21:02 ` Bjorn Helgaas
@ 2003-05-14  2:06 ` Keith Owens
  2 siblings, 0 replies; 4+ messages in thread
From: Keith Owens @ 2003-05-14  2:06 UTC (permalink / raw)
  To: linux-ia64

On Tue, 13 May 2003 12:52:36 +0200, 
Andreas Schwab <schwab@suse.de> wrote:
>Keith Owens <kaos@sgi.com> writes:
>
>|> @@ -51,10 +53,11 @@ search_exception_table (unsigned long ad
>|>  		fix.cont = entry->cont + main_gp;
>|>  	return fix;
>|>  #else
>|> -	struct archdata *archdata;
>
>??? archdata is still needed.

I did the original patch against 2.4.20 which does not have archdata
then I made an error on the merge up to 2.4.21-rc1.  -ENOTENOUGHSLEEP.



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

end of thread, other threads:[~2003-05-14  2:06 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-05-13  6:43 [Linux-ia64] [patch] 2.4.21-rc1 Close rmmod race on ia64 Keith Owens
2003-05-13 10:52 ` Andreas Schwab
2003-05-13 21:02 ` Bjorn Helgaas
2003-05-14  2:06 ` Keith Owens

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