Red Hat axp-list: Linux on Alpha (1995-2022)
 help / color / mirror / Atom feed
From: Linus Torvalds <torvalds@cs.Helsinki.FI>
Subject: Re: Linux-1.3.95 - strace for alpha
Date: Fri, 26 Apr 1996 15:52:20 +0300 (EET DST)	[thread overview]
Message-ID: <554538b81a21959b94eabef570e8e4de.axp-list@archive.invalid> (raw)
In-Reply-To: <199604252206.AAA01736@bigbug.franken.de>

On Fri, 26 Apr 1996, Thomas Bogendoerfer wrote:
> 
> > For the alpha people, it has support for "strace", but no strace binary that
> > knows about it yet ;-) Thomas Bogendoerfer has been working on that side, but
> > I'm afraid I changed the kernel code a bit, and we'll have to synchronize
> 
> I changed strace, so that it works with the new official interface. 
> I've tared together my current development tree, and put it on
> ftp.franken.de under /pub/people/tsbogend/strace-alpha-0.00.tar.gz.
> There are still lots of bugs in this version, especially with
> execve (strace dumps core:-( ), because it gets a little bit
> confused with the syscall number. I'm now trying to fix the
> remaining bugs. After this is done, I will start clean up sources
> and talk to the strace maintainer (if there is one; it looks
> like nobody maintains strace, because you even can't compile it 
> on Linux/x86) for inclusion of my patches.

I suspect that the 95 kernel still has a bug in strace handling: traced 
system calls that return errors can (and will) corrupt the $9 and $10 
registers that should be safe across system calls. This can result in 
strange behaviour of traced processes (SIGSEGV's etc, if the corrupted 
register was being used to have a pointer in it, for example).

This smallish patch should fix it (totally untested as usual, but it 
looks ok)

		Linus
-----
diff -u --recursive --new-file v1.3.95/linux/arch/alpha/kernel/entry.S linux/arch/alpha/kernel/entry.S
--- v1.3.95/linux/arch/alpha/kernel/entry.S	Wed Apr 24 17:00:33 1996
+++ linux/arch/alpha/kernel/entry.S	Fri Apr 26 12:12:34 1996
@@ -541,7 +541,7 @@
 	jsr     $26,($27),syscall_trace
 	bsr	$1,undo_switch_stack
 
-	/* get the system call number and the argments back.. */
+	/* get the system call number and the arguments back.. */
 	ldq     $0,0($30)
 	ldq     $16,SP_OFF+24($30)
 	ldq     $17,SP_OFF+32($30)
@@ -574,9 +574,9 @@
 
 	.align  3
 strace_error:
-	ldq	$9,0($30)	/* old syscall nr (zero if success) */
-	beq	$9,strace_success
-	ldq	$10,72($30)	/* .. and this a3 */
+	ldq	$19,0($30)	/* old syscall nr (zero if success) */
+	beq	$19,strace_success
+	ldq	$20,72($30)	/* .. and this a3 */
 
 	subq	$31,$0,$0	/* with error in v0 */
 	addq	$31,1,$1	/* set a3 for errno return */
@@ -584,13 +584,15 @@
 	stq	$1,72($30)	/* a3 for return */
 
 	bsr	$1,do_switch_stack
+	bis	$19,$19,$9	/* save old syscall number */
+	bis	$20,$20,$10	/* save old a3 */
 	lda     $27,syscall_trace
 	jsr     $26,($27),syscall_trace
+	bis	$9,$9,$19
+	bis	$10,$10,$20	
 	bsr	$1,undo_switch_stack
 
 	bis	$31,$31,$26	/* tell "ret_from_sys_call" that we can restart */
-	bis	$9,$9,$19	/*  .. old syscall nr */
-	bis	$10,$10,$20	/*  .. old a3 */
 	br	$31,ret_from_sys_call
 
 	.align 3
-----

  reply	other threads:[~1996-04-26 12:52 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <ML-2.2.830355057.1541.torvalds@linux.cs.helsinki.fi>
1996-04-25 22:06 ` Linux-1.3.95 - spelling fixes Thomas Bogendoerfer
1996-04-26 12:52   ` Linus Torvalds [this message]
1996-04-26 14:26   ` Jauder Ho
     [not found] <Pine.LNX.3.91.960426154759.410E-100000@linux.cs.Helsinki.FI>
1996-04-26 21:43 ` Linux-1.3.95 - strace for alpha Thomas Bogendoerfer
1996-04-30  0:06   ` Harald Koenig
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