I've found that some programs print Memory Maps and other diagnostic information to the terminal when they crash, even when I redirect file descriptors 1 and 2 (standard out and error, respectively) to files. How can I redirect the diagnostics to a file?
For example, this c++ program:
#include <iostream>
#include <assert.h>
#include <string>
int main(){
using namespace std;
cout<<"foo"<<endl;
cerr<<"bar"<<endl;
string s;
s = "asdf";
delete &s;
}
After compilation, it can be run, redirecting "all" output (g++ foo.cpp && ./a.out > /dev/null 2>&1) but still print the following to the terminal:
======*** Error in `./a.out': double free or corruption (out): 0x00007ffe389313d0 ***
======= Backtrace: =========
/usr/lib/libc.so.6(+0x722ab)[0x7fc7c053f2ab]
/usr/lib/libc.so.6(+0x7890e)[0x7fc7c054590e]
/usr/lib/libc.so.6(+0x7911e)[0x7fc7c054611e]
./a.out[0x400b41]
/usr/lib/libc.so.6(__libc_start_main+0xf1)[0x7fc7c04ed511]
./a.out[0x4009fa]
= Memory map: ========
00400000-00401000 r-xp 00000000 00:27 531373 /tmp/a.out
00601000-00602000 r--p 00001000 00:27 531373 /tmp/a.out
00602000-00603000 rw-p 00002000 00:27 531373 /tmp/a.out
01f1d000-01f4f000 rw-p 00000000 00:00 0 [heap]
7fc7bc000000-7fc7bc021000 rw-p 00000000 00:00 0
7fc7bc021000-7fc7c0000000 ---p 00000000 00:00 0
7fc7c04cd000-7fc7c0668000 r-xp 00000000 08:09 142916 /usr/lib/libc-2.25.so
7fc7c0668000-7fc7c0867000 ---p 0019b000 08:09 142916 /usr/lib/libc-2.25.so
7fc7c0867000-7fc7c086b000 r--p 0019a000 08:09 142916 /usr/lib/libc-2.25.so
7fc7c086b000-7fc7c086d000 rw-p 0019e000 08:09 142916 /usr/lib/libc-2.25.so
7fc7c086d000-7fc7c0871000 rw-p 00000000 00:00 0
7fc7c0871000-7fc7c0887000 r-xp 00000000 08:09 144514 /usr/lib/libgcc_s.so.1
7fc7c0887000-7fc7c0a86000 ---p 00016000 08:09 144514 /usr/lib/libgcc_s.so.1
7fc7c0a86000-7fc7c0a87000 r--p 00015000 08:09 144514 /usr/lib/libgcc_s.so.1
7fc7c0a87000-7fc7c0a88000 rw-p 00016000 08:09 144514 /usr/lib/libgcc_s.so.1
7fc7c0a88000-7fc7c0b9a000 r-xp 00000000 08:09 131998 /usr/lib/libm-2.25.so
7fc7c0b9a000-7fc7c0d99000 ---p 00112000 08:09 131998 /usr/lib/libm-2.25.so
7fc7c0d99000-7fc7c0d9a000 r--p 00111000 08:09 131998 /usr/lib/libm-2.25.so
7fc7c0d9a000-7fc7c0d9b000 rw-p 00112000 08:09 131998 /usr/lib/libm-2.25.so
7fc7c0d9b000-7fc7c0f13000 r-xp 00000000 08:09 141919 /usr/lib/libstdc++.so.6.0.22
7fc7c0f13000-7fc7c1113000 ---p 00178000 08:09 141919 /usr/lib/libstdc++.so.6.0.22
7fc7c1113000-7fc7c111d000 r--p 00178000 08:09 141919 /usr/lib/libstdc++.so.6.0.22
7fc7c111d000-7fc7c111f000 rw-p 00182000 08:09 141919 /usr/lib/libstdc++.so.6.0.22
7fc7c111f000-7fc7c1123000 rw-p 00000000 00:00 0
7fc7c1123000-7fc7c1146000 r-xp 00000000 08:09 142957 /usr/lib/ld-2.25.so
7fc7c1318000-7fc7c131e000 rw-p 00000000 00:00 0
7fc7c1344000-7fc7c1345000 rw-p 00000000 00:00 0
7fc7c1345000-7fc7c1346000 r--p 00022000 08:09 142957 /usr/lib/ld-2.25.so
7fc7c1346000-7fc7c1347000 rw-p 00023000 08:09 142957 /usr/lib/ld-2.25.so
7fc7c1347000-7fc7c1348000 rw-p 00000000 00:00 0
7ffe38911000-7ffe38932000 rw-p 00000000 00:00 0 [stack]
7ffe38945000-7ffe38947000 r--p 00000000 00:00 0 [vvar]
7ffe38947000-7ffe38949000 r-xp 00000000 00:00 0 [vdso]
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0 [vsyscall]
Aborted (core dumped)
To redirrect output from /dev/tty to a file you can do:
script -q -c 'g++ foo.cpp && ./a.out' /dev/null > /tmp/bla.txt
Taken from here - How to redirect a program that writes to tty?
Related
With the code that follows, I want to create a map of type std::map. By using a debugger, I got that the exception was raised by stl_pair.h at line 368 (pair& operator=(typename conditional<__and_<is_copy_assignable<_T1>, is_copy_assignable<_T2>>::value, const pair&, const __wrap_nonesuch&>::type __p)), which was invoked by the map scanning of cur (*(cur + 1) = *cur;) in the leaf.h insert function of stxxl. I provide the code I used in the following source code:
#include <stxxl/map>
#include <fstream>
#include <string>
#include <cstdint>
typedef uint_fast64_t LONG_NUMERIC;
std::string random_string( size_t length )
{
auto randchar = []() -> char
{
const char charset[] =
"0123456789"
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
"abcdefghijklmnopqrstuvwxyz";
const size_t max_index = (sizeof(charset) - 1);
return charset[ rand() % max_index ];
};
std::string str(length,0);
std::generate_n( str.begin(), length, randchar );
return str;
}
struct CompareGreater22
{
bool operator () (const std::string& a, const std::string& b) const
{ return a > b; }
static std::string max_value()
{ return std::string(); }
};
int main(int argc, char** argv) {
stxxl::config * cfg = stxxl::config::get_instance();
stxxl::disk_config disk1("/mnt/DEC4763AC47614CD/stxxl.tmp", 100 * 1024 * 1024, "syscall unlink");
disk1.direct = stxxl::disk_config::DIRECT_ON; // force O_DIRECT
// add disk to config
cfg->add_disk(disk1);
// template parameter <KeyType, DataType, CompareType, RawNodeSize, RawLeafSize, PDAllocStrategy (optional)>
typedef stxxl::map<std::string, LONG_NUMERIC, CompareGreater22, DATA_NODE_BLOCK_SIZE, DATA_LEAF_BLOCK_SIZE> map_type3;
// Constructor map(node_cache_size_in_bytes, leaf_cache_size_in_bytes)
map_type3 t((map_type3::node_block_type::raw_size)*3, (map_type3::leaf_block_type::raw_size)*3);
//vertex_conversion_map_type t{(vertex_conversion_map_type::node_block_type::raw_size)*3, (vertex_conversion_map_type::leaf_block_type::raw_size)*3};
for (LONG_NUMERIC i = 0; i< 2000; i++) {
t.insert(std::make_pair(random_string(10), i));
}
}
I also provide the dump result:
[STXXL-MSG] STXXL v1.4.99 (prerelease/Debug) (git 0a80a8c55993948f7f2f6c2c5a51ff45b403045b) + gnu parallel(20170406)
[STXXL-MSG] Disk '/mnt/DEC4763AC47614CD/stxxl.tmp' is allocated, space: 100 MiB, I/O implementation: syscall direct=on queue=0 devid=0 unlink_on_open
*** Error in `/anon/software/path': free(): invalid pointer: 0x000055c0cd7688d0 ***
======= Backtrace: =========
/lib/x86_64-linux-gnu/libc.so.6(+0x7908b)[0x7fd69ff1108b]
/lib/x86_64-linux-gnu/libc.so.6(+0x82c3a)[0x7fd69ff1ac3a]
/lib/x86_64-linux-gnu/libc.so.6(cfree+0x4c)[0x7fd69ff1ed2c]
/usr/lib/x86_64-linux-gnu/libstdc++.so.6(_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE9_M_assignERKS4_+0xaf)[0x7fd6a0ad0fcf]
/usr/lib/x86_64-linux-gnu/libstdc++.so.6(_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEaSERKS4_+0x9)[0x7fd6a0ad1339]
/anon/software/path(+0x19bfb)[0x55c0cc841bfb]
/anon/software/path(+0x15699)[0x55c0cc83d699]
/anon/software/path(+0x10dba)[0x55c0cc838dba]
/anon/software/path(+0xf6fc)[0x55c0cc8376fc]
/anon/software/path(+0xd46d)[0x55c0cc83546d]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf1)[0x7fd69feb83f1]
/anon/software/path(+0xd01a)[0x55c0cc83501a]
======= Memory map: ========
55c0cc828000-55c0cc9d8000 r-xp 00000000 08:02 509986 /anon/software/path
55c0ccbd7000-55c0ccbdc000 r--p 001af000 08:02 509986 /anon/software/path
55c0ccbdc000-55c0ccbdd000 rw-p 001b4000 08:02 509986 /anon/software/path
55c0ccbdd000-55c0ccbdf000 rw-p 00000000 00:00 0
55c0cd74a000-55c0cd78c000 rw-p 00000000 00:00 0 [heap]
7fd698000000-7fd698021000 rw-p 00000000 00:00 0
7fd698021000-7fd69c000000 ---p 00000000 00:00 0
7fd69f697000-7fd69f698000 ---p 00000000 00:00 0
7fd69f698000-7fd69fe98000 rw-p 00000000 00:00 0
7fd69fe98000-7fd6a0056000 r-xp 00000000 103:05 795936 /lib/x86_64-linux-gnu/libc-2.24.so
7fd6a0056000-7fd6a0255000 ---p 001be000 103:05 795936 /lib/x86_64-linux-gnu/libc-2.24.so
7fd6a0255000-7fd6a0259000 r--p 001bd000 103:05 795936 /lib/x86_64-linux-gnu/libc-2.24.so
7fd6a0259000-7fd6a025b000 rw-p 001c1000 103:05 795936 /lib/x86_64-linux-gnu/libc-2.24.so
7fd6a025b000-7fd6a025f000 rw-p 00000000 00:00 0
7fd6a025f000-7fd6a0275000 r-xp 00000000 103:05 791133 /lib/x86_64-linux-gnu/libgcc_s.so.1
7fd6a0275000-7fd6a0474000 ---p 00016000 103:05 791133 /lib/x86_64-linux-gnu/libgcc_s.so.1
7fd6a0474000-7fd6a0475000 r--p 00015000 103:05 791133 /lib/x86_64-linux-gnu/libgcc_s.so.1
7fd6a0475000-7fd6a0476000 rw-p 00016000 103:05 791133 /lib/x86_64-linux-gnu/libgcc_s.so.1
7fd6a0476000-7fd6a04a3000 r-xp 00000000 103:05 4335250 /usr/lib/x86_64-linux-gnu/libgomp.so.1.0.0
7fd6a04a3000-7fd6a06a2000 ---p 0002d000 103:05 4335250 /usr/lib/x86_64-linux-gnu/libgomp.so.1.0.0
7fd6a06a2000-7fd6a06a3000 r--p 0002c000 103:05 4335250 /usr/lib/x86_64-linux-gnu/libgomp.so.1.0.0
7fd6a06a3000-7fd6a06a4000 rw-p 0002d000 103:05 4335250 /usr/lib/x86_64-linux-gnu/libgomp.so.1.0.0
7fd6a06a4000-7fd6a07ac000 r-xp 00000000 103:05 795940 /lib/x86_64-linux-gnu/libm-2.24.so
7fd6a07ac000-7fd6a09ab000 ---p 00108000 103:05 795940 /lib/x86_64-linux-gnu/libm-2.24.so
7fd6a09ab000-7fd6a09ac000 r--p 00107000 103:05 795940 /lib/x86_64-linux-gnu/libm-2.24.so
7fd6a09ac000-7fd6a09ad000 rw-p 00108000 103:05 795940 /lib/x86_64-linux-gnu/libm-2.24.so
7fd6a09ad000-7fd6a0b26000 r-xp 00000000 103:05 4335931 /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.22
7fd6a0b26000-7fd6a0d25000 ---p 00179000 103:05 4335931 /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.22
7fd6a0d25000-7fd6a0d2f000 r--p 00178000 103:05 4335931 /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.22
7fd6a0d2f000-7fd6a0d31000 rw-p 00182000 103:05 4335931 /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.22
7fd6a0d31000-7fd6a0d35000 rw-p 00000000 00:00 0
7fd6a0d35000-7fd6a0d4d000 r-xp 00000000 103:05 795951 /lib/x86_64-linux-gnu/libpthread-2.24.so
7fd6a0d4d000-7fd6a0f4d000 ---p 00018000 103:05 795951 /lib/x86_64-linux-gnu/libpthread-2.24.so
7fd6a0f4d000-7fd6a0f4e000 r--p 00018000 103:05 795951 /lib/x86_64-linux-gnu/libpthread-2.24.so
7fd6a0f4e000-7fd6a0f4f000 rw-p 00019000 103:05 795951 /lib/x86_64-linux-gnu/libpthread-2.24.so
7fd6a0f4f000-7fd6a0f53000 rw-p 00000000 00:00 0
7fd6a0f53000-7fd6a0f79000 r-xp 00000000 103:05 795932 /lib/x86_64-linux-gnu/ld-2.24.so
7fd6a114b000-7fd6a1150000 rw-p 00000000 00:00 0
7fd6a1174000-7fd6a1178000 rw-p 00000000 00:00 0
7fd6a1178000-7fd6a1179000 r--p 00025000 103:05 795932 /lib/x86_64-linux-gnu/ld-2.24.so
7fd6a1179000-7fd6a117a000 rw-p 00026000 103:05 795932 /lib/x86_64-linux-gnu/ld-2.24.so
7fd6a117a000-7fd6a117b000 rw-p 00000000 00:00 0
7fff9e622000-7fff9e643000 rw-p 00000000 00:00 0 [stack]
7fff9e714000-7fff9e716000 r--p 00000000 00:00 0 [vvar]
7fff9e716000-7fff9e718000 r-xp 00000000 00:00 0 [vdso]
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0 [vsyscall]
TL;DR: Your KeyType is a std::string and consequently non-pod. The STXXL does not support this.
See section Parameterizing STXXL Containers in the official STXXL FAQ.
See How to use std::string as key in stxxl::map here, where somebody had the same issue. Answers below that question describe possible workarounds.
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.
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};
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.
the following gnokii command fails:
echo "this is a test message" | sudo gnokii --phone ATblue --sendsms +<number> -r
i can recieve sms and get network info using the current config file.
the above command results in this:
GNOKII Version 0.6.28
*** glibc detected *** gnokii: free(): invalid next size (fast): 0x09a7b540 ***
======= Backtrace: =========
/lib/tls/i686/cmov/libc.so.6(+0x6b591)[0x4ed591]
/lib/tls/i686/cmov/libc.so.6(+0x6cde8)[0x4eede8]
/lib/tls/i686/cmov/libc.so.6(cfree+0x6d)[0x4f1ecd]
/usr/lib/libgnokii.so.5(gn_char_def_alphabet+0xb3)[0x3d2a43]
gnokii[0x805bb78]
gnokii[0x804b948]
gnokii[0x804b230]
gnokii[0x804bd5f]
/lib/tls/i686/cmov/libc.so.6(__libc_start_main+0xe6)[0x498bd6]
gnokii[0x804ab61]
======= Memory map: ========
00110000-00116000 r-xp 00000000 08:01 315119 /lib/libusb-0.1.so.4.4.4
00116000-00117000 r--p 00005000 08:01 315119 /lib/libusb-0.1.so.4.4.4
00117000-00119000 rw-p 00006000 08:01 315119 /lib/libusb-0.1.so.4.4.4
00119000-0011b000 r-xp 00000000 08:01 260201 /lib/tls/i686/cmov/libdl-2.11.1.so
0011b000-0011c000 r--p 00001000 08:01 260201 /lib/tls/i686/cmov/libdl-2.11.1.so
0011c000-0011d000 rw-p 00002000 08:01 260201 /lib/tls/i686/cmov/libdl-2.11.1.so
0011d000-00132000 r-xp 00000000 08:01 260266 /lib/tls/i686/cmov/libpthread-2.11.1.so
00132000-00133000 r--p 00014000 08:01 260266 /lib/tls/i686/cmov/libpthread-2.11.1.so
00133000-00134000 rw-p 00015000 08:01 260266 /lib/tls/i686/cmov/libpthread-2.11.1.so
00134000-00136000 rw-p 00000000 00:00 0
00136000-0014e000 r-xp 00000000 08:01 268696 /usr/lib/libxcb.so.1.1.0
0014e000-0014f000 r--p 00017000 08:01 268696 /usr/lib/libxcb.so.1.1.0
0014f000-00150000 rw-p 00018000 08:01 268696 /usr/lib/libxcb.so.1.1.0
00150000-00152000 r-xp 00000000 08:01 267689 /usr/lib/libXau.so.6.0.0
00152000-00153000 r--p 00001000 08:01 267689 /usr/lib/libXau.so.6.0.0
00153000-00154000 rw-p 00002000 08:01 267689 /usr/lib/libXau.so.6.0.0
00154000-00158000 r-xp 00000000 08:01 267700 /usr/lib/libXdmcp.so.6.0.0
00158000-00159000 r--p 00003000 08:01 267700 /usr/lib/libXdmcp.so.6.0.0
00159000-0015a000 rw-p 00004000 08:01 267700 /usr/lib/libXdmcp.so.6.0.0
0020a000-0024c000 r-xp 00000000 08:01 268247 /usr/lib/libical.so.0.44.0
0024c000-00254000 r--p 00042000 08:01 268247 /usr/lib/libical.so.0.44.0
00254000-00255000 rw-p 0004a000 08:01 268247 /usr/lib/libical.so.0.44.0
00340000-0035d000 r-xp 00000000 08:01 260186 /lib/libgcc_s.so.1
0035d000-0035e000 r--p 0001c000 08:01 260186 /lib/libgcc_s.so.1
0035e000-0035f000 rw-p 0001d000 08:01 260186 /lib/libgcc_s.so.1
003a9000-00431000 r-xp 00000000 08:01 302338 /usr/lib/libgnokii.so.5.0.0
00431000-00432000 ---p 00088000 08:01 302338 /usr/lib/libgnokii.so.5.0.0
00432000-00435000 r--p 00088000 08:01 302338 /usr/lib/libgnokii.so.5.0.0
00435000-00437000 rw-p 0008b000 08:01 302338 /usr/lib/libgnokii.so.5.0.0
00437000-0047c000 rw-p 00000000 00:00 0
00481000-00482000 r-xp 00000000 00:00 0 [vdso]
00482000-005d5000 r-xp 00000000 08:01 260156 /lib/tls/i686/cmov/libc-2.11.1.so
005d5000-005d6000 ---p 00153000 08:01 260156 /lib/tls/i686/cmov/libc-2.11.1.so
005d6000-005d8000 r--p 00153000 08:01 260156 /lib/tls/i686/cmov/libc-2.11.1.so
005d8000-005d9000 rw-p 00155000 08:01 260156 /lib/tls/i686/cmov/libc-2.11.1.so
005d9000-005dc000 rw-p 00000000 00:00 0
006ca000-006d3000 r-xp 00000000 08:01 260246 /lib/libpcsclite.so.1.0.0
006d3000-006d4000 r--p 00009000 08:01 260246 /lib/libpcsclite.so.1.0.0
006d4000-006d5000 rw-p 0000a000 08:01 260246 /lib/libpcsclite.so.1.0.0
007f6000-00809000 r-xp 00000000 08:01 267800 /usr/lib/libbluetooth.so.3.5.0
00809000-0080a000 r--p 00012000 08:01 267800 /usr/lib/libbluetooth.so.3.5.0
0080a000-0080b000 rw-p 00013000 08:01 267800 /usr/lib/libbluetooth.so.3.5.0
008b5000-009ce000 r-xp 00000000 08:01 267685 /usr/lib/libX11.so.6.3.0
009ce000-009cf000 r--p 00118000 08:01 267685 /usr/lib/libX11.so.6.3.0
009cf000-009d1000 rw-p 00119000 08:01 267685 /usr/lib/libX11.so.6.3.0
009d1000-009d2000 rw-p 00000000 00:00 0
00dc3000-00dd2000 r-xp 00000000 08:01 267720 /usr/lib/libXpm.so.4.11.0
00dd2000-00dd3000 r--p 0000e000 08:01 267720 /usr/lib/libXpm.so.4.11.0
00dd3000-00dd4000 rw-p 0000f000 08:01 267720 /usr/lib/libXpm.so.4.11.0
00fcd000-00fe8000 r-xp 00000000 08:01 264975 /lib/ld-2.11.1.so
00fe8000-00fe9000 r--p 0001a000 08:01 264975 /lib/ld-2.11.1.so
00fe9000-00fea000 rw-p 0001b000 08:01 264975 /lib/ld-2.11.1.so
08048000-08067000 r-xp 00000000 08:01 302405 /usr/bin/gnokii
08067000-08068000 r--p 0001e000 08:01 302405 /usr/bin/gnokii
08068000-08069000 rw-p 0001f000 08:01 302405 /usr/bin/gnokii
08069000-0806c000 rw-p 00000000 00:00 0
09a79000-09add000 rw-p 00000000 00:00 0 [heap]
b7500000-b7521000 rw-p 00000000 00:00 0
b7521000-b7600000 ---p 00000000 00:00 0
b7662000-b7669000 r--s 00000000 08:01 280697 /usr/lib/gconv/gconv-modules.cache
b76a9000-b76ed000 rw-p 00000000 00:00 0
b76ed000-b772c000 r--p 00000000 08:01 272703 /usr/lib/locale/en_IN/LC_CTYPE
b772c000-b784a000 r--p 00000000 08:01 272702 /usr/lib/locale/en_IN/LC_COLLATE
b784a000-b784e000 rw-p 00000000 00:00 0
b7860000-b7861000 r--p 00000000 08:01 266931 /usr/lib/locale/en_IN/LC_NUMERIC
b7861000-b7862000 r--p 00000000 08:01 266932 /usr/lib/locale/en_IN/LC_TIME
b7862000-b7863000 r--p 00000000 08:01 266933 /usr/lib/locale/en_IN/LC_MONETARY
b7863000-b7864000 r--p 00000000 08:01 272751 /usr/lib/locale/en_IN/LC_MESSAGES/SYS_LC_MESSAGES
b7864000-b7865000 r--p 00000000 08:01 272709 /usr/lib/locale/en_IN/LC_PAPER
b7865000-b7866000 r--p 00000000 08:01 272668 /usr/lib/locale/en_IN/LC_NAME
b7866000-b7867000 r--p 00000000 08:01 272493 /usr/lib/locale/en_IN/LC_ADDRESS
b7867000-b7868000 r--p 00000000 08:01 272502 /usr/lib/locale/en_IN/LC_TELEPHONE
b7868000-b7869000 r--p 00000000 08:01 272705 /usr/lib/locale/en_IN/LC_MEASUREMENT
b7869000-b786a000 r--p 00000000 08:01 266934 /usr/lib/locale/en_IN/LC_IDENTIFICATION
b786a000-b786c000 rw-p 00000000 00:00 0
bfcec000-bfd6f000 rw-p 00000000 00:00 0 [stack]
Aborted
It was fixed in gnokii 0.6.29