LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* Obtaining a list of memory address ranges allocated to processes
@ 2006-12-06 23:56 Stephen Torri
  2006-12-07  0:36 ` Remi Colinet
  2006-12-07  7:10 ` Arjan van de Ven
  0 siblings, 2 replies; 3+ messages in thread
From: Stephen Torri @ 2006-12-06 23:56 UTC (permalink / raw)
  To: Linux Kernel

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Obtaining a list of memory address ranges allocated to processes
  2006-12-06 23:56 Obtaining a list of memory address ranges allocated to processes Stephen Torri
@ 2006-12-07  0:36 ` Remi Colinet
  2006-12-07  7:10 ` Arjan van de Ven
  1 sibling, 0 replies; 3+ messages in thread
From: Remi Colinet @ 2006-12-07  0:36 UTC (permalink / raw)
  To: Stephen Torri; +Cc: Linux Kernel

Selon Stephen Torri <storri@torri.org>:

> 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.

> 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.

> 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.

> Stephen
>

Remi

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



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Obtaining a list of memory address ranges allocated to processes
  2006-12-06 23:56 Obtaining a list of memory address ranges allocated to processes Stephen Torri
  2006-12-07  0:36 ` Remi Colinet
@ 2006-12-07  7:10 ` Arjan van de Ven
  1 sibling, 0 replies; 3+ messages in thread
From: Arjan van de Ven @ 2006-12-07  7:10 UTC (permalink / raw)
  To: Stephen Torri; +Cc: Linux Kernel

On Wed, 2006-12-06 at 17:56 -0600, Stephen Torri wrote:
> 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


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2006-12-07  7:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-12-06 23:56 Obtaining a list of memory address ranges allocated to processes Stephen Torri
2006-12-07  0:36 ` Remi Colinet
2006-12-07  7:10 ` Arjan van de Ven

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).