Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20130114143025.GA12142@cachalot>
Date: Mon, 14 Jan 2013 18:30:25 +0400
From: Vasily Kulikov <segoon@...nwall.com>
To: musl@...ts.openwall.com
Subject: Re: musl as a framework to test applications' compatibility
 with POSIX (was: NULL)

On Mon, Jan 14, 2013 at 09:03 -0500, Rich Felker wrote:
> On Mon, Jan 14, 2013 at 12:45:27PM +0400, Vasily Kulikov wrote:
> > In musl libc it can be implemented as -DI_WANT_TO_DETECT_GCCISMS.
> 
> At the very least, this would have to be a macro in the reserved
> namespace. However, I'm skeptical of using musl as a tool for checking
> this, especially since the check only works on 64-bit systems and does
> not help the compiler produce a warning/error, but only causes random,
> hard-to-diagnose crashes. It looks like cppcheck is adding (or has
> already added?) a test for incorrectly passing NULL to variadic
> functions, which is probably where the check belongs.

My thought related to this specific bug was a bit more complex:

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.

So, yeah, it is not a musl issue.

Thanks,

-- 
Vasily Kulikov
http://www.openwall.com - bringing security into open computing environments

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.