From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/2577 Path: news.gmane.org!not-for-mail From: Szabolcs Nagy Newsgroups: gmane.linux.lib.musl.general Subject: Re: musl as a framework to test applications' compatibility with POSIX (was: NULL) Date: Mon, 14 Jan 2013 16:02:24 +0100 Message-ID: <20130114150224.GV4468@port70.net> References: <20130113174731.GS4468@port70.net> <1358106388.32505.17@driftwood> <20130114061135.GM20323@brightrain.aerifal.cx> <20130114084527.GA4055@cachalot> <20130114140334.GA29049@brightrain.aerifal.cx> <20130114143025.GA12142@cachalot> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1358175756 10567 80.91.229.3 (14 Jan 2013 15:02:36 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 14 Jan 2013 15:02:36 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-2578-gllmg-musl=m.gmane.org@lists.openwall.com Mon Jan 14 16:02:53 2013 Return-path: Envelope-to: gllmg-musl@plane.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1TulYr-0005mp-1C for gllmg-musl@plane.gmane.org; Mon, 14 Jan 2013 16:02:53 +0100 Original-Received: (qmail 14161 invoked by uid 550); 14 Jan 2013 15:02:36 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 14153 invoked from network); 14 Jan 2013 15:02:36 -0000 Content-Disposition: inline In-Reply-To: <20130114143025.GA12142@cachalot> User-Agent: Mutt/1.5.21 (2010-09-15) Xref: news.gmane.org gmane.linux.lib.musl.general:2577 Archived-At: * Vasily Kulikov [2013-01-14 18:30:25 +0400]: > > 1) on each call of a variadic function save the list of all types > 2) on each call to va_arg(ap, T) check whether the current argument was > pushed as T in the saved list > > It would catch not only NULL/(void *)NULL, but also int/long or > void*/long bugs. > > Now I see that while it is possible to implement (2) in libc redefining > va_XXX() macros, but it looks like (1) has to be implemented in compiler. > this is what i mean when i wrote 'instrumentation tool' earlier and it can be probably done in asan if it's not already there and i agree with #define NULL 0L it is a valid definition for c and c++ and it does not cause unexpected failures in broken code the only drawback i see is that some trivial errors are not catched by the type checker in c with this definition (using NULL in int/arithmetic context), but that's not a big loss probably