From nobody@FreeBSD.org  Fri Apr 13 21:31:57 2012
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 B2A8D106564A
	for <freebsd-gnats-submit@FreeBSD.org>; Fri, 13 Apr 2012 21:31:57 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from red.freebsd.org (red.freebsd.org [IPv6:2001:4f8:fff6::22])
	by mx1.freebsd.org (Postfix) with ESMTP id 9F7398FC0A
	for <freebsd-gnats-submit@FreeBSD.org>; Fri, 13 Apr 2012 21:31:57 +0000 (UTC)
Received: from red.freebsd.org (localhost [127.0.0.1])
	by red.freebsd.org (8.14.4/8.14.4) with ESMTP id q3DLVv0B060359
	for <freebsd-gnats-submit@FreeBSD.org>; Fri, 13 Apr 2012 21:31:57 GMT
	(envelope-from nobody@red.freebsd.org)
Received: (from nobody@localhost)
	by red.freebsd.org (8.14.4/8.14.4/Submit) id q3DLVvG5060358;
	Fri, 13 Apr 2012 21:31:57 GMT
	(envelope-from nobody)
Message-Id: <201204132131.q3DLVvG5060358@red.freebsd.org>
Date: Fri, 13 Apr 2012 21:31:57 GMT
From: Ryan Stone <rstone@FreeBSD.org>
To: freebsd-gnats-submit@FreeBSD.org
Subject: Use after free in dtrace(1) error handling
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         166921
>Category:       bin
>Synopsis:       Use after free in dtrace(1) error handling
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    markj
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Apr 13 21:40:06 UTC 2012
>Closed-Date:    
>Last-Modified:  Mon Apr 21 17:21:04 UTC 2014
>Originator:     Ryan Stone
>Release:        8-STABLE
>Organization:
>Environment:
>Description:
If I run dtrace(1) under valgrind (memcheck) and hit the "no probes matched" case, I sometimes see dtrace segfault.  It would seem that one thread in dtrace frees memory while the other is still accessing it.  If that memory is subsequently re-allocated dtrace crashes.

Running dtrace with MALLOC_OPTIONS=AJ would probably reproduce this easily.

I think that one sample invocation was something like dtrace -p <pid> -n 'pid$target:libc*:malloc:entry' (see reqst00307862 for the fact that this doesn't match a probe in the first place.

I think that this has the necessary syscalls implemented to run dtrace under valgrind:

https://bitbucket.org/rysto32/valgrind-freebsd
>How-To-Repeat:

>Fix:


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->gnn 
Responsible-Changed-By: rstone 
Responsible-Changed-When: Mon Apr 16 19:24:54 UTC 2012 
Responsible-Changed-Why:  
Over to gnn 

http://www.freebsd.org/cgi/query-pr.cgi?pr=166921 
Responsible-Changed-From-To: gnn->markj 
Responsible-Changed-By: gnn 
Responsible-Changed-When: Mon Apr 21 17:20:56 UTC 2014 
Responsible-Changed-Why:  
Hand over to the person doing most of the DTrace work. 


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