This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Implement checking for pthread_join


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]