0

when i run program 'A', heap and stack's virtual addresses are changed although i run the same program 'A'.

i know that stack, heap's virtual addresses are not defined in the executable object file(elf format). They are variable things. i can check it out by 'readelf -l' command.

but, Why does kernal have to change the address of the stack every time although same program is runned? here is reason why i asked like that.

I am making a simple process emulator. I'm trying to emulate a progam from raspbian(32bit) in the intel cpu environment(64bit).

So, I have to design 32 bit stack. but i don't know how i emulate stack system.

I mmaped ANONYMOUS page, then i have to use it as a stack to emulate a program. i have to imitate the way the program(32bit) use stack. But program's stack virtual address change at every single running time. I need a help.

Dusol
  • 47
  • 8

1 Answers1

0

It can be that operational system makes address space randomization in stack, heap to avoid security vulnerabilities. If a attacker knows always were to find this information for processes, it could be easier to harm the system.

dpetrini
  • 1,169
  • 1
  • 12
  • 25
  • can you recommend me how can i decide stack base address in emulator which emulate arm-cpu 32bit program? – Dusol Sep 26 '17 at 02:26
  • which emulator is this? some public available or developed by yourself? – dpetrini Sep 27 '17 at 13:21
  • hi! I'm a making simple emulator by myself. this program is single process emulator. – Dusol Sep 29 '17 at 05:22
  • you can use some random based formula each time you calculate the initial addresses (within proper bounds). Check this paper that has examples and research about it: https://web.stanford.edu/~blp/papers/asrandom.pdf – dpetrini Sep 29 '17 at 12:01