> In QEMU with -R <high>
> 
> $ qemu-arm -R $(( 0x10000000 )) ./brk
> mmap: 0x935000
> current brk: 0xffffffff
> 00000000-00008000 ---p 00000000 00:00 0
> 00008000-00009000 r-xp 00000000 08:09 1248935408          /brk
> 00009000-00010000 ---p 00000000 00:00 0
> 00010000-00011000 r--p 00000000 08:09 1248935408          /brk
> 00011000-00012000 rw-p 00001000 08:09 1248935408          /brk
> 00012000-00013000 ---p 00000000 00:00 0
> 00013000-00813000 rw-p 00000000 00:00 0

Would tell us a lot more if (a) you gave us the map before the strace call, 
and (b) the requested size wasn't the same as the default stack size.  
> 
> qemu's strace says:
> 15545 mmap2(NULL,4096,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANONYMOUS,-1,0)
> = 0x00834000 [...]
> 15545
> mmap2(0x00005000,65536,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANONYMOUS,0,0)
> = 0x00935000 [...]
> 15545 brk(NULL) = 0x00012000
> 15545 brk(0x00812000) = 0x00012000

This is your bug.  According to the trace above, the brk call fails, but 
returns success anyway.  A quick look at do_brk confirms this suspicion.

Paul

Reply via email to