i386: new stub strategy to avoid problems with early mmap layout
The stub occupies the same region that execve() would create for the original progam. The stub copies everything to a new area, erases the original region, replaces it with the de-compressed program, and erases the copy of itself via the escape hatch. The copy is inexpensive via mmap() of /proc/self/exe. modified: stub/src/i386-linux.elf-entry.S modified: stub/src/i386-linux.elf-fold.S modified: stub/src/i386-linux.elf-main.c modified: p_lx_elf.cpp modified: p_lx_elf.h modified: p_lx_interp.cpp modified: p_lx_interp.h modified: p_lx_sh.cpp modified: p_lx_sh.h modified: p_mach.cpp modified: p_mach.h modified: p_unix.cpp modified: p_unix.h modified: p_vmlinx.cpp plus .h, .map, .dump
This commit is contained in:
+2
-1
@@ -135,7 +135,7 @@ int PackLinuxElf32x86interp::pack2(OutputFile *fo, Filter &ft)
|
||||
#undef PAGE_MASK
|
||||
#define PAGE_MASK (~0u<<12)
|
||||
|
||||
void PackLinuxElf32x86interp::pack3(OutputFile *fo, Filter &/*ft*/)
|
||||
off_t PackLinuxElf32x86interp::pack3(OutputFile *fo, Filter &/*ft*/)
|
||||
{
|
||||
unsigned base = getbase(phdri, ehdri.e_phnum);
|
||||
unsigned sz = PAGE_MASK & (~PAGE_MASK + elfout.phdr[0].p_filesz);
|
||||
@@ -191,6 +191,7 @@ void PackLinuxElf32x86interp::pack3(OutputFile *fo, Filter &/*ft*/)
|
||||
else {
|
||||
updateLoader(fo);
|
||||
}
|
||||
return fo->getBytesWritten();
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user