public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Idea to create a elf executable from running program [process2executable]
@ 2006-03-18 22:22 vamsi krishna
  2006-03-19  9:30 ` Arjan van de Ven
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: vamsi krishna @ 2006-03-18 22:22 UTC (permalink / raw)
  To: linux-kernel

Hello All,

I have been working on an idea of creating an executable from a
running process image.

MOTIVATION:
Process migration among the nodes in distributed computing,
checkpointing process state.

BASIS:

The basis of my idea would be update the existing executable with
extra PHDRS (Program Headers) with type PT_LOAD and each of these
headers corresponding the vaddr mapping from /proc/<pid>/maps.

I have done some basic study of kernels loders code in
'fs/binfmt_elf.c' especially code in 'load_elf_binary' function, the
following is my understanding.
<------------------------------------------>
bss=0;
brk=0;
foreach (phdr in elf_header){

   if(phdr->type == PT_LOAD){
        if( phdr->filesize < phdr->memsize){
           /* Segment with .bss, so update brk and bss*/
        }
       else {
          /* Just map it*/
       }
    }
/*Update brk bss*/
}
<------------------------------------>

from the above the kernel is updating brk, thus creating the start of
sbrk(0) only when it sees a  PT_LOAD segment with filesize<memsize. So
if I create a elf executable with all PT_LOAD segments with out any
segments with filesize < memsize. The kernel will set brk base i.e
sbrk(0) to the value phdr->vaddr+phdr->memsize of the last PT_LOAD
segment its mapping? so do I need to reoder my PT_LOAD segments so
that the heap goes as the last PT_LOAD segment?

Is there any way we can tell the elf loader to force the vaddr for
sbrk(0) i.e brk base ?

Let me know your suggestion on this idea?

Really appreciate your valuable comments.

Sincerely,
Vamsi

[PS: I dont know if some one has already implemented this idea??]

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

end of thread, other threads:[~2006-03-22  5:18 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-03-18 22:22 Idea to create a elf executable from running program [process2executable] vamsi krishna
2006-03-19  9:30 ` Arjan van de Ven
2006-03-19 19:41   ` John Reiser
2006-03-20  8:33 ` Cedric Le Goater
2006-03-20  8:41   ` vamsi krishna
2006-03-21  8:43 ` Roberto Nibali
2006-03-22  5:18 ` Andrew Shewmaker

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox