This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: Implement checking for pthread_join
- From: Jakub Jelinek <jakub at redhat dot com>
- To: edwintorok at gmail dot com
- Cc: libc-alpha at sourceware dot org
- Date: Fri, 4 Jan 2008 15:41:11 +0100
- Subject: Re: Implement checking for pthread_join
- References: <477E413B.8040905@gmail.com>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Fri, Jan 04, 2008 at 04:22:51PM +0200, T?r?k Edwin wrote:
> IMHO checking (fortifying) should be implemented for pthread_*
> functions, and here is my first attempt to do that for pthread_join.
> I've recently found a bug in a program due to its inapropriate use of
> pthread_join() [1], and neither gcc -fstack-protector [2], nor
> -D_FORTIFY_SOURCE=2 could detect the bug.
> The bug was that second param of pthread_join was pointing to an int,
> rather than a (void*); and since the sizes of those are different on
> x86-64 pthread_join overwrites the stack.
gcc 4.1 will warn:
warning: dereferencing type-punned pointer will break strict-aliasing rules
and if you just removed the bogus and unnecessary casts, any gcc would warn
too:
warning: passing argument 2 of â??pthread_joinâ?? from incompatible pointer type
Your patch is complete overkill.
Jakub