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:
John Reiser
2017-10-01 15:56:34 -07:00
parent 26be845563
commit 9e8de4abe5
30 changed files with 2943 additions and 3118 deletions
+4 -21
View File
@@ -169,10 +169,7 @@ Idx Name Size VMA LMA File off Algn Flags
164 ctok32.30 0000000a 00000000 00000000 00001aa8 2**0 CONTENTS, RELOC, READONLY
165 ctok32.40 00000005 00000000 00000000 00001ab2 2**0 CONTENTS, RELOC, READONLY
166 LEXEC017 00000002 00000000 00000000 00001ab7 2**0 CONTENTS, READONLY
167 LEXEC020 00000031 00000000 00000000 00001ab9 2**0 CONTENTS, READONLY
168 LEXECEXE 00000040 00000000 00000000 00001aea 2**0 CONTENTS, RELOC, READONLY
169 LEXECDYN 000000a6 00000000 00000000 00001b2a 2**0 CONTENTS, RELOC, READONLY
170 LEXEC025 00000041 00000000 00000000 00001bd0 2**0 CONTENTS, RELOC, READONLY
167 LEXEC020 000000d4 00000000 00000000 00001ab9 2**0 CONTENTS, RELOC, READONLY
SYMBOL TABLE:
00000000 l d N2BSMA10 00000000 N2BSMA10
00000000 l d N2BFAS11 00000000 N2BFAS11
@@ -218,7 +215,6 @@ SYMBOL TABLE:
00000000 l d ctok32.20 00000000 ctok32.20
00000000 l d ctok32.40 00000000 ctok32.40
00000000 l d LEXEC020 00000000 LEXEC020
00000000 l d LEXEC025 00000000 LEXEC025
00000000 l d LEXEC000 00000000 LEXEC000
00000000 l d LEXEC009 00000000 LEXEC009
00000000 l d LEXEC010 00000000 LEXEC010
@@ -343,8 +339,6 @@ SYMBOL TABLE:
00000000 l d LXUNF035 00000000 LXUNF035
00000000 l d ctok32.30 00000000 ctok32.30
00000000 l d LEXEC017 00000000 LEXEC017
00000000 l d LEXECEXE 00000000 LEXECEXE
00000000 l d LEXECDYN 00000000 LEXECDYN
00000000 g LEXEC000 00000000 _start
00000000 *UND* 00000000 lzma_stack_adjust
00000000 *UND* 00000000 lzma_u_len
@@ -357,7 +351,7 @@ SYMBOL TABLE:
RELOCATION RECORDS FOR [LEXEC000]:
OFFSET TYPE VALUE
00000002 R_386_PC32 LEXEC025
00000002 R_386_PC32 LEXEC020
RELOCATION RECORDS FOR [N2BSMA10]:
OFFSET TYPE VALUE
@@ -661,17 +655,6 @@ RELOCATION RECORDS FOR [ctok32.40]:
OFFSET TYPE VALUE
00000004 R_386_PC8 ctok32.00
RELOCATION RECORDS FOR [LEXECEXE]:
RELOCATION RECORDS FOR [LEXEC020]:
OFFSET TYPE VALUE
0000002d R_386_PC32 LEXEC020
RELOCATION RECORDS FOR [LEXECDYN]:
OFFSET TYPE VALUE
00000004 R_386_32 LEXEC025
000000a0 R_386_32 LEXEC025
00000070 R_386_PC32 LEXEC020
RELOCATION RECORDS FOR [LEXEC025]:
OFFSET TYPE VALUE
00000039 R_386_PC32 LEXEC020
0000003d R_386_32 O_BINFO
000000d0 R_386_32 O_BINFO