Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

tracking "stack smashing detected"

by manoj123 (Initiate)
on Oct 27, 2009 at 13:09 UTC ( [id://803429]=perlquestion: print w/replies, xml ) Need Help??

manoj123 has asked for the wisdom of the Perl Monks concerning the following question:

Hi Monks, Am a perl newbie working around an existing perl codebase which works with MySQL DB. My script execution is aborted with "*** stack smashing detected ***: perl terminated" error. I know it is hard to suggest a fix without the code. I am looking for ways to track to the source of the problem. Tried by commenting lines of code and push method on an array seem to be the source but the error log (below) confuses me.
*** stack smashing detected ***: perl terminated ======= Backtrace: ========= /lib/libc.so.6(__fortify_fail+0x4b)[0xb0a90b] /lib/libc.so.6(__fortify_fail+0x0)[0xb0a8c0] /usr/local/lib/perl/5.8.8/auto/DBD/mysql/mysql.so[0xfc75f4] /usr/local/lib/perl/5.8.8/auto/DBD/mysql/mysql.so(mysql_bind_ph+0x5ba) +[0xfb489a] /usr/local/lib/perl/5.8.8/auto/DBD/mysql/mysql.so(XS_DBD__mysql__st_bi +nd_param+0x1fe)[0xfc43de]
Any suggestions welcome

Replies are listed 'Best First'.
Re: tracking "stack smashing detected"
by almut (Canon) on Oct 27, 2009 at 13:59 UTC
    I am looking for ways to track to the source of the problem. (...) but the error log (below) confuses me.

    The error message simply means that glibc's stack protection routines fired due to a corruption of the (C level) stack. Unfortunately, the reasons for this happening are manifold, and detailed knowledge of the internals right down to the assembly level might be required to succesfully debug such things. It could be a buffer overflow, mismatching ABIs (binary interfaces) of the libraries involved, etc. As the last stack frame reported for mysql.so is just an address (without a name), it's likely that the stack (typically function call return address) has already been messed up before that point, which means you'd have to start looking from mysql_bind_ph...

    OTOH, unless you're already familiar with tools such as gdb and valgrind (or would like to learn using them), I'd suggest you try approaching the problem at a somewhat higher level first — maybe you don't need to spend your time debugging things that someone else may already have fixed...   In other words, try upgrading or reinstalling the components involved, check if compatible libs are being loaded (for example, if the MySQL shared lib (libmysql.so) that the Perl binding DBD/mysql/mysql.so loads is the one that it was originally linked against), etc.

Re: tracking "stack smashing detected"
by mje (Curate) on Oct 27, 2009 at 13:14 UTC

    When I last got this I found the problem with valgrind.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://803429]
Approved by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (5)
As of 2024-04-23 11:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found