Skip to contentSkip to conversation

user-mode stack size & location

DISCUSSION Clemens Kolbitsch 2 participants 3 messages Aug 28, 2007

lore
Share & tools
lore
#0 lore raw

hi!
i'm working on a new concept of i386 memory management and have to change quite a bit of the linux mm. could someone please point out, where the location & size of the USER-MODE stack is set for a new program (i.e. after calling sys_execve...) exactly?

I know that all settings are simply copied from the parent-process when invoking fork and how the stack grows (through page-faults).

However,

1.) is

mm->start_stack

set inside the

search_binary_handler / the individual fs-handlers?

i see that the aout-, elf-, etc. handlers all set this variable --> is this the only location where it can be set?

2.) when looking at /proc/PID/maps, i see that the stack always ends at different locations (obviously close to TASK_SIZE). thus the sizes seem to vary. where are they set / where are the infos written to the vma's / the PGD?

any help would be greatly appreciated!!
greets,
clemens

#1 lore raw
Quoted 9 lines · On Tue, 28 Aug 2007 18:25:01 +0200 Clemens Kolbitsch <[email protected]> wrote:

i see that the aout-, elf-, etc. handlers all set this variable --> is this the only location where it can be set?

2.) when looking at /proc/PID/maps, i see that the stack always ends at different locations (obviously close to TASK_SIZE). thus the sizes seem to vary. where are they set / where are the infos written to the vma's / the PGD?

any help would be greatly appreciated!!

\

hi,

if you look where arch_align_stack() gets called.. that's where you want to look. arch_align_stack() gets invoked in code that selects userspace stack pointers....

Greetings,
Arjan van de Ven

#2 lore raw
Quoted 9 lines

hi,

if you look where arch_align_stack() gets called.. that's where you want to look. arch_align_stack() gets invoked in code that selects userspace stack pointers....

Greetings,
Arjan van de Ven

thanks a lot!!