Red Hat axp-list: Linux on Alpha (1995-2022)
 help / color / mirror / Atom feed
* Re: Linux-1.3.95 - strace for alpha
  1996-04-25 22:06 Linux-1.3.95 - spelling fixes Thomas Bogendoerfer
@ 1996-04-26 12:52 ` Linus Torvalds
  0 siblings, 0 replies; 3+ messages in thread
From: Linus Torvalds @ 1996-04-26 12:52 UTC (permalink / raw)


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

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

* Re: Linux-1.3.95 - strace for alpha
       [not found] <Pine.LNX.3.91.960426154759.410E-100000@linux.cs.Helsinki.FI>
@ 1996-04-26 21:43 ` Thomas Bogendoerfer
  1996-04-30  0:06   ` Harald Koenig
  0 siblings, 1 reply; 3+ messages in thread
From: Thomas Bogendoerfer @ 1996-04-26 21:43 UTC (permalink / raw)


> 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 

but this wasn't the problem with sys_execve. Strace got confused
by the additional SIGTRAP after a successfull execve. I fixed that
by assuming that there will be no syscall number 0. I also fixed
some minor bugs. You can find the new version in the following
place:

ftp://ftp.franken.de/pub/people/tsbogend/strace-alpha-0.01.tar.gz

Thomas.

-- 
That process _deserves_ to die ("My name is Linus Torvalds, prepare to 
die").                                [Linus Torvalds on linux-kernel]

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

* Re: Linux-1.3.95 - strace for alpha
  1996-04-26 21:43 ` Linux-1.3.95 - strace for alpha Thomas Bogendoerfer
@ 1996-04-30  0:06   ` Harald Koenig
  0 siblings, 0 replies; 3+ messages in thread
From: Harald Koenig @ 1996-04-30  0:06 UTC (permalink / raw)


> ftp://ftp.franken.de/pub/people/tsbogend/strace-alpha-0.01.tar.gz

here is a small patch for strace-alpha-0.01 for the "-t" option

--- strace.c~	Mon Apr 15 00:37:08 1996
+++ strace.c	Tue Apr 30 02:02:28 1996
@@ -1444,7 +1444,8 @@
 		else if (tflag > 2)
 			tprintf("%ld.%06ld ", tv.tv_sec, tv.tv_usec);
 		else {
-			strftime(str, sizeof(str), "%T", localtime((time_t *)&tv.tv_sec));
+		        time_t t = tv.tv_sec;
+			strftime(str, sizeof(str), "%T", localtime(&t));
 			if (tflag > 1)
 				tprintf("%s.%06ld ", str, tv.tv_usec);
 			else

-- 
All SCSI disks will from now on                     ___       _____
be required to send an email notice                0--,|    /OOOOOOO\
24 hours prior to complete hardware failure!      <_/  /  /OOOOOOOOOOO\
                                                    \  \/OOOOOOOOOOOOOOO\
                                                      \ OOOOOOOOOOOOOOOOO|//
Harald Koenig,                                         \/\/\/\/\/\/\/\/\/
Inst.f.Theoret.Astrophysik                              //  /     \\  \
koenig@tat.physik.uni-tuebingen.de                     ^^^^^       ^^^^^

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

end of thread, other threads:[~1996-04-30  0:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [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
1996-04-25 22:06 Linux-1.3.95 - spelling fixes Thomas Bogendoerfer
1996-04-26 12:52 ` Linux-1.3.95 - strace for alpha Linus Torvalds

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