Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 31 Aug 2002 22:21:48 +0100
From:      David Malone <dwmalone@maths.tcd.ie>
To:        Anders Nordby <anders@FreeBSD.org>
Cc:        FreeBSD-gnats-submit@FreeBSD.org, current@FreeBSD.org, mdodd@FreeBSD.org
Subject:   Re: bin/42255: Truss segfaults when tracing sshd
Message-ID:  <20020831212147.GA34455@walton.maths.tcd.ie>
In-Reply-To: <20020831154526.B4E1A20273@totem.fix.no>
References:  <20020831154526.B4E1A20273@totem.fix.no>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, Aug 31, 2002 at 05:45:26PM +0200, Anders Nordby wrote:
> # truss -p `sockstat -l | egrep 'sshd.*tcp4' | awk '{print $3}'`
> 
> Log into the system with sshd, and truss will segfault:

There is an even easier way to reproduce this:

gonzo 9% sleep 10 &
[2] 35245
gonzo 10% truss -p 35245
*segfaults*

It is actually just strcmping a NULL syscall name, which can happen
if you truss a process which is waiting for a syscall to return
when you first attach to the process.

The patch below seems to fix the problem, but I Matthew would like
a more complex fix.

	David.

ndex: syscalls.c
===================================================================
RCS file: /cvs/FreeBSD-CVS/src/usr.bin/truss/syscalls.c,v
retrieving revision 1.25
diff -u -r1.25 syscalls.c
--- syscalls.c  7 Aug 2002 11:35:18 -0000       1.25
+++ syscalls.c  31 Aug 2002 21:10:51 -0000
@@ -411,7 +411,7 @@
   if (trussinfo->flags & FOLLOWFORKS)
     len += fprintf(trussinfo->outfile, "%5d: ", trussinfo->pid);
 
-  if (!strcmp(name, "execve") || !strcmp(name, "exit")) {
+  if (name != NULL && (!strcmp(name, "execve") || !strcmp(name, "exit"))) {
     clock_gettime(CLOCK_REALTIME, &trussinfo->after);
   }
 


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020831212147.GA34455>