From: frank on
I've started another discussion about how to read directories, which I
need to put a lot of time and study into to turn into robust code, but I
wanted to talk about this other thing that I've heard about but never
caused myself, until tonight.

It is stack smashing, and I managed to get my *nix implementation to
shut down the program. What is this:

> /home/dan/Music/carl/O Brother, Where Art Thou - I Am A Man Of Constant Sorrow.mp3 has 3046925 bytes
> /home/dan/Music/carl/Cake - Walk on By.mp3 has 3627387 bytes
> /home/dan/Music/carl/Chicago - Does Anybody Really Know What Time It Is.mp3 has 3216606 bytes
> /home/dan/Music/carl/Micheal Jackson - Rock With You.mp3 has 3537152 bytes
> /home/dan/Music/carl/Fleetwood Mac - Songbird.mp3 has 3280522 bytes
> /home/dan/Music/carl/Nina Simone - Summertime.mp3 has 5445736 bytes
> *** stack smashing detected ***: ./out terminated
> ======= Backtrace: =========
> /lib/tls/i686/cmov/libc.so.6(__fortify_fail+0x48)[0xb7ee2da8]
> /lib/tls/i686/cmov/libc.so.6(__fortify_fail+0x0)[0xb7ee2d60]
> ./out[0x8048a1a]
> ./out[0x8048a40]
> /lib/tls/i686/cmov/libc.so.6(__libc_start_main+0xe5)[0xb7dfb775]
> ./out[0x8048651]
> ======= Memory map: ========
> 08048000-08049000 r-xp 00000000 08:04 213111 /home/dan/source/out
> 08049000-0804a000 r--p 00000000 08:04 213111 /home/dan/source/out
> 0804a000-0804b000 rw-p 00001000 08:04 213111 /home/dan/source/out
> 08fdd000-08ffe000 rw-p 08fdd000 00:00 0 [heap]
> b7dc7000-b7dd4000 r-xp 00000000 08:01 2601 /lib/libgcc_s.so.1 /home/dan/Music/carl/O Brother, Where Art Thou - I Am A Man Of Constant Sorrow.mp3 has 3046925 bytes
/home/dan/Music/carl/Cake - Walk on By.mp3 has 3627387 bytes
/home/dan/Music/carl/Chicago - Does Anybody Really Know What Time It
Is.mp3 has 3216606 bytes
/home/dan/Music/carl/Micheal Jackson - Rock With You.mp3 has 3537152 bytes
/home/dan/Music/carl/Fleetwood Mac - Songbird.mp3 has 3280522 bytes
/home/dan/Music/carl/Nina Simone - Summertime.mp3 has 5445736 bytes
*** stack smashing detected ***: ./out terminated
======= Backtrace: =========
/lib/tls/i686/cmov/libc.so.6(__fortify_fail+0x48)[0xb7ee2da8]
/lib/tls/i686/cmov/libc.so.6(__fortify_fail+0x0)[0xb7ee2d60]
../out[0x8048a1a]
../out[0x8048a40]
/lib/tls/i686/cmov/libc.so.6(__libc_start_main+0xe5)[0xb7dfb775]
../out[0x8048651]
======= Memory map: ========
08048000-08049000 r-xp 00000000 08:04 213111 /home/dan/source/out
08049000-0804a000 r--p 00000000 08:04 213111 /home/dan/source/out
0804a000-0804b000 rw-p 00001000 08:04 213111 /home/dan/source/out
08fdd000-08ffe000 rw-p 08fdd000 00:00 0 [heap]
b7dc7000-b7dd4000 r-xp 00000000 08:01 2601 /lib/libgcc_s.so.1
b7dd4000-b7dd5000 r--p 0000c000 08:01 2601 /lib/libgcc_s.so.1
b7dd5000-b7dd6000 rw-p 0000d000 08:01 2601 /lib/libgcc_s.so.1
b7de4000-b7de5000 rw-p b7de4000 00:00 0
b7de5000-b7f41000 r-xp 00000000 08:01 2661
/lib/tls/i686/cmov/libc-2.9.so
b7f41000-b7f42000 ---p 0015c000 08:01 2661
/lib/tls/i686/cmov/libc-2.9.so
b7f42000-b7f44000 r--p 0015c000 08:01 2661
/lib/tls/i686/cmov/libc-2.9.so
b7f44000-b7f45000 rw-p 0015e000 08:01 2661
/lib/tls/i686/cmov/libc-2.9.so
b7f45000-b7f48000 rw-p b7f45000 00:00 0
b7f55000-b7f58000 rw-p b7f55000 00:00 0
b7f58000-b7f59000 r-xp b7f58000 00:00 0 [vdso]
b7f59000-b7f75000 r-xp 00000000 08:01 8001 /lib/ld-2.9.so
b7f75000-b7f76000 r--p 0001b000 08:01 8001 /lib/ld-2.9.so
b7f76000-b7f77000 rw-p 0001c000 08:01 8001 /lib/ld-2.9.so
bf9e5000-bf9fa000 rw-p bffeb000 00:00 0 [stack]
Aborted
dan(a)dan-desktop:~/source$

> b7dd4000-b7dd5000 r--p 0000c000 08:01 2601 /lib/libgcc_s.so.1
> b7dd5000-b7dd6000 rw-p 0000d000 08:01 2601 /lib/libgcc_s.so.1
> b7de4000-b7de5000 rw-p b7de4000 00:00 0
> b7de5000-b7f41000 r-xp 00000000 08:01 2661 /lib/tls/i686/cmov/libc-2.9.so
> b7f41000-b7f42000 ---p 0015c000 08:01 2661 /lib/tls/i686/cmov/libc-2.9.so
> b7f42000-b7f44000 r--p 0015c000 08:01 2661 /lib/tls/i686/cmov/libc-2.9.so
> b7f44000-b7f45000 rw-p 0015e000 08:01 2661 /lib/tls/i686/cmov/libc-2.9.so
> b7f45000-b7f48000 rw-p b7f45000 00:00 0
> b7f55000-b7f58000 rw-p b7f55000 00:00 0
> b7f58000-b7f59000 r-xp b7f58000 00:00 0 [vdso]
> b7f59000-b7f75000 r-xp 00000000 08:01 8001 /lib/ld-2.9.so
> b7f75000-b7f76000 r--p 0001b000 08:01 8001 /lib/ld-2.9.so
> b7f76000-b7f77000 rw-p 0001c000 08:01 8001 /lib/ld-2.9.so
> bf9e5000-bf9fa000 rw-p bffeb000 00:00 0 [stack]
> Aborted
> dan(a)dan-desktop:~/source$
--
frank
From: Moi on
On Fri, 15 Jan 2010 03:23:31 -0700, frank wrote:

> I've started another discussion about how to read directories, which I
> need to put a lot of time and study into to turn into robust code, but I
> wanted to talk about this other thing that I've heard about but never
> caused myself, until tonight.
>
> It is stack smashing, and I managed to get my *nix implementation to
> shut down the program. What is this:

It is a stack trace and a dump of the current memory mappings on the moment
your program was aborted.
This happens when one of the libc functions detects that the stack has been
corrupted,and decides that it cannot continue.
(probably your program did a buffer overrun or something)

HTH,
AvK