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 [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message

Reply via email to