Red Hat axp-list: Linux on Alpha (1995-2022)
 help / color / mirror / Atom feed
From: Nikita Schmidt <cetus@snowball.ucd.ie>
To: axp-list@redhat.com
Subject: Re: 2.2.3: SCSI CDROM kernel panic
Date: Fri, 26 Mar 1999 21:31:55 +0000	[thread overview]
Message-ID: <19990326213155.A738@snowball.ucd.ie> (raw)
In-Reply-To: <199903192042.VAA20752@vmax.unix-ag.uni-siegen.de>; from Nils Faerber on Fri, Mar 19, 1999 at 09:42:12PM +0100

[-- Attachment #1: Type: text/plain, Size: 801 bytes --]

On Friday, 19 Mar, Nils Faerber wrote:
>   I just compiled and install kernel 2.2.3 and noticed that insmodding the
> SCSI cdrom driver causes my machine to crash immediately with a kernel
> panic!

I found that as well.  It looks like a bug in recenly changed semaphore.h.
I came up with a patch that seems to fix it (although formally may
produce faulty code as well...) - see attached.

The problem is in the inline asm, which references a global symbol, thus
using gp, assuming it has been provided by the function's entry code.
The patch fixes only the 'up' function, which causes problems in
sr_ioctl.c, but several other functions from semaphore.h need similar
treatment as well.

I think Richard Henderson, who I believe wrote that code in semaphore.h,
can think of a better solution.

Nikita

[-- Attachment #2: semaphore.diff --]
[-- Type: text/plain, Size: 926 bytes --]

--- linux-2.2.4/include/asm-alpha/semaphore.h.orig	Fri Mar 26 20:26:59 1999
+++ linux-2.2.4/include/asm-alpha/semaphore.h	Fri Mar 26 21:03:08 1999
@@ -167,25 +167,27 @@
 	   it's return address in $28.  The pv is loaded as usual.
 	   The gp is clobbered (in the module case) as usual.  */
 
+	register void *pv __asm__ ("$27") = __up_wakeup;
+
 	__asm__ __volatile__ (
 		"/* semaphore up operation */\n"
 		"	mb\n"
-		"1:	ldl_l	$27,%0\n"
-		"	addl	$27,1,$27\n"
-		"	mov	$27,$28\n"
+		"1:	ldl_l	$24,%0\n"
+		"	addl	$24,1,$24\n"
+		"	mov	$24,$28\n"
 		"	stl_c	$28,%0\n"
 		"	beq	$28,2f\n"
 		"	mb\n"
-		"	ble	$27,3f\n"
+		"	ble	$24,3f\n"
 		"4:\n"
 		".section .text2,\"ax\"\n"
 		"2:	br	1b\n"
 		"3:	lda	$24,%0\n"
-		"	jsr	$28,__up_wakeup\n"
+		"	jsr	$28,(%1),__up_wakeup\n"
 		"	ldgp	$29,0($28)\n"
 		"	br	4b\n"
 		".previous"
-		: : "m"(sem->count)
+		: : "m"(sem->count), "r"(pv)
 		: "$24", "$27", "$28", "memory");
 }
 

      reply	other threads:[~1999-03-26 21:46 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-03-19 20:42 2.2.3: SCSI CDROM kernel panic Nils Faerber
1999-03-26 21:31 ` Nikita Schmidt [this message]
read-only archive

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