On Sat, Dec 05, 2009 at 06:17:23PM +0100, Cosimo Streppone wrote: > Hi perl5-porters, > > I'm trying to work on an "interesting" problem. > It regards an XS module I wrote some time ago. > This module used to work perfectly under various Linux distributions, > including RHEL4, and Win32. > > Now, with RHEL5, it's been reported to crash with "*** buffer overflow > detected ***" messages, > presumably when using `call_sv()' from XS code. > > After digging a bit into the problem, it seems that the use of > -D_FORTIFY_SOURCE=2 > in conjunction with and -O2 in $CFLAGS is causing these (fake?) buffer > overflows. > > Actually the problems are intermittent: that is, if I run the test > suite of the module, > it fails maybe 40%-50% of the times. Horrible. > > Reading briefly about _FORTIFY_SOURCE=2 from people having the same problem, > it would seem to me that it is just a really bad idea to have that enabled > for a perl (interpreter and modules) installation. Unfortunately, this > is the default in $CFLAGS for RHEL5. > > So, coming to the question, has any of you dealt with this before? > Any advice? Assuming both perl and your module are built with debugging information, what errors/backtraces do you see when you run your test case under valgrind. Of course, valgrind typically won't help if the overflowing buffers are on the stack instead of malloced(). TonyThread Previous