From owner-freebsd-current@FreeBSD.ORG Wed Jan 5 16:55:47 2011 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AD2A8106564A; Wed, 5 Jan 2011 16:55:47 +0000 (UTC) (envelope-from uqs@freebsd.org) Received: from acme.spoerlein.net (acme.spoerlein.net [IPv6:2a01:4f8:131:23c2::1]) by mx1.freebsd.org (Postfix) with ESMTP id 42B6C8FC17; Wed, 5 Jan 2011 16:55:47 +0000 (UTC) Received: from localhost (acme.spoerlein.net [IPv6:2a01:4f8:131:23c2::1]) by acme.spoerlein.net (8.14.4/8.14.4) with ESMTP id p05Gtjx9034096 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 5 Jan 2011 17:55:45 +0100 (CET) (envelope-from uqs@freebsd.org) Date: Wed, 5 Jan 2011 17:55:45 +0100 From: Ulrich =?utf-8?B?U3DDtnJsZWlu?= To: John Baldwin Message-ID: <20110105165545.GP23329@acme.spoerlein.net> Mail-Followup-To: John Baldwin , freebsd-current@freebsd.org, Erik Cederstrand References: <20110105131439.GN23329@acme.spoerlein.net> <4184C8F2-3C6D-46FB-8F10-DDEBA6DB1C35@cederstrand.dk> <201101050934.49845.jhb@freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201101050934.49845.jhb@freebsd.org> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: freebsd-current@freebsd.org, Erik Cederstrand Subject: Re: FYI: clang static analyzer page has moved to http://scan.freebsd.your.org/freebsd-head/ X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Jan 2011 16:55:47 -0000 On Wed, 05.01.2011 at 09:34:49 -0500, John Baldwin wrote: > On Wednesday, January 05, 2011 9:11:50 am Erik Cederstrand wrote: > > > > Den 05/01/2011 kl. 14.56 skrev Erik Cederstrand: > > > > > Ignoring contrib code for the moment, I decided to look at usr.sbin.pw > > > from 2011-01-05. There's one report (http://scan.freebsd.your.org/freebsd-head/usr.sbin.pw/2011-01-05-amd64/report-KkilQ3.html#EndPath) > > > which turns out to be a false positive: > > > > > > * Step 6 calls cmdhelp() on line 168; > > > * cmdhelp() ends with "exit(EXIT_FAILURE);" on line 432 which I assume > > > is exit(3) from libc > > > * The analyzer doesn't know that this function never returns and > > > continues to flag a null dereference in step 8 > > > > The same is true of err(), verr(), errc(), verrc(), errx(), and verrx() > > which is also causing false positive reports. They ultimately call exit(3). > > These are all marked as __dead2, so the compiler should "know" that these do > not return. And clang did the right thing here in the past. Beware that it does no inter-procedural analysis yet, so it will usually miss that usage() calls exit unconditionally. *But*, it should grok that for err(3) and exit(3). Now there are some possible remedies: - get IPA to work with clang, or at least file a bug - mark functions as __dead2 (please don't do that) - come up with a way to mark the false positives (kinda impossible with the way scan-build currently works) All interested parties with src access are encouraged to take a look at our Coverity Prevent installation (which is down for maintenance, but should be up soon). Regards, Uli