1
0
mirror of https://github.com/upx/upx synced 2025-09-28 19:06:07 +08:00

Escape hatch for Thumb-mode shared library must reside at even address.

https://github.com/upx/upx/issues/122
	modified:   stub/src/arm.v4t-linux.shlib-init.S

	modified:   stub/arm.v5t-linux.shlib-init.h
	modified:   stub/tmp/arm.v5t-linux.shlib-init.bin.dump
This commit is contained in:
John Reiser 2017-09-13 22:38:24 -07:00
parent 96433b4e39
commit 6d9f3adc86
3 changed files with 1007 additions and 1005 deletions

File diff suppressed because it is too large Load Diff

View File

@ -114,7 +114,7 @@ _=-1+_ // one less word on stack
//D_INFO:
// .long offset(.) // detect relocation
// .long offset(user DT_INIT)
// .long offset(escape_hatch)
// .long offset(escape_hatch) // override with round_up(2, PT_LOAD[0]{.p_memsz + .p_vaddr})
// .long offset({l_info; p_info; b_info; compressed data})
#define DEBUG 0
@ -137,14 +137,13 @@ here:
// reloc DT_INIT for step 12
ldr tmp,[esi,#1*4]; add tmp,ecx; str tmp,[SP(o_uinit)]
ldr edi,[esi,#3*4]; add edi,ecx // &l_info; also destination for decompress
// reloc &hatch (thumb mode) for step 10
ldr tmp,[esi,#2*4]; add tmp,ecx
mov esi,#sz_l_info+sz_p_info
add esi,edi // &b_info
push_ tmp
sub sp,#3*4 // 3 slots of space
_=1+_ // &escape_hatch (step 10)
o_hatch=_ // 10
sub sp,#2*4; _=2+_ // param space: munmap temp pages step 9
_=2+_ // param space: munmap temp pages (step 9)
p_unmap=_ // 12
push_ lr
@ -332,8 +331,11 @@ _=-5+_ // 22
// Place the escape hatch
pop {arg1,arg2} // addr, len
mov tmp,#1
push {arg1,arg2}
add edi,arg1,arg2 // ldr edi,[SP(o_hatch)]
add edi,#1
bic edi,tmp // round_up(2, .p_memsz + .p_vaddr)
ldr tmp,hatch // the 2 instructions
str tmp,[edi]
add edi,#1 // thumb mode

View File

@ -2,18 +2,18 @@ file format elf32-littlearm
Sections:
Idx Name Size VMA LMA File off Algn Flags
0 ELFMAINX 00000098 00000000 00000000 00000034 2**2 CONTENTS, RELOC, READONLY
1 NRV_HEAD 00000000 00000000 00000000 000000cc 2**0 CONTENTS, READONLY
2 NRV_TAIL 00000000 00000000 00000000 000000cc 2**0 CONTENTS, READONLY
3 NRV2E 0000013c 00000000 00000000 000000cc 2**0 CONTENTS, RELOC, READONLY
4 NRV2D 00000128 00000000 00000000 00000208 2**0 CONTENTS, RELOC, READONLY
5 NRV2B 000000ec 00000000 00000000 00000330 2**0 CONTENTS, RELOC, READONLY
6 LZMA_ELF00 000000b8 00000000 00000000 0000041c 2**0 CONTENTS, RELOC, READONLY
7 LZMA_DEC20 00000938 00000000 00000000 000004d4 2**0 CONTENTS, RELOC, READONLY
8 LZMA_DEC10 00000478 00000000 00000000 00000e0c 2**0 CONTENTS, RELOC, READONLY
9 LZMA_DEC30 00000000 00000000 00000000 00001284 2**0 CONTENTS, READONLY
10 ELFMAINY 0000003e 00000000 00000000 00001284 2**0 CONTENTS, READONLY
11 ELFMAINZ 0000017c 00000000 00000000 000012c4 2**2 CONTENTS, RELOC, READONLY
0 ELFMAINX 00000094 00000000 00000000 00000034 2**2 CONTENTS, RELOC, READONLY
1 NRV_HEAD 00000000 00000000 00000000 000000c8 2**0 CONTENTS, READONLY
2 NRV_TAIL 00000000 00000000 00000000 000000c8 2**0 CONTENTS, READONLY
3 NRV2E 0000013c 00000000 00000000 000000c8 2**0 CONTENTS, RELOC, READONLY
4 NRV2D 00000128 00000000 00000000 00000204 2**0 CONTENTS, RELOC, READONLY
5 NRV2B 000000ec 00000000 00000000 0000032c 2**0 CONTENTS, RELOC, READONLY
6 LZMA_ELF00 000000b8 00000000 00000000 00000418 2**0 CONTENTS, RELOC, READONLY
7 LZMA_DEC20 00000938 00000000 00000000 000004d0 2**0 CONTENTS, RELOC, READONLY
8 LZMA_DEC10 00000478 00000000 00000000 00000e08 2**0 CONTENTS, RELOC, READONLY
9 LZMA_DEC30 00000000 00000000 00000000 00001280 2**0 CONTENTS, READONLY
10 ELFMAINY 0000003e 00000000 00000000 00001280 2**0 CONTENTS, READONLY
11 ELFMAINZ 00000184 00000000 00000000 000012c0 2**2 CONTENTS, RELOC, READONLY
SYMBOL TABLE:
00000000 l ELFMAINX 00000000 .real_start_ofELFMAINX
00000000 l d NRV2E 00000000 NRV2E
@ -38,11 +38,11 @@ SYMBOL TABLE:
RELOCATION RECORDS FOR [ELFMAINX]:
OFFSET TYPE VALUE
0000002c R_ARM_THM_CALL .real_start_ofELFMAINZ
00000044 R_ARM_THM_CALL .real_start_ofELFMAINX
00000088 R_ARM_THM_CALL .real_start_ofELFMAINZ
0000008e R_ARM_THM_CALL .real_start_ofELFMAINZ
00000094 R_ARM_THM_CALL .real_start_ofELFMAINZ
00000026 R_ARM_THM_CALL .real_start_ofELFMAINZ
00000040 R_ARM_THM_CALL .real_start_ofELFMAINX
00000084 R_ARM_THM_CALL .real_start_ofELFMAINZ
0000008a R_ARM_THM_CALL .real_start_ofELFMAINZ
00000090 R_ARM_THM_CALL .real_start_ofELFMAINZ
RELOCATION RECORDS FOR [NRV2E]:
OFFSET TYPE VALUE
@ -255,12 +255,12 @@ OFFSET TYPE VALUE
00000028 R_ARM_THM_CALL .real_start_ofELFMAINZ
00000030 R_ARM_THM_CALL .real_start_ofELFMAINZ
00000050 R_ARM_THM_CALL .real_start_ofELFMAINZ
00000076 R_ARM_THM_CALL .real_start_ofELFMAINZ
00000094 R_ARM_THM_CALL .real_start_ofELFMAINZ
000000c4 R_ARM_PC24 ELFMAINZ
000000e2 R_ARM_THM_CALL .real_start_ofELFMAINZ
00000108 R_ARM_THM_CALL .real_start_ofELFMAINZ
00000120 R_ARM_THM_CALL .real_start_ofELFMAINZ
0000012a R_ARM_THM_CALL .real_start_ofELFMAINZ
00000134 R_ARM_THM_CALL .real_start_ofELFMAINZ
0000007c R_ARM_THM_CALL .real_start_ofELFMAINZ
0000009c R_ARM_THM_CALL .real_start_ofELFMAINZ
000000cc R_ARM_PC24 ELFMAINZ
000000ea R_ARM_THM_CALL .real_start_ofELFMAINZ
00000110 R_ARM_THM_CALL .real_start_ofELFMAINZ
00000128 R_ARM_THM_CALL .real_start_ofELFMAINZ
00000132 R_ARM_THM_CALL .real_start_ofELFMAINZ
0000013c R_ARM_THM_CALL .real_start_ofELFMAINZ
00000144 R_ARM_THM_CALL .real_start_ofELFMAINZ