From nobody@FreeBSD.org  Mon Apr 13 10:41:30 2009
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id BD574106566C
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 13 Apr 2009 10:41:30 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21])
	by mx1.freebsd.org (Postfix) with ESMTP id AB7B78FC0C
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 13 Apr 2009 10:41:30 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.14.3/8.14.3) with ESMTP id n3DAfU9G090938
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 13 Apr 2009 10:41:30 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.14.3/8.14.3/Submit) id n3DAfUWp090937;
	Mon, 13 Apr 2009 10:41:30 GMT
	(envelope-from nobody)
Message-Id: <200904131041.n3DAfUWp090937@www.freebsd.org>
Date: Mon, 13 Apr 2009 10:41:30 GMT
From: Mateusz Guzik <mjguzik@gmail.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: [truss] If traced process is killed by signal, truss enters infinite loop
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         133700
>Category:       bin
>Synopsis:       [patch] truss(1): If traced process is killed by signal, truss enters infinite loop
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    delphij
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Apr 13 10:50:00 UTC 2009
>Closed-Date:    Wed May 06 22:28:33 UTC 2009
>Last-Modified:  Wed May 06 22:28:33 UTC 2009
>Originator:     Mateusz Guzik
>Release:        8.0-CURRENT
>Organization:
>Environment:
FreeBSD eternal 8.0-CURRENT FreeBSD 8.0-CURRENT #2: Sat Mar 28 00:24:50 CET 2009     f@eternal:/usr/obj/usr/src/sys/ETERNAL  i386

>Description:
If traced process is killed by signal, truss enters infinite loop.
>How-To-Repeat:
Run the following program under truss: int main() {raise(11);}


>Fix:
The problem lies in setup.c:waitevent():
if (WIFSIGNALED(waitval)) {
        info->pr_why = S_EXIT;
        info->pr_why = 0;
        return;
}

pr_why is zeroed just after its set to S_EXIT.

Patch attached with submission follows:

--- usr.bin/truss/setup.c.orig	2007-06-27 00:42:37.000000000 +0200
+++ usr.bin/truss/setup.c	2009-04-13 00:06:45.000000000 +0200
@@ -215,7 +215,7 @@
 	}
 	if (WIFSIGNALED(waitval)) {
 	        info->pr_why = S_EXIT;
-		info->pr_why = 0;
+		info->pr_data = 0;
                 return;
 	}
 }


>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->patched 
State-Changed-By: jhb 
State-Changed-When: Wed May 6 18:52:58 UTC 2009 
State-Changed-Why:  
This was just committed to HEAD a few weeks ago, so changing it to patched 
to serve as a MFC reminder. 


Responsible-Changed-From-To: freebsd-bugs->delphij 
Responsible-Changed-By: jhb 
Responsible-Changed-When: Wed May 6 18:52:58 UTC 2009 
Responsible-Changed-Why:  
This was just committed to HEAD a few weeks ago, so changing it to patched 
to serve as a MFC reminder. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=133700 
State-Changed-From-To: patched->closed 
State-Changed-By: delphij 
State-Changed-When: Wed May 6 22:27:50 UTC 2009 
State-Changed-Why:  
This has been fixed in 7.2-STABLE with revision 191860, 
thanks for your report! 

http://www.freebsd.org/cgi/query-pr.cgi?pr=133700 
>Unformatted:
