Re: where does the stack of a process start

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



What I have understood is, the stack segment and the heap segment in the virtual address space of an application is allocated by the kernel and the starting address of these segments vary for every execution of a program ( on the premise that the program is not changed). Unlike the program's .text and .data sections where the starting address is defined by the linker script and will be same for a program unless one changes the program contents.

Even I am interested in knowing the exact reason/algorithm adopted by the kernel.

Regards,
Prabhu


On Sun, Oct 17, 2010 at 10:46 PM, Parmenides <mobile.parmenides@xxxxxxxxx> wrote:
Hi,

   According to ULK 3rd edition, the stack of a process start from
0xc0000000 and grow towards lower address. It is not the case in the
following session:

root [ ~ ]# ulimit -s unlimited
root [ ~ ]# cat /proc/self/maps
08048000-0804c000 r-xp 00000000 03:01 272003     /bin/cat
0804c000-0804d000 rw-p 00003000 03:01 272003     /bin/cat
0804d000-0806e000 rw-p 0804d000 00:00 0          [heap]
40000000-4001a000 r-xp 00000000 03:01 176003     /lib/ld-2.5.1.so
4001a000-4001b000 r--p 00019000 03:01 176003     /lib/ld-2.5.1.so
4001b000-4001c000 rw-p 0001a000 03:01 176003     /lib/ld-2.5.1.so
40025000-40026000 rw-p 40025000 00:00 0
40026000-4014b000 r-xp 00000000 03:01 176002     /lib/libc-2.5.1.so
4014b000-4014d000 r--p 00125000 03:01 176002     /lib/libc-2.5.1.so
4014d000-4014e000 rw-p 00127000 03:01 176002     /lib/libc-2.5.1.so
4014e000-40152000 rw-p 4014e000 00:00 0
bf9f8000-bfa0e000 rw-p bf9f8000 00:00 0          [stack]
ffffe000-fffff000 r-xp 00000000 00:00 0          [vdso]

It is obvious that the stack of cat's process start from 0xbfa0e000.
Is there any explanation about this situation?

p.s.
The version of the linux is 2.6.22.5.

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux