MEGDICHE Mohamed Fahmi

sh breaks down

Discussion created by MEGDICHE Mohamed Fahmi on Dec 15, 2009
Latest reply on Dec 16, 2009 by MEGDICHE Mohamed Fahmi

Hi,

I'm developing an application on an MCF54452 processor with an embedded linux port that uses busybox.

When executing my process I am getting this error message after some ENTER or ps or ls in shell and the system hangs up.

 

*** glibc detected *** -sh: free(): invalid pointer: 0x801d22b8 ***

======= Backtrace: =========

/lib/libc.so.6[0x8012fdac]

/lib/libc.so.6[0x80131252]

/lib/libc.so.6(cfree+0xa2)[0x801313a4]

-sh[0x8004eebc]

======= Memory map: ========

80000000-8007c000 r-xp 00000000 1f:0�

 

I remarked that when I declare a global buffer of more than 60KB the problem vanished !!!! Here is a trace of the shared memory buffers (allocated with shmget() and shmatt() ), you can see that the wrong pointer address is in the range of allocated buffers!!

Can anyone give me an explanation of that ? sh code space isn't protected from other processes ?

 

-----> with buffer

========> 232 - 0x801D4000

========> 231 - 0x801D8000

========> 250 - 0x801DC000

========> 230 - 0x801DE000

========> 229 - 0x801E0000

========> 242 - 0x801E2000

========> 228 - 0x801E4000

========> 245 - 0x801E6000

========> 247 - 0x801F4000

========> 224 - 0x801F6000

========> 223 - 0x801F8000

========> 251 - 0x801FA000

========> 79 - 0x801FC000

========> 78 - 0x801FE000

========> 77 - 0x80200000

 

----> Without buffer

========> 0xE8 - 0x801C6000

========> 0xE7 - 0x801CA000

========> 0xFA - 0x801CE000

========> 0xE6 - 0x801D0000

========> 0xE5 - 0x801D2000

========> 0xF2 - 0x801D4000

========> 0xE4 - 0x801D6000

========> 0xF5 - 0x801D8000

========> 0xF7 - 0x801E6000

========> 0xE0 - 0x801E8000

========> 0xDF - 0x801EA000

========> 0xFB - 0x801EC000

========> 0x4F - 0x801EE000

========> 0x4E - 0x801F0000

========> 0x4D - 0x801F2000

Outcomes