J
JPerelli
Hello
I'd like to make a program for a 32bit architecture, but I have some
problem that I can't figure how to resolve
The program compiles and works great under 64 bits, but in 32 bits
throws this runtime error:
*** glibc detected *** ./7sd32: malloc(): memory corruption:
0x09cb6160 ***
======= Backtrace: =========
/lib32/libc.so.6[0xf7ea1ea6]
/lib32/libc.so.6(__libc_malloc+0x95)[0xf7ea35f5]
../7sd32[0x804b3be]
../7sd32[0x804b7aa]
../7sd32[0x804b820]
../7sd32[0x804c387]
/lib32/libc.so.6(__libc_start_main+0xe5)[0xf7e45775]
../7sd32[0x80493a1]
======= Memory map: ========
08048000-0804e000 r-xp 00000000 08:01
6448809 /home/jperelli/Escritorio/7sd/
julian/daemon/7sd32
0804e000-0804f000 r--p 00005000 08:01
6448809 /home/jperelli/Escritorio/7sd/
julian/daemon/7sd32
0804f000-08050000 rw-p 00006000 08:01
6448809 /home/jperelli/Escritorio/7sd/
julian/daemon/7sd32
09cb6000-09cd7000 rw-p 09cb6000 00:00
0 [heap]
f7500000-f7521000 rw-p f7500000 00:00 0
f7521000-f7600000 ---p f7521000 00:00 0
f762c000-f762d000 ---p f762c000 00:00 0
f762d000-f7e2f000 rw-p f762d000 00:00 0
f7e2f000-f7f8b000 r-xp 00000000 08:01
1073288 /lib32/libc-2.9.so
f7f8b000-f7f8c000 ---p 0015c000 08:01
1073288 /lib32/libc-2.9.so
f7f8c000-f7f8e000 r--p 0015c000 08:01
1073288 /lib32/libc-2.9.so
f7f8e000-f7f8f000 rw-p 0015e000 08:01
1073288 /lib32/libc-2.9.so
f7f8f000-f7f92000 rw-p f7f8f000 00:00 0
f7f92000-f7fa7000 r-xp 00000000 08:01
1073302 /lib32/libpthread-2.9.so
f7fa7000-f7fa8000 r--p 00014000 08:01
1073302 /lib32/libpthread-2.9.so
f7fa8000-f7fa9000 rw-p 00015000 08:01
1073302 /lib32/libpthread-2.9.so
f7fa9000-f7fab000 rw-p f7fa9000 00:00 0
f7fbc000-f7fc9000 r-xp 00000000 08:01
5333910 /usr/lib32/libgcc_s.so.1
f7fc9000-f7fca000 r--p 0000c000 08:01
5333910 /usr/lib32/libgcc_s.so.1
f7fca000-f7fcb000 rw-p 0000d000 08:01
5333910 /usr/lib32/libgcc_s.so.1
f7fcb000-f7fce000 rw-p f7fcb000 00:00 0
f7fce000-f7fcf000 r-xp f7fce000 00:00
0 [vdso]
f7fcf000-f7fee000 r-xp 00000000 08:01
1073285 /lib32/ld-2.9.so
f7fee000-f7fef000 r--p 0001e000 08:01
1073285 /lib32/ld-2.9.so
f7fef000-f7ff0000 rw-p 0001f000 08:01
1073285 /lib32/ld-2.9.so
ff8da000-ff8ef000 rw-p 7ffffffea000 00:00
0 [stack]
Cancelado
I googled a lot, but can't find anything that guides me...
also I make some debugging in gdb:
Program received signal SIGABRT, Aborted.
[Switching to Thread 0xf7d736c0 (LWP 20387)]
0xf7f14425 in __kernel_vsyscall ()
(gdb) bt
#0 0xf7f14425 in __kernel_vsyscall ()
#1 0xf7da09a0 in raise () from /lib32/libc.so.6
#2 0xf7da2368 in abort () from /lib32/libc.so.6
#3 0xf7ddee4d in ?? () from /lib32/libc.so.6
#4 0xf7de5204 in ?? () from /lib32/libc.so.6
#5 0xf7de81e6 in ?? () from /lib32/libc.so.6
#6 0xf7de95f5 in malloc () from /lib32/libc.so.6
#7 0x0804b3be in codificar_caracter (c=49 '1') at 7sdio.c:41
#8 0x0804b7aa in enviar_caracter (fd=5, status=-3987288, c=49 '1') at
7sdio.c:145
#9 0x0804b820 in enviar_cadena (fd=5, status=-3987288, str=0x8a8c0c8
"132132132132") at 7sdio.c:163
#10 0x0804c387 in main (argc=2, argv=0xffc32934) at 7sd.c:221
(gdb) frame 7
#7 0x0804b3be in codificar_caracter (c=49 '1') at 7sdio.c:41
41 binario = malloc(sizeof(int)*8); <----- call that causes error
(gdb) frame 6
#6 0xf7de95f5 in malloc () from /lib32/libc.so.6
so the program lines close to the error are this:
int *binario;
printf("size=%d\n", sizeof(int)*8);
binario = malloc(sizeof(int)*8);
it seems like an error (bug) from malloc, but i cant believe that,
it's nearly impossible...
someone knows what's hapenning here??
thank you in advance
Julian
I'd like to make a program for a 32bit architecture, but I have some
problem that I can't figure how to resolve
The program compiles and works great under 64 bits, but in 32 bits
throws this runtime error:
*** glibc detected *** ./7sd32: malloc(): memory corruption:
0x09cb6160 ***
======= Backtrace: =========
/lib32/libc.so.6[0xf7ea1ea6]
/lib32/libc.so.6(__libc_malloc+0x95)[0xf7ea35f5]
../7sd32[0x804b3be]
../7sd32[0x804b7aa]
../7sd32[0x804b820]
../7sd32[0x804c387]
/lib32/libc.so.6(__libc_start_main+0xe5)[0xf7e45775]
../7sd32[0x80493a1]
======= Memory map: ========
08048000-0804e000 r-xp 00000000 08:01
6448809 /home/jperelli/Escritorio/7sd/
julian/daemon/7sd32
0804e000-0804f000 r--p 00005000 08:01
6448809 /home/jperelli/Escritorio/7sd/
julian/daemon/7sd32
0804f000-08050000 rw-p 00006000 08:01
6448809 /home/jperelli/Escritorio/7sd/
julian/daemon/7sd32
09cb6000-09cd7000 rw-p 09cb6000 00:00
0 [heap]
f7500000-f7521000 rw-p f7500000 00:00 0
f7521000-f7600000 ---p f7521000 00:00 0
f762c000-f762d000 ---p f762c000 00:00 0
f762d000-f7e2f000 rw-p f762d000 00:00 0
f7e2f000-f7f8b000 r-xp 00000000 08:01
1073288 /lib32/libc-2.9.so
f7f8b000-f7f8c000 ---p 0015c000 08:01
1073288 /lib32/libc-2.9.so
f7f8c000-f7f8e000 r--p 0015c000 08:01
1073288 /lib32/libc-2.9.so
f7f8e000-f7f8f000 rw-p 0015e000 08:01
1073288 /lib32/libc-2.9.so
f7f8f000-f7f92000 rw-p f7f8f000 00:00 0
f7f92000-f7fa7000 r-xp 00000000 08:01
1073302 /lib32/libpthread-2.9.so
f7fa7000-f7fa8000 r--p 00014000 08:01
1073302 /lib32/libpthread-2.9.so
f7fa8000-f7fa9000 rw-p 00015000 08:01
1073302 /lib32/libpthread-2.9.so
f7fa9000-f7fab000 rw-p f7fa9000 00:00 0
f7fbc000-f7fc9000 r-xp 00000000 08:01
5333910 /usr/lib32/libgcc_s.so.1
f7fc9000-f7fca000 r--p 0000c000 08:01
5333910 /usr/lib32/libgcc_s.so.1
f7fca000-f7fcb000 rw-p 0000d000 08:01
5333910 /usr/lib32/libgcc_s.so.1
f7fcb000-f7fce000 rw-p f7fcb000 00:00 0
f7fce000-f7fcf000 r-xp f7fce000 00:00
0 [vdso]
f7fcf000-f7fee000 r-xp 00000000 08:01
1073285 /lib32/ld-2.9.so
f7fee000-f7fef000 r--p 0001e000 08:01
1073285 /lib32/ld-2.9.so
f7fef000-f7ff0000 rw-p 0001f000 08:01
1073285 /lib32/ld-2.9.so
ff8da000-ff8ef000 rw-p 7ffffffea000 00:00
0 [stack]
Cancelado
I googled a lot, but can't find anything that guides me...
also I make some debugging in gdb:
Program received signal SIGABRT, Aborted.
[Switching to Thread 0xf7d736c0 (LWP 20387)]
0xf7f14425 in __kernel_vsyscall ()
(gdb) bt
#0 0xf7f14425 in __kernel_vsyscall ()
#1 0xf7da09a0 in raise () from /lib32/libc.so.6
#2 0xf7da2368 in abort () from /lib32/libc.so.6
#3 0xf7ddee4d in ?? () from /lib32/libc.so.6
#4 0xf7de5204 in ?? () from /lib32/libc.so.6
#5 0xf7de81e6 in ?? () from /lib32/libc.so.6
#6 0xf7de95f5 in malloc () from /lib32/libc.so.6
#7 0x0804b3be in codificar_caracter (c=49 '1') at 7sdio.c:41
#8 0x0804b7aa in enviar_caracter (fd=5, status=-3987288, c=49 '1') at
7sdio.c:145
#9 0x0804b820 in enviar_cadena (fd=5, status=-3987288, str=0x8a8c0c8
"132132132132") at 7sdio.c:163
#10 0x0804c387 in main (argc=2, argv=0xffc32934) at 7sd.c:221
(gdb) frame 7
#7 0x0804b3be in codificar_caracter (c=49 '1') at 7sdio.c:41
41 binario = malloc(sizeof(int)*8); <----- call that causes error
(gdb) frame 6
#6 0xf7de95f5 in malloc () from /lib32/libc.so.6
so the program lines close to the error are this:
int *binario;
printf("size=%d\n", sizeof(int)*8);
binario = malloc(sizeof(int)*8);
it seems like an error (bug) from malloc, but i cant believe that,
it's nearly impossible...
someone knows what's hapenning here??
thank you in advance
Julian