Ruby 2.5.1 crashed - how to read this memory map? - ruby

I'm upgrading to Ruby 2.5.1 and when a unicorn worker crashed during testing, I got a ton of output that I'm not sure how to interpret.
Does anyone know what each of these columns means? I think if I understood this better, I'd be able to find what caused the issue, as the output is rather larger than what I pasted here.
* Process memory map:
55d388ebb000-55d3891db000 r-xp 00000000 ca:01 4623622 /opt/ruby-2.5.1/bin/ruby
55d3893db000-55d3893e0000 r--p 00320000 ca:01 4623622 /opt/ruby-2.5.1/bin/ruby
55d3893e0000-55d3893e1000 rw-p 00325000 ca:01 4623622 /opt/ruby-2.5.1/bin/ruby
55d3893e1000-55d3893f2000 rw-p 00000000 00:00 0
55d38b066000-55d38bdf9000 rw-p 00000000 00:00 0 [heap]
55d38bdf9000-55d38d1a9000 rw-p 00000000 00:00 0 [heap]
55d38d1a9000-55d3a1258000 rw-p 00000000 00:00 0 [heap]
7f1bcc000000-7f1bcc021000 rw-p 00000000 00:00 0
7f1bcc021000-7f1bd0000000 ---p 00000000 00:00 0
7f1bd0e68000-7f1bd1031000 r--s 00000000 ca:01 13016
/lib/x86_64-linux-gnu/libc-2.23.so
....

Related

*** glibc detected *** /usr/sbin/apache2: free(): invalid pointer

I have a problem in apache2 when I restart Apache, the CPU freezes and log become huge every time someone visit pages.
My Debian version is wheezy 7.1.
What it seems to be the problem?
This is my config :
Apache 2
Server version: Apache/2.2.22 (Debian) Server built: Dec 23 2014
22:48:29 Server's Module Magic Number: 20051115:30
Server loaded: APR 1.4.6, APR-Util 1.4.1
Compiled using: APR 1.4.6, APR-Util 1.4.1
Architecture: 64-bit
Server MPM: Prefork
threaded: no
forked: yes (variable process count)
Server compiled with
-D APACHE_MPM_DIR="server/mpm/prefork"
-D APR_HAS_SENDFILE
-D APR_HAS_MMAP
-D APR_HAVE_IPV6 (IPv4-mapped addresses enabled)
-D APR_USE_SYSVSEM_SERIALIZE
-D APR_USE_PTHREAD_SERIALIZE
-D APR_HAS_OTHER_CHILD
-D AP_HAVE_RELIABLE_PIPED_LOGS
-D DYNAMIC_MODULE_LIMIT=128
-D HTTPD_ROOT="/etc/apache2"
-D SUEXEC_BIN="/usr/lib/apache2/suexec"
-D DEFAULT_PIDLOG="/var/run/apache2.pid"
-D DEFAULT_SCOREBOARD="logs/apache_runtime_status"
-D DEFAULT_LOCKFILE="/var/run/apache2/accept.lock"
-D DEFAULT_ERRORLOG="logs/error_log"
-D AP_TYPES_CONFIG_FILE="mime.types"
-D SERVER_CONFIG_FILE="apache2.conf"
PHP5 Config
PHP 5.6.6-1~dotdeb.1 (cli) (built: Feb 20 2015 19:57:36)
Copyright (c) 1997-2015 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2015 Zend Technologies with Zend
OPcache v7.0.4-dev, Copyright (c) 1999-2015, by Zend Technologies
Here is the log
*** glibc detected *** /usr/sbin/apache2: free(): invalid pointer: 0x00007f14c85feaf8 ***
======= Backtrace: =========
/lib/x86_64-linux-gnu/libc.so.6(+0x75be6)[0x7f14e42c3be6]
/lib/x86_64-linux-gnu/libc.so.6(cfree+0x6c)[0x7f14e42c898c]
/usr/lib/apache2/modules/libphp5.so(php_module_shutdown+0x2b)[0x7f14e0f1b81b]
/usr/lib/apache2/modules/libphp5.so(php_module_shutdown_wrapper+0x9)[0x7f14e0f1b8d9]
/usr/lib/apache2/modules/libphp5.so(+0x44d551)[0x7f14e1023551]
/usr/lib/libapr-1.so.0(apr_pool_destroy+0x7e)[0x7f14e480f99e]
/usr/sbin/apache2(+0x5bece)[0x7f14e5105ece]
/usr/sbin/apache2(+0x5c33e)[0x7f14e510633e]
/usr/sbin/apache2(+0x5c942)[0x7f14e5106942]
/usr/sbin/apache2(ap_mpm_run+0x9d6)[0x7f14e51074a6]
/usr/sbin/apache2(main+0xc26)[0x7f14e50db8e6]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xfd)[0x7f14e426cead]
/usr/sbin/apache2(+0x31981)[0x7f14e50db981]
======= Memory map: ========
7f14c8491000-7f14d0491000 rw-s 00000000 00:04 2397454 /dev/zero (deleted)
7f14d0491000-7f14d0492000 ---p 00000000 00:00 0
7f14d0492000-7f14d0c92000 rw-p 00000000 00:00 0
7f14d8000000-7f14d8021000 rw-p 00000000 00:00 0
7f14d8021000-7f14dc000000 ---p 00000000 00:00 0
7f14dc62e000-7f14dc632000 r-xp 00000000 08:01 4070055 /usr/lib/apache2/modules/mod_status.so
7f14dc632000-7f14dc832000 ---p 00004000 08:01 4070055 /usr/lib/apache2/modules/mod_status.so
7f14dc832000-7f14dc833000 r--p 00004000 08:01 4070055 /usr/lib/apache2/modules/mod_status.so
7f14dc833000-7f14dc834000 rw-p 00005000 08:01 4070055 /usr/lib/apache2/modules/mod_status.so
7f14dc834000-7f14dc837000 r-xp 00000000 08:01 4070024 /usr/lib/apache2/modules/mod_setenvif.so
7f14dc837000-7f14dca36000 ---p 00003000 08:01 4070024 /usr/lib/apache2/modules/mod_setenvif.so
7f14dca36000-7f14dca37000 r--p 00002000 08:01 4070024 /usr/lib/apache2/modules/mod_setenvif.so
7f14dca37000-7f14dca38000 rw-p 00003000 08:01 4070024 /usr/lib/apache2/modules/mod_setenvif.so
7f14dca38000-7f14dca4b000 rw-p 00000000 00:00 0
7f14dca4b000-7f14dca56000 r-xp 00000000 08:01 1969681 /lib/x86_64-linux-gnu/libnss_files-2.13.so
7f14dca56000-7f14dcc55000 ---p 0000b000 08:01 1969681 /lib/x86_64-linux-gnu/libnss_files-2.13.so
7f14dcc55000-7f14dcc56000 r--p 0000a000 08:01 1969681 /lib/x86_64-linux-gnu/libnss_files-2.13.so
7f14dcc56000-7f14dcc57000 rw-p 0000b000 08:01 1969681 /lib/x86_64-linux-gnu/libnss_files-2.13.so
7f14dcc57000-7f14dcc61000 r-xp 00000000 08:01 1969691 /lib/x86_64-linux-gnu/libnss_nis-2.13.so
7f14dcc61000-7f14dce60000 ---p 0000a000 08:01 1969691 /lib/x86_64-linux-gnu/libnss_nis-2.13.so
7f14dce60000-7f14dce61000 r--p 00009000 08:01 1969691 /lib/x86_64-linux-gnu/libnss_nis-2.13.so
7f14dce61000-7f14dce62000 rw-p 0000a000 08:01 1969691 /lib/x86_64-linux-gnu/libnss_nis-2.13.so
7f14dce62000-7f14dce69000 r-xp 00000000 08:01 1969695 /lib/x86_64-linux-gnu/libnss_compat-2.13.so
7f14dce69000-7f14dd068000 ---p 00007000 08:01 1969695 /lib/x86_64-linux-gnu/libnss_compat-2.13.so
7f14dd068000-7f14dd069000 r--p 00006000 08:01 1969695 /lib/x86_64-linux-gnu/libnss_compat-2.13.so
7f14dd069000-7f14dd06a000 rw-p 00007000 08:01 1969695 /lib/x86_64-linux-gnu/libnss_compat-2.13.so
7f14dd24b000-7f14dd25a000 r-xp 00000000 08:01 4070047 /usr/lib/apache2/modules/mod_rewrite.so
7f14dd25a000-7f14dd459000 ---p 0000f000 08:01 4070047 /usr/lib/apache2/modules/mod_rewrite.so
7f14dd459000-7f14dd45a000 r--p 0000e000 08:01 4070047 /usr/lib/apache2/modules/mod_rewrite.so
7f14dd45a000-7f14dd45b000 rw-p 0000f000 08:01 4070047 /usr/lib/apache2/modules/mod_rewrite.so
7f14dd45b000-7f14dd45e000 r-xp 00000000 08:01 4070011 /usr/lib/apache2/modules/mod_reqtimeout.so
7f14dd45e000-7f14dd65d000 ---p 00003000 08:01 4070011 /usr/lib/apache2/modules/mod_reqtimeout.so
7f14dd65d000-7f14dd65e000 r--p 00002000 08:01 4070011 /usr/lib/apache2/modules/mod_reqtimeout.so
7f14dd65e000-7f14dd65f000 rw-p 00003000 08:01 4070011 /usr/lib/apache2/modules/mod_reqtimeout.so
7f14dd65f000-7f14dd666000 r-xp 00000000 08:01 4070053 /usr/lib/apache2/modules/mod_proxy_http.so
7f14dd666000-7f14dd866000 ---p 00007000 08:01 4070053 /usr/lib/apache2/modules/mod_proxy_http.so
7f14dd866000-7f14dd867000 r--p 00007000 08:01 4070053 /usr/lib/apache2/modules/mod_proxy_http.so
7f14dd867000-7f14dd868000 rw-p 00008000 08:01 4070053 /usr/lib/apache2/modules/mod_proxy_http.so
7f14dd868000-7f14dd87c000 r-xp 00000000 08:01 4070012 /usr/lib/apache2/modules/mod_proxy.so
7f14dd87c000-7f14dda7b000 ---p 00014000 08:01 4070012 /usr/lib/apache2/modules/mod_proxy.so
7f14dda7b000-7f14dda7c000 r--p 00013000 08:01 4070012 /usr/lib/apache2/modules/mod_proxy.so
7f14dda7c000-7f14dda7d000 rw-p 00014000 08:01 4070012 /usr/lib/apache2/modules/mod_proxy.so
7f14dda7d000-7f14dda90000 r-xp 00000000 08:01 1969699 /lib/x86_64-linux-gnu/libresolv-2.13.so
7f14dda90000-7f14ddc8f000 ---p 00013000 08:01 1969699 /lib/x86_64-linux-gnu/libresolv-2.13.so
7f14ddc8f000-7f14ddc90000 r--p 00012000 08:01 1969699 /lib/x86_64-linux-gnu/libresolv-2.13.so
7f14ddc90000-7f14ddc91000 rw-p 00013000 08:01 1969699 /lib/x86_64-linux-gnu/libresolv-2.13.so
7f14ddc91000-7f14ddc93000 rw-p 00000000 00:00 0
7f14ddc93000-7f14ddc96000 r-xp 00000000 08:01 1966561 /lib/x86_64-linux-gnu/libkeyutils.so.1.4
7f14ddc96000-7f14dde95000 ---p 00003000 08:01 1966561 /lib/x86_64-linux-gnu/libkeyutils.so.1.4
7f14dde95000-7f14dde96000 r--p 00002000 08:01 1966561 /lib/x86_64-linux-gnu/libkeyutils.so.1.4
7f14dde96000-7f14dde97000 rw-p 00003000 08:01 1966561 /lib/x86_64-linux-gnu/libkeyutils.so.1.4
7f14dde97000-7f14dde9f000 r-xp 00000000 08:01 3805273 /usr/lib/x86_64-linux-gnu/libkrb5support.so.0.1
7f14dde9f000-7f14de09e000 ---p 00008000 08:01 3805273 /usr/lib/x86_64-linux-gnu/libkrb5support.so.0.1
7f14de09e000-7f14de09f000 r--p 00007000 08:01 3805273 /usr/lib/x86_64-linux-gnu/libkrb5support.so.0.1
7f14de09f000-7f14de0a0000 rw-p 00008000 08:01 3805273 /usr/lib/x86_64-linux-gnu/libkrb5support.so.0.1
7f14de0a0000-7f14de0c2000 r-xp 00000000 08:01 1966120 /lib/x86_64-linux-gnu/liblzma.so.5.0.0
7f14de0c2000-7f14de2c1000 ---p 00022000 08:01 1966120 /lib/x86_64-linux-gnu/liblzma.so.5.0.0
7f14de2c1000-7f14de2c2000 r--p 00021000 08:01 1966120 /lib/x86_64-linux-gnu/liblzma.so.5.0.0
7f14de2c2000-7f14de2c3000 rw-p 00022000 08:01 1966120 /lib/x86_64-linux-gnu/liblzma.so.5.0.0
.......
7f14e50a8000-7f14e50a9000 rw-p 00020000 08:01 1969698 /lib/x86_64-linux-gnu/ld-2.13.so
7f14e50a9000-7f14e50aa000 rw-p 00000000 00:00 0
7f14e50aa000-7f14e511c000 r-xp 00000000 08:01 4069997 /usr/lib/apache2/mpm-prefork/apache2
7f14e531b000-7f14e531d000 r--p 00071000 08:01 4069997 /usr/lib/apache2/mpm-prefork/apache2
7f14e531d000-7f14e5321000 rw-p 00073000 08:01 4069997 /usr/lib/apache2/mpm-prefork/apache2
7f14e5321000-7f14e5325000 rw-p 00000000 00:00 0
7f14e5345000-7f14e5366000 rw-p 00000000 00:00 0 [heap]
7f14e5366000-7f14e580b000 rw-p 00000000 00:00 0 [heap]
7ffffaa31000-7ffffaa52000 rw-p 00000000 00:00 0 [stack]
7ffffab5e000-7ffffab5f000 r-xp 00000000 00:00 0 [vdso]
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0 [vsyscall]
[Thu Jul 30 11:44:56 2015] [notice] child pid 8372 exit signal Aborted (6)
7f14e531d000-7f14e5321000 rw-p 00073000 08:01 4069997 /usr/lib/apache2/mpm-prefork/apache2
7f14e5321000-7f14e5325000 rw-p 00000000 00:00 0
7f14e5345000-7f14e5366000 rw-p 00000000 00:00 0 [heap]
7f14e5366000-7f14e580b000 rw-p 00000000 00:00 0 [heap]
7ffffaa31000-7ffffaa52000 rw-p 00000000 00:00 0 [stack]
7ffffab5e000-7ffffab5f000 r-xp 00000000 00:00 0 [vdso]
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0 [vsyscall]
[Thu Jul 30 11:44:56 2015] [notice] child pid 8372 exit signal Aborted (6)
Issue fixed
I use to load two times Zend Opcache.
Thank you for fixing my grammar and syntax mistakes.

stack smash error occured in using a staic library

i developed a static library, and a test application to call its
functions.
Now, when i am executing the test application, it was able to get in to
the function and calculate the required values, but when the return is
called it is giving stack smash error
./test_app
USB Handle opened SUCCESSFULLY
*** stack smashing detected ***: /home/avinay/Documents/iProbe/Experiments/iProbe_linux_lib/test_app terminated
======= Backtrace: =========
/lib/x86_64-linux-gnu/libc.so.6(__fortify_fail+0x37)[0x7ffff7b25807]
/lib/x86_64-linux-gnu/libc.so.6(__fortify_fail+0x0)[0x7ffff7b257d0]
/home/avinay/Documents/iProbe/Experiments/iProbe_linux_lib/test_app[0x4008ec]
/home/avinay/Documents/iProbe/Experiments/iProbe_linux_lib/test_app[0x4006ed]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xed)[0x7ffff7a3c76d]
/home/avinay/Documents/iProbe/Experiments/iProbe_linux_lib/test_app[0x400619]
======= Memory map: ========
00400000-00402000 r-xp 00000000 08:08 1186 /home/avinay/Documents/iProbe/Experiments/iProbe_linux_lib/test_app
00601000-00602000 r--p 00001000 08:08 1186 /home/avinay/Documents/iProbe/Experiments/iProbe_linux_lib/test_app
00602000-00603000 rw-p 00002000 08:08 1186 /home/avinay/Documents/iProbe/Experiments/iProbe_linux_lib/test_app
00603000-00624000 rw-p 00000000 00:00 0 [heap]
7ffff7805000-7ffff781a000 r-xp 00000000 08:05 658720 /lib/x86_64-linux-gnu/libgcc_s.so.1
7ffff781a000-7ffff7a19000 ---p 00015000 08:05 658720 /lib/x86_64-linux-gnu/libgcc_s.so.1
7ffff7a19000-7ffff7a1a000 r--p 00014000 08:05 658720 /lib/x86_64-linux-gnu/libgcc_s.so.1
7ffff7a1a000-7ffff7a1b000 rw-p 00015000 08:05 658720 /lib/x86_64-linux-gnu/libgcc_s.so.1
7ffff7a1b000-7ffff7bd0000 r-xp 00000000 08:05 658699 /lib/x86_64-linux-gnu/libc-2.15.so
7ffff7bd0000-7ffff7dcf000 ---p 001b5000 08:05 658699 /lib/x86_64-linux-gnu/libc-2.15.so
7ffff7dcf000-7ffff7dd3000 r--p 001b4000 08:05 658699 /lib/x86_64-linux-gnu/libc-2.15.so
7ffff7dd3000-7ffff7dd5000 rw-p 001b8000 08:05 658699 /lib/x86_64-linux-gnu/libc-2.15.so
7ffff7dd5000-7ffff7dda000 rw-p 00000000 00:00 0
7ffff7dda000-7ffff7dfc000 r-xp 00000000 08:05 658679 /lib/x86_64-linux-gnu/ld-2.15.so
7ffff7fdd000-7ffff7fe0000 rw-p 00000000 00:00 0
7ffff7ff6000-7ffff7ffb000 rw-p 00000000 00:00 0
7ffff7ffb000-7ffff7ffc000 r-xp 00000000 00:00 0 [vdso]
7ffff7ffc000-7ffff7ffd000 r--p 00022000 08:05 658679 /lib/x86_64-linux-gnu/ld-2.15.so
7ffff7ffd000-7ffff7fff000 rw-p 00023000 08:05 658679 /lib/x86_64-linux-gnu/ld-2.15.so
7ffffffde000-7ffffffff000 rw-p 00000000 00:00 0 [stack]
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0 [vsyscall]
Here is the test application
#include <stdio.h>
#include "leapfrog.h"
void main()
{
unsigned int mid=0x0;
USB_Init();
mid = Read_MID();
printf("\n mid = 0x%x\n",mid);
USB_Deinit();
return;
}
The above was the test application and it was referencing this function in the library
uint16 Read_MID(void)
{
int8 buf[8]={0};
uint16 mid;
//Read Vendor id
buf[0] = 0xFE;
msp_write(0x41,buf,1);
msp_read(0x41,buf,2);
mid = buf[0];
mid <<= 8;
mid |= buf[1];
return mid;
}
till the "mid" calculation i could get the correct values. it is reaching till the end while debugging with insight debugger. just after "}" in the console i see the stack smash error.
what might be the cause of the stack smash.
Thank you for time and patience.
I resolved it by adding more array space.
int8 buf[8]={0};
i made it as
int8 buf[10]={0};

How to interpret memory map dump output?

my question is not relative to the error itself (I know what is the reason for it).
I would instead like to know how to read this dump (meaning of the fields, flags and so on), where it is produced (glibc, or gcc libraries) and how I can infer what's wrong from it at a higher level (e.g. some tool that might find this output useful).
*** glibc detected *** python: double free or corruption (fasttop): 0x0000000006c4eb90 ***
======= Backtrace: =========
/lib/x86_64-linux-gnu/libc.so.6(+0x7eb96)[0x7f6c3a0a1b96]
/usr/lib/nvidia-current-updates/tls/libnvidia-tls.so.304.88(+0x1cc1)[0x7f6c2e544cc1]
======= Memory map: ========
00400000-00401000 r-xp 00000000 08:07 2238049 /build/bin/python
00600000-00601000 r--p 00000000 08:07 2238049 /build/bin/python
00601000-00602000 rw-p 00001000 08:07 2238049 /build/bin/python
00954000-07625000 rw-p 00000000 00:00 0 [heap]
40c14000-40c92000 rw-p 00000000 00:00 0
7f6c04000000-7f6c041bc000 rw-p 00000000 00:00 0
7f6c041bc000-7f6c08000000 ---p 00000000 00:00 0
7f6c08000000-7f6c081bc000 rw-p 00000000 00:00 0
7f6c081bc000-7f6c0c000000 ---p 00000000 00:00 0
7f6c0c000000-7f6c0c1bc000 rw-p 00000000 00:00 0
7f6c0c1bc000-7f6c10000000 ---p 00000000 00:00 0
7f6c14000000-7f6c14021000 rw-p 00000000 00:00 0
7f6c14021000-7f6c18000000 ---p 00000000 00:00 0
7f6c1ab5a000-7f6c1ab5b000 ---p 00000000 00:00 0
7f6c1ab5b000-7f6c1af5b000 rwxp 00000000 00:00 0
7f6c1af5b000-7f6c1af5c000 ---p 00000000 00:00 0
7f6c1af5c000-7f6c1b35c000 rwxp 00000000 00:00 0
7f6c1b35c000-7f6c1b35d000 ---p 00000000 00:00 0
7f6c1b35d000-7f6c1b75d000 rwxp 00000000 00:00 0
7f6c1b75d000-7f6c1b767000 r-xp 00000000 08:05 1314563 /lib/x86_64-linux-gnu/libnss_nis-2.15.so
7f6c1b767000-7f6c1b967000 ---p 0000a000 08:05 1314563 /lib/x86_64-linux-gnu/libnss_nis-2.15.so
7f6c1b967000-7f6c1b968000 r--p 0000a000 08:05 1314563 /lib/x86_64-linux-gnu/libnss_nis-2.15.so
7f6c1b968000-7f6c1b969000 rw-p 0000b000 08:05 1314563 /lib/x86_64-linux-gnu/libnss_nis-2.15.so
7f6c1b969000-7f6c1b980000 r-xp 00000000 08:05 1314576 /lib/x86_64-linux-gnu/libnsl-2.15.so
The man page for proc has the answer. The memory map output format is given in the entry for /proc/[pid]/maps.
The short summary is going across the columns it is: memory range, permissions, offset, device (major:minor), inode, and pathname.

Build gcc-4.0.4 on Ubuntu 10.10 32bit. buffer overflow detected

When i build gcc-4.0.4 (on Ubuntu 10.10), there is a problem:
arm-linux-ar rc ./libgcc.a libgcc/./_udivsi3.o libgcc/./_divsi3.o
libgcc/./_umodsi3.o libgcc/./_modsi3.o libgcc/./_dvmd_lnx.o
libgcc/./_muldi3.o libgcc/./_negdi2.o libgcc/./_lshrdi3.o
libgcc/./_ashldi3.o libgcc/./_ashrdi3.o libgcc/./_cmpdi2.o
libgcc/./_ucmpdi2.o libgcc/./_floatdidf.o libgcc/./_floatdisf.o
libgcc/./_fixunsdfsi.o libgcc/./_fixunssfsi.o libgcc/./_fixunsdfdi.o
libgcc/./_fixdfdi.o libgcc/./_fixunssfdi.o libgcc/./_fixsfdi.o
libgcc/./_fixxfdi.o libgcc/./_fixunsxfdi.o libgcc/./_floatdixf.o
libgcc/./_fixunsxfsi.o libgcc/./_fixtfdi.o libgcc/./_fixunstfdi.o
libgcc/./_floatditf.o libgcc/./_clear_cache.o
libgcc/./_enable_execute_stack.o libgcc/./trampoline.o
libgcc/./_main.o libgcc/./_absvsi2.o libgcc/./_absvdi2.o
libgcc/./_addvsi3.o libgcc/./_addvdi3.o libgcc/./_subvsi3.o
libgcc/./_subvdi3.o libgcc/./_mulvsi3.o libgcc/./_mulvdi3.o
libgcc/./_negvsi2.o libgcc/./_negvdi2.o libgcc/./_ctors.o
libgcc/./_ffssi2.o libgcc/./_ffsdi2.o libgcc/./_clz.o
libgcc/./_clzsi2.o libgcc/./_clzdi2.o libgcc/./_ctzsi2.o
libgcc/./_ctzdi2.o libgcc/./_popcount_tab.o libgcc/./_popcountsi2.o
libgcc/./_popcountdi2.o libgcc/./_paritysi2.o libgcc/./_paritydi2.o
libgcc/./_powisf2.o libgcc/./_powidf2.o libgcc/./_powixf2.o
libgcc/./_powitf2.o libgcc/./_mulsc3.o libgcc/./_muldc3.o
libgcc/./_mulxc3.o libgcc/./_multc3.o libgcc/./_divsc3.o
libgcc/./_divdc3.o libgcc/./_divxc3.o libgcc/./_divtc3.o
libgcc/./eprintf.o libgcc/./_gcc_bcmp.o libgcc/./_divdi3.o
libgcc/./_moddi3.o libgcc/./_udivdi3.o libgcc/./_umoddi3.o
libgcc/./_udiv_w_sdiv.o libgcc/./_udivmoddi4.o libgcc/./unwind-dw2.o
libgcc/./unwind-dw2-fde-glibc.o libgcc/./unwind-sjlj.o
libgcc/./gthr-gnat.o libgcc/./unwind-c.o
* buffer overflow detected *: arm-linux-ar terminated
======= Backtrace: ========= /lib/libc.so.6(__fortify_fail+0x50)[0x8f1890]
/lib/libc.so.6(+0xe478a)[0x8f078a] /lib/libc.so.6(+0xe3ec8)[0x8efec8]
/lib/libc.so.6(_IO_default_xsputn+0x9e)[0x8765ee]
/lib/libc.so.6(_IO_padn+0xd8)[0x869f78]
/lib/libc.so.6(_IO_vfprintf+0x2b79)[0x84bd89]
/lib/libc.so.6(__vsprintf_chk+0xad)[0x8eff7d]
/lib/libc.so.6(__sprintf_chk+0x2d)[0x8efebd] arm-linux-ar[0x8050c05]
arm-linux-ar[0x804ed7e] arm-linux-ar[0x805168c]
arm-linux-ar[0x8055178] arm-linux-ar[0x804b7d2]
arm-linux-ar[0x804c494]
/lib/libc.so.6(__libc_start_main+0xe7)[0x822ce7]
arm-linux-ar[0x80496e1]
======= Memory map: ======== 003e4000-00400000 r-xp 00000000 08:01 131636 /lib/ld-2.12.1.so 00400000-00401000 r--p 0001b000 08:01
131636 /lib/ld-2.12.1.so 00401000-00402000 rw-p 0001c000 08:01
131636 /lib/ld-2.12.1.so 006b2000-006cc000 r-xp 00000000 08:01
131244 /lib/libgcc_s.so.1 006cc000-006cd000 r--p 00019000 08:01
131244 /lib/libgcc_s.so.1 006cd000-006ce000 rw-p 0001a000 08:01
131244 /lib/libgcc_s.so.1 0080c000-00963000 r-xp 00000000 08:01
132225 /lib/libc-2.12.1.so 00963000-00965000 r--p 00157000 08:01
132225 /lib/libc-2.12.1.so 00965000-00966000 rw-p 00159000 08:01
132225 /lib/libc-2.12.1.so 00966000-00969000 rw-p 00000000 00:00 0
00a42000-00a43000 r-xp 00000000 00:00 0 [vdso]
08048000-08097000 r-xp 00000000 08:01 427851
/home/zouhansi/armlinux/tools/bin/arm-linux-ar 08097000-08098000 r--p
0004e000 08:01 427851
/home/zouhansi/armlinux/tools/bin/arm-linux-ar 08098000-08099000 rw-p
0004f000 08:01 427851
/home/zouhansi/armlinux/tools/bin/arm-linux-ar 08099000-0809d000 rw-p
00000000 00:00 0 09354000-09558000 rw-p 00000000 00:00 0
[heap] b74c1000-b74c8000 r--s 00000000 08:01 661517
/usr/lib/gconv/gconv-modules.cache b74c8000-b765b000 r--p 002a3000
08:01 657761 /usr/lib/locale/locale-archive b765b000-b785b000 r--p
00000000 08:01 657761 /usr/lib/locale/locale-archive
b785b000-b785c000 rw-p 00000000 00:00 0 b785f000-b786b000 rw-p
00000000 00:00 0 bf839000-bf85c000 rw-p 00000000 00:00 0
[stack]
I find some solution from network to add "-D_FORTIFY_SOURCE=0" in
CFLAGS. I had edit Makefile like this: CFLAGS_FOR_BUILD = -g -O2
-D_FORTIFY_SOURCE=0
I make it again. But this problem is occured again.
Could you give some comments? Thanks a lot.
I had a similar problem building a GCC cross-compiler - it seems binutils is full of unsafe calls to sprintf().
A workaround which worked for me was to set:
export CFLAGS="-fno-stack-protector -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0"
These have to be set before running ../src/configure.
There seems to be a binutils patch here: http://www.redhat.com/archives/fedora-extras-commits/2009-November/msg06284.html but it didn't apply cleanly to the source I was using, so I stuck with CFLAGS hack.
After I cross-compiled GCC with the latest version of binutils, it worked and I didn't get the buffer overflow anymore.
This was the line I used, after I installed the latest binutils:
../gcc-4.5.1/configure --target=arm-linux --prefix=/.../toolchain/bin/binutils --disable-nls --disable-multilib --disable-shared --disable-decimal-float --disable--threads --disable-libmudflap --disable-libssp --disable-libgomp --enable-languages=c --with-system-zlib --with-newlib

*** buffer overflow detected ***

my program was compiled properly with "make" on Ubuntu 11.04, but when i run it, it give error.
is this a bug on Ubuntu? or this is difference in variable types between compilers?
pls help me
*** buffer overflow detected ***: src/trilearn_player terminated
======= Backtrace: =========
/lib/i386-linux-gnu/libc.so.6(__fortify_fail+0x50)[0x9cd0a0]
/lib/i386-linux-gnu/libc.so.6(+0xe5f7a)[0x9cbf7a]
/lib/i386-linux-gnu/libc.so.6(__strcpy_chk+0x3f)[0x9cb30f]
src/trilearn_player[0x804dd24]
src/trilearn_player[0x808b2d5]
src/trilearn_player[0x80920cf]
/lib/i386-linux-gnu/libc.so.6(__libc_start_main+0xe7)[0x8fce37]
src/trilearn_player[0x804a421]
======= Memory map: ========
00139000-0015d000 r-xp 00000000 08:0b 6060 /lib/i386-linux-gnu/libm-2.13.so
0015d000-0015e000 r--p 00023000 08:0b 6060 /lib/i386-linux-gnu/libm-2.13.so
0015e000-0015f000 rw-p 00024000 08:0b 6060 /lib/i386-linux-gnu/libm-2.13.so
001b4000-001b5000 r-xp 00000000 00:00 0 [vdso]
00488000-0049d000 r-xp 00000000 08:0b 6831 /lib/i386-linux-gnu/libpthread-2.13.so
0049d000-0049e000 r--p 00015000 08:0b 6831 /lib/i386-linux-gnu/libpthread-2.13.so
0049e000-0049f000 rw-p 00016000 08:0b 6831 /lib/i386-linux-gnu/libpthread-2.13.so
0049f000-004a1000 rw-p 00000000 00:00 0
00558000-00637000 r-xp 00000000 08:0b 134145
00637000-0063b000 r--p 000de000 08:0b 134145 /usr/lib/i386-linux-gnu/libstdc++.so.6.0.14
0063b000-0063c000 rw-p 000e2000 08:0b 134145 /usr/lib/i386-linux-gnu/libstdc++.so.6.0.14
0063c000-00643000 rw-p 00000000 00:00 0
0087b000-00885000 r-xp 00000000 08:0b 6826 /lib/i386-linux-gnu/libnss_files-2.13.so
00885000-00886000 r--p 00009000 08:0b 6826 /lib/i386-linux-gnu/libnss_files-2.13.so
00886000-00887000 rw-p 0000a000 08:0b 6826 /lib/i386-linux-gnu/libnss_files-2.13.so
008e6000-00a42000 r-xp 00000000 08:0b 5792 /lib/i386-linux-gnu/libc-2.13.so
/lib/i386-linux-gnu/libc.so.6(__strcpy_chk+0x3f)[0x9cb30f]
Looks like you copy too many chars to the destination.

Resources