This is my first time posting in the Linux Forums. I need a little guidance for a project I'm working on. Thank you in advance.

I'm running kernel 2.6.9 and I need to be able to map the segment containing .data and .bss of an ELF binary as a shared region. However, any attempts to do so have had adverse side-effects (results in a kernel panic).

Kernel panic - not syncing: No init found. Try passing init= option to kernel.

The loader ("fs/binfmt_elf.c") seems to find the segment in question by assuming it will be the last one in the image so I have the following code added before the mapping begins. The comment is in the original code as a reference to where I placed it.

/* Now we do a little grungy work by mmaping the ELF image into
the correct location in memory.
max_addr = 0;
for(i = 0, elf_ppnt = elf_phdata; i < loc->elf_ex.e_phnum; i++,
elf_ppnt++) {
if(elf_ppnt->p_type != PT_LOAD)
if(max_addr < elf_ppnt->p_vaddr)
max_addr = elf_ppnt->p_vaddr;

Then i replaced:



if(elf_ppnt->p_vaddr == max_addr)

Is what I am trying to do even possible and if so are there any suggestions on how to do it? What possible reasons might there be for the kernel panic?

Any help would be greatly appreciated.

Thank you again.