ARM shlib escape hatch moves to just beyond .text.
https://sourceforge.net/p/upx/bugs/223/
This commit is contained in:
+11
-3
@@ -3042,14 +3042,18 @@ void PackLinuxElf64::unpack(OutputFile *fo)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
bool const is_shlib = 0; // XXX ??
|
bool const is_shlib = 0; // XXX: THIS IS BROKEN; see 32-bit ::unpack
|
||||||
if (is_shlib
|
if (is_shlib
|
||||||
|| ((unsigned)(get_te64(&ehdri.e_entry) - load_va) + up4(lsize) +
|
|| ((unsigned)(get_te64(&ehdri.e_entry) - load_va) + up4(lsize) +
|
||||||
ph.getPackHeaderSize() + sizeof(overlay_offset))
|
ph.getPackHeaderSize() + sizeof(overlay_offset))
|
||||||
< up4(fi->st_size())) {
|
< up4(fi->st_size())) {
|
||||||
// Loader is not at end; skip past it.
|
// Loader is not at end; skip past it.
|
||||||
funpad4(fi); // MATCH01
|
funpad4(fi); // MATCH01
|
||||||
fi->seek(lsize, SEEK_CUR);
|
unsigned d_info[4]; fi->readx(d_info, sizeof(d_info));
|
||||||
|
//if (0==old_dtinit) {
|
||||||
|
// old_dtinit = d_info[2 + (0==d_info[0])];
|
||||||
|
//}
|
||||||
|
fi->seek(lsize - sizeof(d_info), SEEK_CUR);
|
||||||
}
|
}
|
||||||
|
|
||||||
// The gaps between PT_LOAD and after last PT_LOAD
|
// The gaps between PT_LOAD and after last PT_LOAD
|
||||||
@@ -3606,7 +3610,11 @@ void PackLinuxElf32::unpack(OutputFile *fo)
|
|||||||
< up4(fi->st_size())) {
|
< up4(fi->st_size())) {
|
||||||
// Loader is not at end; skip past it.
|
// Loader is not at end; skip past it.
|
||||||
funpad4(fi); // MATCH01
|
funpad4(fi); // MATCH01
|
||||||
fi->seek(lsize, SEEK_CUR);
|
unsigned d_info[4]; fi->readx(d_info, sizeof(d_info));
|
||||||
|
if (0==old_dtinit) {
|
||||||
|
old_dtinit = d_info[2 + (0==d_info[0])];
|
||||||
|
}
|
||||||
|
fi->seek(lsize - sizeof(d_info), SEEK_CUR);
|
||||||
}
|
}
|
||||||
|
|
||||||
// The gaps between PT_LOAD and after last PT_LOAD
|
// The gaps between PT_LOAD and after last PT_LOAD
|
||||||
|
|||||||
@@ -331,7 +331,9 @@ _=-5+_ // 22
|
|||||||
pop_ tmp // toss arg5
|
pop_ tmp // toss arg5
|
||||||
|
|
||||||
// Place the escape hatch
|
// Place the escape hatch
|
||||||
ldr edi,[SP(o_hatch)]
|
pop {arg1,arg2} // addr, len
|
||||||
|
push {arg1,arg2}
|
||||||
|
add edi,arg1,arg2 // ldr edi,[SP(o_hatch)]
|
||||||
ldr tmp,hatch // the 2 instructions
|
ldr tmp,hatch // the 2 instructions
|
||||||
str tmp,[edi]
|
str tmp,[edi]
|
||||||
add edi,#1 // thumb mode
|
add edi,#1 // thumb mode
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -13,7 +13,7 @@ Idx Name Size VMA LMA File off Algn Flags
|
|||||||
8 LZMA_DEC10 00000478 00000000 00000000 00000e0c 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
|
9 LZMA_DEC30 00000000 00000000 00000000 00001284 2**0 CONTENTS, READONLY
|
||||||
10 ELFMAINY 0000003e 00000000 00000000 00001284 2**0 CONTENTS, READONLY
|
10 ELFMAINY 0000003e 00000000 00000000 00001284 2**0 CONTENTS, READONLY
|
||||||
11 ELFMAINZ 00000178 00000000 00000000 000012c4 2**2 CONTENTS, RELOC, READONLY
|
11 ELFMAINZ 0000017c 00000000 00000000 000012c4 2**2 CONTENTS, RELOC, READONLY
|
||||||
SYMBOL TABLE:
|
SYMBOL TABLE:
|
||||||
00000000 l ELFMAINX 00000000 .real_start_ofELFMAINX
|
00000000 l ELFMAINX 00000000 .real_start_ofELFMAINX
|
||||||
00000000 l d NRV2E 00000000 NRV2E
|
00000000 l d NRV2E 00000000 NRV2E
|
||||||
@@ -255,12 +255,12 @@ OFFSET TYPE VALUE
|
|||||||
00000028 R_ARM_THM_CALL .real_start_ofELFMAINZ
|
00000028 R_ARM_THM_CALL .real_start_ofELFMAINZ
|
||||||
00000030 R_ARM_THM_CALL .real_start_ofELFMAINZ
|
00000030 R_ARM_THM_CALL .real_start_ofELFMAINZ
|
||||||
00000050 R_ARM_THM_CALL .real_start_ofELFMAINZ
|
00000050 R_ARM_THM_CALL .real_start_ofELFMAINZ
|
||||||
00000072 R_ARM_THM_CALL .real_start_ofELFMAINZ
|
00000076 R_ARM_THM_CALL .real_start_ofELFMAINZ
|
||||||
00000090 R_ARM_THM_CALL .real_start_ofELFMAINZ
|
00000094 R_ARM_THM_CALL .real_start_ofELFMAINZ
|
||||||
000000c0 R_ARM_PC24 ELFMAINZ
|
000000c4 R_ARM_PC24 ELFMAINZ
|
||||||
000000de R_ARM_THM_CALL .real_start_ofELFMAINZ
|
000000e2 R_ARM_THM_CALL .real_start_ofELFMAINZ
|
||||||
00000104 R_ARM_THM_CALL .real_start_ofELFMAINZ
|
00000108 R_ARM_THM_CALL .real_start_ofELFMAINZ
|
||||||
0000011c R_ARM_THM_CALL .real_start_ofELFMAINZ
|
00000120 R_ARM_THM_CALL .real_start_ofELFMAINZ
|
||||||
00000126 R_ARM_THM_CALL .real_start_ofELFMAINZ
|
0000012a R_ARM_THM_CALL .real_start_ofELFMAINZ
|
||||||
00000130 R_ARM_THM_CALL .real_start_ofELFMAINZ
|
00000134 R_ARM_THM_CALL .real_start_ofELFMAINZ
|
||||||
00000138 R_ARM_THM_CALL .real_start_ofELFMAINZ
|
0000013c R_ARM_THM_CALL .real_start_ofELFMAINZ
|
||||||
|
|||||||
Reference in New Issue
Block a user