From owner-freebsd-current Sat Aug 31 14:21:53 2002 Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id BDFFB37B400; Sat, 31 Aug 2002 14:21:50 -0700 (PDT) Received: from salmon.maths.tcd.ie (salmon.maths.tcd.ie [134.226.81.11]) by mx1.FreeBSD.org (Postfix) with SMTP id 16F3943E42; Sat, 31 Aug 2002 14:21:49 -0700 (PDT) (envelope-from dwmalone@maths.tcd.ie) Received: from walton.maths.tcd.ie by salmon.maths.tcd.ie with SMTP id ; 31 Aug 2002 22:21:48 +0100 (BST) Date: Sat, 31 Aug 2002 22:21:48 +0100 From: David Malone To: Anders Nordby 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> References: <20020831154526.B4E1A20273@totem.fix.no> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20020831154526.B4E1A20273@totem.fix.no> User-Agent: Mutt/1.3.25i Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG 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