1
0
mirror of https://github.com/upx/upx synced 2025-10-05 19:20:23 +08:00

Always a 1-page crumb for i386

modified:   stub/src/i386-linux.elf-entry.S
	modified:   stub/src/i386-linux.elf-fold.S

	modified:   stub/i386-linux.elf-entry.h
	modified:   stub/i386-linux.elf-fold.h
	modified:   stub/tmp/i386-linux.elf-entry.bin.dump
This commit is contained in:
John Reiser 2017-04-07 11:17:01 -07:00
parent a4e47625ac
commit 8524e73f59
5 changed files with 1972 additions and 1994 deletions

File diff suppressed because it is too large Load Diff

View File

@ -32,8 +32,8 @@
#define STUB_I386_LINUX_ELF_FOLD_SIZE 1754
#define STUB_I386_LINUX_ELF_FOLD_ADLER32 0x1ea5f5b3
#define STUB_I386_LINUX_ELF_FOLD_CRC32 0x46be497f
#define STUB_I386_LINUX_ELF_FOLD_ADLER32 0x6bd9f42a
#define STUB_I386_LINUX_ELF_FOLD_CRC32 0x418bff92
unsigned char stub_i386_linux_elf_fold[1754] = {
/* 0x0000 */ 127, 69, 76, 70, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
@ -54,8 +54,8 @@ unsigned char stub_i386_linux_elf_fold[1754] = {
/* 0x00f0 */ 83, 72,141,148, 26,255, 31, 0, 0,129,226, 0,240,255,255, 82,
/* 0x0100 */ 41,192,102,131,123, 16, 3,117, 1,146, 80,141, 4, 25,139, 24,
/* 0x0110 */ 139, 72, 4,131,193, 12,141, 84, 36, 12, 96, 71,232,113, 4, 0,
/* 0x0120 */ 0,131,196, 36, 89, 91,129,196, 0, 10, 0, 0, 90,193,226, 12,
/* 0x0130 */ 1,211, 80, 79, 41,192, 60,175,175,117,252, 80, 80, 80, 80, 80,
/* 0x0120 */ 0,131,196, 36, 89, 91,129,196, 0, 10, 0, 0,129,195, 0, 16,
/* 0x0130 */ 0, 0, 80, 79, 41,192, 60,175,175,117,252, 80, 80, 80, 80, 80,
/* 0x0140 */ 80, 80, 80, 41,217,176, 91,255, 39,173,171,173,171,173,171,173,
/* 0x0150 */ 171,173,171,133,192,117,250,135,223, 1,223,173,171,133,192,117,
/* 0x0160 */ 250, 87,173,171,131,248, 32,115, 3, 15,179,194,133,192,173,171,

View File

@ -214,10 +214,6 @@ AT_SYSINFO_EHDR=33
pop eax
pop esi
section LUNMP000
push 0 // 0-page bread crumb
section LUNMP001
push 1 // 1-page bread crumb
section LEXEC025
push eax // destination for 'ret'

View File

@ -52,11 +52,15 @@
// control just falls through, after this part and compiled C code
// are uncompressed.
fold_begin: // enter: %ebx= &Elf32_Ehdr of this program; %ebp= f_expand
// %edi=total length of compressed data
// patchLoader will modify to be
// dword sz_uncompressed, sz_compressed
// byte compressed_data...
fold_begin:
// enter: %ebx= &Elf32_Ehdr of this program
// %ebp= f_expand
// %edi= total length of compressed data
// %esp: O_BINFO,argc,argv,0,envp,0,auxv,0,strings
// patchLoader will modify to be
// dword sz_uncompressed, sz_compressed
// byte compressed_data...
// ld-linux.so.2 depends on AT_PHDR and AT_ENTRY, for instance.
// Move argc,argv,envp down to make room for Elf_auxv table.
@ -80,7 +84,7 @@ fold_begin: // enter: %ebx= &Elf32_Ehdr of this program; %ebp= f_expand
push edi // save total length of compressed data
push ebx // save &Elf32_Ehdr
sub ecx, ecx
sub ecx, ecx // 0
mov edx, (1<<AT_PHDR) | (1<<AT_PHENT) | (1<<AT_PHNUM) | (1<<AT_PAGESZ) | (1<<AT_ENTRY)
mov esi, esp
mov edi, esp
@ -153,9 +157,7 @@ L53:
pop ecx // end of unmap region
pop ebx // start of unmap region (&Elf32_Ehdr of this stub)
add esp, MAX_ELF_HDR + OVERHEAD // un-alloca
pop edx // bread crumb size in pages
shl edx,12
add ebx,edx // start of unmap region
add ebx,4096 // start of unmap region (assume crumb of 1 page)
push eax // save entry address
dec edi // auxv table
@ -189,7 +191,7 @@ do_auxv:
// cld
lodsd; stosd // saved &Elf32_Ehdr
lodsd; stosd // saved total length of compressed data
lodsd; stosd // crumb
lodsd; stosd // O_BINFO
lodsd; stosd // argc can be 0
L10: // move argv

View File

@ -171,9 +171,7 @@ Idx Name Size VMA LMA File off Algn Flags
166 LEXEC017 00000002 00000000 00000000 00001ab6 2**0 CONTENTS, READONLY
167 LEXEC020 0000004e 00000000 00000000 00001ab8 2**0 CONTENTS, READONLY
168 LEXECDYN 00000029 00000000 00000000 00001b06 2**0 CONTENTS, READONLY
169 LUNMP000 00000002 00000000 00000000 00001b2f 2**0 CONTENTS, READONLY
170 LUNMP001 00000002 00000000 00000000 00001b31 2**0 CONTENTS, READONLY
171 LEXEC025 0000003e 00000000 00000000 00001b33 2**0 CONTENTS, RELOC, READONLY
169 LEXEC025 0000003e 00000000 00000000 00001b2f 2**0 CONTENTS, RELOC, READONLY
SYMBOL TABLE:
00000000 l d N2BSMA10 00000000 N2BSMA10
00000000 l d N2BFAS11 00000000 N2BFAS11
@ -345,8 +343,6 @@ SYMBOL TABLE:
00000000 l d ctok32.30 00000000 ctok32.30
00000000 l d LEXEC017 00000000 LEXEC017
00000000 l d LEXECDYN 00000000 LEXECDYN
00000000 l d LUNMP000 00000000 LUNMP000
00000000 l d LUNMP001 00000000 LUNMP001
00000000 g LEXEC000 00000000 _start
00000000 *UND* 00000000 lzma_stack_adjust
00000000 *UND* 00000000 lzma_u_len