Skip to contentSkip to conversation

Obtaining a list of memory address ranges allocated to processes

DISCUSSION Stephen Torri 3 participants 3 messages Dec 6, 2006 – Dec 7, 2006

lore
Share & tools
lore
#0 lore raw

I am trying to create a custom ELF and Windows PE loader for the purpose of security research. I am having a difficult time finding how to allocate memory for a binary at the desired address in memory (especially if its non-relocatable). I would like to see why I cannot get memory allocated at the exact address request in the binary headers. Is there a program or system call that allows me to see a list of memory address ranges allocated to the running processes on a system?

Stephen

#1 lore raw

Selon Stephen Torri <[email protected]>:

Quoted 4 lines

I am trying to create a custom ELF and Windows PE loader for the purpose of security research. I am having a difficult time finding how to allocate memory for a binary at the desired address in memory (especially if its non-relocatable).

Use mmap system call.
Anyway, the address is only going to be a hint.

Quoted 2 lines

I would like to see why I cannot
get memory allocated at the exact address request in the binary headers.

address should be page aligned.

Quoted 3 lines

Is there a program or system call that allows me to see a list of memory address ranges allocated to the running processes on a system?

pmap pid_of_your_program will give you the memory map.

Quoted 2 lines

Stephen

Remi

Quoted 6 lines

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

#2 lore raw
In reply to Stephen Torri
Quoted 7 lines · Stephen Torri

I am trying to create a custom ELF and Windows PE loader for the purpose of security research. I am having a difficult time finding how to allocate memory for a binary at the desired address in memory (especially if its non-relocatable). I would like to see why I cannot get memory allocated at the exact address request in the binary headers. Is there a program or system call that allows me to see a list of memory address ranges allocated to the running processes on a system?

Hi,

check the /proc/<pid>/maps and /proc/<pid>/smaps files... they have exactly what you need

Greetings,
Arjan van de Ven