MH_EXECUTE runs under lldb, fails under shell

mmap  addr=0x100000000  len=0x3003  prot=0x3  flags=0x1012  fd=-1  off=0x0  reloc=0x0
maddr=0xffffffffffffffff  addr=0x100000000
	modified:   p_mach.cpp
	modified:   p_mach_enum.h
	modified:   stub/src/amd64-darwin.macho-entry.S
	modified:   stub/src/amd64-darwin.macho-fold.S
	modified:   stub/src/amd64-darwin.macho-main.c
This commit is contained in:
John Reiser
2017-12-13 09:54:44 -08:00
parent 3400ae9dbe
commit 5063480a38
9 changed files with 946 additions and 782 deletions
+11 -1
View File
@@ -587,7 +587,8 @@ void PackMachBase<T>::pack4(OutputFile *fo, Filter &ft) // append PackHeader
segLINK.fileoff = len; // must be in the file
segLINK.vmaddr = len + segTEXT.vmaddr;
fo->write(page, 16); len += 16;
segLINK.vmsize = 16;
// reserve convex hull of input segments
segLINK.vmsize -= (segLINK.vmaddr - segTEXT.vmaddr);
segLINK.filesize = 16;
// Get a writeable copy of the stub to make editing easier.
@@ -1324,6 +1325,15 @@ void PackMachBase<T>::pack1(OutputFile *const fo, Filter &/*ft*/) // generate e
segLINK.nsects = 0;
segLINK.initprot = Mach_command::VM_PROT_READ;
// Adjust later: .vmaddr .vmsize .fileoff .filesize
uint64_t up(0);
unsigned const ncmds = mhdri.ncmds;
for (unsigned j= 0; j < ncmds; ++j) if (lc_seg == msegcmd[j].cmd) {
uint64_t sup = msegcmd[j].vmsize + msegcmd[j].vmaddr;
if (up < sup) {
up = sup;
segLINK.vmsize = sup - segLINK.vmaddr;
}
}
unsigned gap = 0;
if (my_filetype == Mach_header::MH_EXECUTE) {
+3 -1
View File
@@ -58,7 +58,9 @@
};
enum { // filetype
MH_EXECUTE = 2,
MH_DYLIB = 6,
MH_PRELOAD = 5, /* preloaded executable */
MH_DYLIB = 6, /* dynamically bound shared library */
MH_DYLINKER= 7, /* /usr/bin/dyld */
MH_BUNDLE = 8 /* dynamically bound bundle file */
};
enum { // flags
File diff suppressed because it is too large Load Diff
+197 -87
View File
@@ -1,5 +1,5 @@
/* amd64-darwin.macho-fold.h
created from amd64-darwin.macho-fold.bin, 1424 (0x590) bytes
created from amd64-darwin.macho-fold.bin, 3184 (0xc70) bytes
This file is part of the UPX executable compressor.
@@ -31,11 +31,11 @@
*/
#define STUB_AMD64_DARWIN_MACHO_FOLD_SIZE 1424
#define STUB_AMD64_DARWIN_MACHO_FOLD_ADLER32 0x54c558f7
#define STUB_AMD64_DARWIN_MACHO_FOLD_CRC32 0xae5d84a8
#define STUB_AMD64_DARWIN_MACHO_FOLD_SIZE 3184
#define STUB_AMD64_DARWIN_MACHO_FOLD_ADLER32 0x51ccdc24
#define STUB_AMD64_DARWIN_MACHO_FOLD_CRC32 0xd9360930
unsigned char stub_amd64_darwin_macho_fold[1424] = {
unsigned char stub_amd64_darwin_macho_fold[3184] = {
/* 0x0000 */ 232, 74, 0, 0, 0,131,249, 73,117, 68, 83, 87, 72,141, 76, 55,
/* 0x0010 */ 253, 94, 86, 91,235, 47, 72, 57,206,115, 50, 86, 94,172, 60,128,
/* 0x0020 */ 114, 10, 60,143,119, 6,128,126,254, 15,116, 6, 44,232, 60, 1,
@@ -43,86 +43,196 @@ unsigned char stub_amd64_darwin_macho_fold[1424] = {
/* 0x0040 */ 41,248, 1,216,171, 72, 57,206,115, 3,172,235,223, 91,195, 65,
/* 0x0050 */ 89, 76,137,247, 76,137,254, 73,137,228,139, 79, 24,184, 0, 8,
/* 0x0060 */ 0, 0, 57,193, 15, 66,200, 73,141, 68, 36, 32, 73,137,232, 72,
/* 0x0070 */ 41,204, 72,137,226, 80,232,171, 3, 0, 0, 76,137,228, 72,139,
/* 0x0080 */ 136,128, 0, 0, 0, 72,137, 76, 36, 24, 80, 93, 95,232, 45, 0,
/* 0x0090 */ 0, 0, 95, 94,184, 73, 0, 0, 2,255,229,139, 7, 15,200,137,
/* 0x00a0 */ 7,131,238, 4, 72,141,127, 4,119,241,195,176, 4,235, 2,176,
/* 0x00b0 */ 1,235, 2,176, 74,235, 2,176, 73,235, 2,176,153,235, 2,176,
/* 0x00c0 */ 6,235, 2,176, 5,235, 2,176,197,235, 2,176, 3, 15,182,192,
/* 0x00d0 */ 13, 0, 0, 0, 2, 73,137,202, 15, 5,115, 4, 72,131,200,255,
/* 0x00e0 */ 195,144,144,144, 81, 72, 57, 23, 76,139, 71, 8, 72,141, 74,255,
/* 0x00f0 */ 115, 10,191,127, 0, 0, 0,232,179,255,255,255, 72,131,249,255,
/* 0x0100 */ 116, 17, 65, 15,182, 0, 72,255,201, 73,255,192,136, 6, 72,255,
/* 0x0110 */ 198,235,233, 72, 1, 87, 8, 72, 41, 23, 88,195, 65, 85, 73,137,
/* 0x0120 */ 213, 65, 84, 73,137,204, 85, 72,137,253, 83, 72,137,243, 72,131,
/* 0x0130 */ 236, 40, 72,131, 62, 0, 15,132,212, 0, 0, 0, 72,141,116, 36,
/* 0x0140 */ 16,186, 12, 0, 0, 0, 72,137,239,232,150,255,255,255,139, 84,
/* 0x0150 */ 36, 16,139,116, 36, 20,133,210,117, 21,129,254, 85, 80, 88, 33,
/* 0x0160 */ 117, 17, 72,131,125, 0, 0, 15,132,163, 0, 0, 0,235, 4,133,
/* 0x0170 */ 246,117, 10,191,127, 0, 0, 0,232, 50,255,255,255, 57,214,119,
/* 0x0180 */ 242,137,208, 72, 59, 3,119,235, 57,214, 72,139, 67, 8,115, 90,
/* 0x0190 */ 68, 15,182, 68, 36, 24,137, 84, 36, 12, 72,141, 76, 36, 12, 72,
/* 0x01a0 */ 139,125, 8, 72,137,194, 65,255,213,133,192,117,198,139,116, 36,
/* 0x01b0 */ 12, 59,116, 36, 16,117,188, 15,182, 76, 36, 25,132,201, 15,149,
/* 0x01c0 */ 194, 49,192, 77,133,228, 15,149,192,133,194,116, 15, 15,182, 84,
/* 0x01d0 */ 36, 26, 15,182,201, 72,139,123, 8, 65,255,212,139, 68, 36, 20,
/* 0x01e0 */ 72, 1, 69, 8, 72, 41, 69, 0,235, 13,137,242, 72,137,239, 72,
/* 0x01f0 */ 137,198,232,237,254,255,255,139, 84, 36, 16, 72,139, 3, 72, 1,
/* 0x0200 */ 83, 8, 72, 41,208, 72,133,192, 72,137, 3,233, 38,255,255,255,
/* 0x0210 */ 72,131,196, 40, 91, 93, 65, 92, 65, 93,195, 65, 87, 73,137,215,
/* 0x0220 */ 65, 86, 65, 85, 73,137,253, 73,131,197, 32, 65, 84, 85, 83, 72,
/* 0x0230 */ 131,236, 88, 72,139,132, 36,144, 0, 0, 0, 72,137,124, 36, 56,
/* 0x0240 */ 137,116, 36, 52,137, 76, 36, 48, 76,137, 68, 36, 40, 76,137, 76,
/* 0x0250 */ 36, 32, 72,137, 68, 36, 24, 49,192, 59, 71, 16, 72,199, 68, 36,
/* 0x0260 */ 16, 0, 0, 0, 0,199, 68, 36, 12, 0, 0, 0, 0, 15,131,159,
/* 0x0270 */ 1, 0, 0, 65,139, 69, 0,131,248, 25, 15,133, 81, 1, 0, 0,
/* 0x0280 */ 73,139, 85, 32, 72,133,210, 15,132, 68, 1, 0, 0, 73,139, 69,
/* 0x0290 */ 48, 72,137, 68, 36, 64, 73,139,125, 24, 73,137,196, 72,137,251,
/* 0x02a0 */ 72,137,253, 72,137,124, 36, 72,129,227,255, 15, 0, 0, 76,141,
/* 0x02b0 */ 52, 23, 72, 41,221, 73, 1,220,116, 70, 77,133,255, 76,137,230,
/* 0x02c0 */ 116, 7, 73,141,116, 36, 3,235, 10, 72,133,192,185, 18, 0, 0,
/* 0x02d0 */ 0,117, 5,185, 18, 16, 0, 0, 65,131,200,255, 68,139, 76, 36,
/* 0x02e0 */ 52, 72,133,192, 68, 15, 69, 68, 36, 48, 69, 3, 77, 40,186, 3,
/* 0x02f0 */ 0, 0, 0, 72,137,239,232,204,253,255,255, 72, 57,197,117,110,
/* 0x0300 */ 77,133,255,116, 45, 73,131,125, 48, 0,116, 38, 73,131,125, 40,
/* 0x0310 */ 0,117, 8, 72,139, 84, 36, 40, 72,137, 42, 72,139, 76, 36, 24,
/* 0x0320 */ 72,139, 84, 36, 32, 72,141,116, 36, 64, 76,137,255,232,234,253,
/* 0x0330 */ 255,255, 76,137,227, 74,141, 84, 37, 0, 72,247,219,129,227,255,
/* 0x0340 */ 15, 0, 0, 72,137,216, 72,133,219,116, 11,198, 2, 0, 72,255,
/* 0x0350 */ 194, 72,255,200,235,243, 77,133,228,116, 29, 65,139, 85, 60, 76,
/* 0x0360 */ 137,230, 72,137,239,232, 73,253,255,255,133,192,116, 10,191,127,
/* 0x0370 */ 0, 0, 0,232, 55,253,255,255, 73,141, 4, 28, 72, 1,197, 76,
/* 0x0380 */ 57,245,115, 42, 72,133,237,116,109, 65,139, 85, 60, 73, 41,238,
/* 0x0390 */ 69, 49,201, 65,131,200,255,185, 18, 16, 0, 0, 76,137,246, 72,
/* 0x03a0 */ 137,239,232, 32,253,255,255, 72, 57,197,116, 74,235,192, 77,133,
/* 0x03b0 */ 255,116, 67, 73,131,196, 3, 65,129,228,255, 15, 0, 0, 73,131,
/* 0x03c0 */ 252, 3,119, 50, 76,137,230, 72,137,239,232,232,252,255,255,235,
/* 0x03d0 */ 37,131,232, 4,131,248, 1,119, 29, 72,184, 4, 0, 0, 0, 42,
/* 0x03e0 */ 0, 0, 0, 73, 57, 69, 8, 73,141, 85, 16, 72, 15, 69, 84, 36,
/* 0x03f0 */ 16, 72,137, 84, 36, 16, 65,139, 69, 4,255, 68, 36, 12,139, 84,
/* 0x0400 */ 36, 12, 73, 1,197, 72,139, 68, 36, 56, 59, 80, 16,233, 91,254,
/* 0x0410 */ 255,255, 72,139, 68, 36, 16, 72,131,196, 88, 91, 93, 65, 92, 65,
/* 0x0420 */ 93, 65, 94, 65, 95,195, 65, 86, 73,137,206, 49,201, 65, 85, 69,
/* 0x0430 */ 49,237, 65, 84, 77,137,204, 85, 72,137,213, 72,141, 87, 24, 83,
/* 0x0440 */ 76,137,195, 72,131,236, 64,139,127, 24, 72,137,116, 36, 56, 72,
/* 0x0450 */ 139, 68, 36, 56, 72,141,116, 36, 16, 72,137, 84, 36, 40, 72,137,
/* 0x0460 */ 84, 36, 8, 76,137,194, 72,137,108, 36, 24, 72,137,124, 36, 16,
/* 0x0470 */ 72,141,124, 36, 32, 72,131,232, 24, 72,137, 68, 36, 32, 72,137,
/* 0x0480 */ 4, 36,232,149,252,255,255, 65, 83, 73,137,217,131,201,255, 49,
/* 0x0490 */ 246, 72,137,239, 72,141, 84, 36, 8, 65, 84, 76,139,132, 36,128,
/* 0x04a0 */ 0, 0, 0,232,115,253,255,255, 65, 89, 65, 90,139,117, 16, 72,
/* 0x04b0 */ 141, 85, 32, 72,137,195, 49,201, 57,241, 15,131,192, 0, 0, 0,
/* 0x04c0 */ 131, 58, 14, 15,133,170, 0, 0, 0,139,122, 8, 49,246, 49,192,
/* 0x04d0 */ 72,141, 60, 58, 49,210,232,232,251,255,255,133,192, 65,137,196,
/* 0x04e0 */ 120, 22, 68,137,233, 76,137,242, 72,137,238, 68,137,231,232,200,
/* 0x04f0 */ 251,255,255, 73, 57,198,116, 16,191,127, 0, 0, 0,232,173,251,
/* 0x0500 */ 255,255, 68,139,107, 8,235,218,139, 69, 0, 61,202,254,186,190,
/* 0x0510 */ 116, 7, 61,190,186,254,202,117, 49, 72, 15,182,117, 7, 72,137,
/* 0x0520 */ 239, 72,141, 93, 8, 72,107,246, 20,131,198, 8,232,106,251,255,
/* 0x0530 */ 255,139, 69, 4, 49,201, 57,193,115, 16,129, 59, 7, 0, 0, 1,
/* 0x0540 */ 116,192,255,193, 72,131,195, 20,235,236, 65, 80, 68,137,238, 69,
/* 0x0550 */ 49,201, 69, 49,192, 68,137,225,106, 0, 49,210, 72,137,239,232,
/* 0x0560 */ 183,252,255,255, 68,137,231, 72,137,195,232, 80,251,255,255, 94,
/* 0x0570 */ 95,235, 13,139, 66, 4,255,193, 72, 1,194,233, 56,255,255,255,
/* 0x0580 */ 72,131,196, 64, 72,137,216, 91, 93, 65, 92, 65, 93, 65, 94,195
/* 0x0070 */ 41,204, 72,137,226, 80,232,208, 9, 0, 0, 72,139, 40, 72,139,
/* 0x0080 */ 136,128, 0, 0, 0, 76,137,228, 72,137, 76, 36, 24, 95,232, 45,
/* 0x0090 */ 0, 0, 0, 95, 94,184, 73, 0, 0, 2,255,229,139, 7, 15,200,
/* 0x00a0 */ 137, 7,131,238, 4, 72,141,127, 4,119,241,195,176, 4,235, 2,
/* 0x00b0 */ 176, 1,235, 2,176, 74,235, 2,176, 73,235, 2,176,153,235, 2,
/* 0x00c0 */ 176, 6,235, 2,176, 5,235, 2,176,197,235, 2,176, 3, 15,182,
/* 0x00d0 */ 192, 13, 0, 0, 0, 2, 73,137,202, 15, 5,115, 4, 72,131,200,
/* 0x00e0 */ 255,195,144,144, 83,137,249, 65,137,208,191, 10, 0, 0, 0, 49,
/* 0x00f0 */ 210,137,200,247,247,131,248, 9,118, 5,107,255, 10,235,240,131,
/* 0x0100 */ 249, 9,118, 47,137,200, 49,210,247,247,186, 10, 0, 0, 0,137,
/* 0x0110 */ 211, 49,210, 65,137,193,137,248, 65, 15,175,193, 41,193,137,248,
/* 0x0120 */ 247,243, 65,141, 81, 48,137,199, 73, 99,192, 65,255,192,136, 20,
/* 0x0130 */ 6,235,204, 91,141, 65, 48, 73, 99,208, 65,255,192,136, 4, 22,
/* 0x0140 */ 68,137,192,195, 73,137,243, 65,137,210,184, 15, 0, 0, 0, 73,
/* 0x0150 */ 185, 0, 0, 0, 0, 0, 0, 0,240, 76,133,207,117, 8, 73,193,
/* 0x0160 */ 233, 4,255,200,117,243, 77,133,201,116, 52, 68,141, 4,133, 0,
/* 0x0170 */ 0, 0, 0, 68,137,193, 72,137,248, 73, 99,242, 72,211,232, 65,
/* 0x0180 */ 255,194,131,224, 15,141, 80, 87,141, 72, 48,131,248, 10, 15, 66,
/* 0x0190 */ 209, 65,131,232, 4, 73,193,233, 4, 65,136, 20, 51,117,212, 68,
/* 0x01a0 */ 137,208,195, 65, 85, 69, 49,237, 65, 84, 69, 49,228, 85, 72,137,
/* 0x01b0 */ 253, 83, 72,129,236,248, 0, 0, 0, 72,137, 84, 36, 80, 15,182,
/* 0x01c0 */ 208, 72,137,116, 36, 72, 72,141, 4,149, 0, 0, 0, 0, 72,141,
/* 0x01d0 */ 21, 75, 0, 0, 0, 72,137, 76, 36, 88, 76,137, 68, 36, 96, 76,
/* 0x01e0 */ 137, 76, 36,104, 72, 41,194, 72,141,132, 36,239, 0, 0, 0,199,
/* 0x01f0 */ 4, 36, 8, 0, 0, 0,199, 68, 36, 4, 48, 0, 0, 0,255,226,
/* 0x0200 */ 15, 41,120,241, 15, 41,112,225, 15, 41,104,209, 15, 41, 96,193,
/* 0x0210 */ 15, 41, 88,177, 15, 41, 80,161, 15, 41, 72,145, 15, 41, 64,129,
/* 0x0220 */ 72,141,132, 36, 32, 1, 0, 0, 72,137, 68, 36, 8, 72,141, 68,
/* 0x0230 */ 36, 64, 72,137, 68, 36, 16, 15,182, 93, 0, 72,255,197,132,219,
/* 0x0240 */ 117, 11, 77,133,237, 15,132,148, 1, 0, 0,235, 20,128,251, 37,
/* 0x0250 */ 116, 10, 77,133,237,117,224, 73,137,237,235,219, 77,133,237,116,
/* 0x0260 */ 34, 73,141,117,255, 72,137,234,191, 2, 0, 0, 0, 76, 41,234,
/* 0x0270 */ 69, 49,237,232, 52,254,255,255, 65, 1,196,132,219, 15,132, 92,
/* 0x0280 */ 1, 0, 0, 15,190, 69, 0, 72,255,197,131,248,112, 15,132,179,
/* 0x0290 */ 0, 0, 0,127, 15,133,192, 15,132, 66, 1, 0, 0,131,248,100,
/* 0x02a0 */ 116, 86,235, 14,131,248,117,116, 23,131,248,120, 15,132,210, 0,
/* 0x02b0 */ 0, 0, 72,141,117,255,186, 1, 0, 0, 0,233, 13, 1, 0, 0,
/* 0x02c0 */ 139, 4, 36, 72,141,116, 36, 32,131,248, 48,115, 15,137,193, 72,
/* 0x02d0 */ 3, 76, 36, 16,131,192, 8,137, 4, 36,235, 14, 72,139, 76, 36,
/* 0x02e0 */ 8, 72,141, 65, 8, 72,137, 68, 36, 8,139, 57, 49,210,232,241,
/* 0x02f0 */ 253,255,255,233,205, 0, 0, 0,139, 4, 36,131,248, 48,115, 15,
/* 0x0300 */ 137,194, 72, 3, 84, 36, 16,131,192, 8,137, 4, 36,235, 14, 72,
/* 0x0310 */ 139, 84, 36, 8, 72,141, 66, 8, 72,137, 68, 36, 8,139, 58, 49,
/* 0x0320 */ 210, 72,141, 92, 36, 32,133,255,121, 9,247,223,198, 68, 36, 32,
/* 0x0330 */ 45,178, 1, 72,137,222,232,169,253,255,255, 72,137,222, 72, 99,
/* 0x0340 */ 208,233,135, 0, 0, 0,139, 4, 36,198, 68, 36, 32, 48, 72,141,
/* 0x0350 */ 116, 36, 32,198, 68, 36, 33,120,131,248, 48,115, 15,137,193, 72,
/* 0x0360 */ 3, 76, 36, 16,131,192, 8,137, 4, 36,235, 14, 72,139, 76, 36,
/* 0x0370 */ 8, 72,141, 65, 8, 72,137, 68, 36, 8, 72,139, 57,186, 2, 0,
/* 0x0380 */ 0, 0,235, 60,139, 4, 36,198, 68, 36, 32, 48, 72,141,116, 36,
/* 0x0390 */ 32,198, 68, 36, 33,120,131,248, 48,115, 15,137,194, 72, 3, 84,
/* 0x03a0 */ 36, 16,131,192, 8,137, 4, 36,235, 14, 72,139, 84, 36, 8, 72,
/* 0x03b0 */ 141, 66, 8, 72,137, 68, 36, 8, 72, 99, 58,186, 2, 0, 0, 0,
/* 0x03c0 */ 232,127,253,255,255, 72,141,116, 36, 32, 72, 99,208,191, 2, 0,
/* 0x03d0 */ 0, 0,232,213,252,255,255, 65, 1,196,233, 88,254,255,255, 72,
/* 0x03e0 */ 129,196,248, 0, 0, 0, 68,137,224, 91, 93, 65, 92, 65, 93,195,
/* 0x03f0 */ 65, 85, 73,137,209, 73,137,240, 49,192, 65, 84, 73,137,244, 85,
/* 0x0400 */ 72,137,213, 83, 72,137,251, 72,137,222, 81, 76,139,111, 8, 72,
/* 0x0410 */ 139, 19,232, 23, 0, 0, 0,120,114,101, 97,100, 32, 37,112, 40,
/* 0x0420 */ 37,120, 32, 37,112, 41, 32, 37,112, 32, 37,120, 10, 0, 95, 76,
/* 0x0430 */ 137,233,232,108,253,255,255, 72,139, 19, 72, 57,234,115, 63, 72,
/* 0x0440 */ 139, 75, 8, 73,137,233, 77,137,224, 72,137,222, 49,192,232, 27,
/* 0x0450 */ 0, 0, 0,120,114,101, 97,100,102, 97,105,108, 32, 37,112, 40,
/* 0x0460 */ 37,120, 32, 37,112, 41, 32, 37,112, 32, 37,120, 10, 0, 95,232,
/* 0x0470 */ 47,253,255,255,191,127, 0, 0, 0,232, 50,252,255,255, 72,141,
/* 0x0480 */ 85,255, 72,131,250,255,116, 20, 65, 15,182, 69, 0, 72,255,202,
/* 0x0490 */ 73,255,197, 65,136, 4, 36, 73,255,196,235,230, 72, 1,107, 8,
/* 0x04a0 */ 72, 41, 43, 88, 91, 93, 65, 92, 65, 93,195, 65, 85, 73,137,213,
/* 0x04b0 */ 73,137,240, 49,192, 65, 84, 73,137,204, 85, 72,137,253,232, 49,
/* 0x04c0 */ 0, 0, 0,117,110,112, 97, 99,107, 69,120,116,101,110,116, 32,
/* 0x04d0 */ 105,110, 61, 37,112, 40, 37,120, 32, 37,112, 41, 32, 32,111,117,
/* 0x04e0 */ 116, 61, 37,112, 40, 37,120, 32, 37,112, 41, 32, 32, 37,112, 32,
/* 0x04f0 */ 37,112, 10, 0, 95, 83, 72,137,243, 72,131,236, 48, 72,139, 77,
/* 0x0500 */ 8, 65, 84, 82,255,118, 8, 76,139, 14, 72,139, 85, 0, 72,137,
/* 0x0510 */ 238,232,141,252,255,255, 72,131,196, 32, 72,131, 59, 0, 15,132,
/* 0x0520 */ 14, 1, 0, 0, 72,141,116, 36, 16,186, 12, 0, 0, 0, 72,137,
/* 0x0530 */ 239,232,186,254,255,255,139, 84, 36, 16,139,116, 36, 20,133,210,
/* 0x0540 */ 117, 21,129,254, 85, 80, 88, 33,117, 17, 72,131,125, 0, 0, 15,
/* 0x0550 */ 132,221, 0, 0, 0,235, 4,133,246,117, 10,191,127, 0, 0, 0,
/* 0x0560 */ 232, 75,251,255,255, 57,214,119, 7,137,208, 72, 59, 3,118, 53,
/* 0x0570 */ 72,139, 11, 49,192,232, 35, 0, 0, 0,115,122, 95, 99,112,114,
/* 0x0580 */ 61, 37,120, 32, 32,115,122, 95,117,110, 99, 61, 37,120, 32, 32,
/* 0x0590 */ 120,111, 45, 62,115,105,122,101, 61, 37,120, 10, 0, 95,232, 0,
/* 0x05a0 */ 252,255,255,235,182, 57,214, 76,139, 75, 8,115, 95, 68, 15,182,
/* 0x05b0 */ 68, 36, 24, 72,137, 68, 36, 8, 72,141, 76, 36, 8, 72,139,125,
/* 0x05c0 */ 8, 76,137,202, 65,255,213,133,192,117,144,139, 68, 36, 16, 72,
/* 0x05d0 */ 139,116, 36, 8, 72, 57,198,117,130, 15,182, 76, 36, 25,132,201,
/* 0x05e0 */ 15,149,194, 49,192, 77,133,228, 15,149,192,133,194,116, 15, 15,
/* 0x05f0 */ 182, 84, 36, 26, 15,182,201, 72,139,123, 8, 65,255,212,139, 68,
/* 0x0600 */ 36, 20, 72, 1, 69, 8, 72, 41, 69, 0,235, 13,137,242, 72,137,
/* 0x0610 */ 239, 76,137,206,232,215,253,255,255,139, 84, 36, 16, 72,139, 3,
/* 0x0620 */ 72, 1, 83, 8, 72, 41,208, 72,133,192, 72,137, 3,233,236,254,
/* 0x0630 */ 255,255, 72,131,196, 40, 91, 93, 65, 92, 65, 93,195, 65, 87, 65,
/* 0x0640 */ 86, 65, 85, 73,137,253, 73,131,197, 32, 65, 84, 85, 83, 72,131,
/* 0x0650 */ 196,128, 72,139,132, 36,184, 0, 0, 0, 72,137, 84, 36, 80, 49,
/* 0x0660 */ 210, 72,137,124, 36, 96,137,116, 36, 92,232, 49, 0, 0, 0,100,
/* 0x0670 */ 111, 95,120,109, 97,112, 32, 32,102,100,105, 61, 37,120, 32, 32,
/* 0x0680 */ 109,104,100,114, 61, 37,112, 32, 32,120,105, 61, 37,112, 40, 37,
/* 0x0690 */ 120, 32, 37,112, 41, 32,102, 95,117,110,102, 61, 37,112, 10, 0,
/* 0x06a0 */ 95, 72,137, 68, 36, 48, 49,192, 72,131,124, 36, 80, 0,137, 76,
/* 0x06b0 */ 36, 76, 76,137, 68, 36, 64, 76,137, 76, 36, 56, 72,199, 68, 36,
/* 0x06c0 */ 40, 0, 0, 0, 0, 72,199, 68, 36, 32, 0, 0, 0, 0,116, 12,
/* 0x06d0 */ 72,139, 76, 36, 80, 72,139, 81, 8, 72,139, 1,255,116, 36, 48,
/* 0x06e0 */ 73,137,209, 72,139, 76, 36, 88, 72,139, 84, 36,104,139,116, 36,
/* 0x06f0 */ 84, 73,137,192, 49,192,232,168,250,255,255, 65, 88, 65, 89, 49,
/* 0x0700 */ 210, 72,139, 68, 36, 88,199, 68, 36, 20, 0, 0, 0, 0, 59, 80,
/* 0x0710 */ 16, 15,131, 32, 3, 0, 0, 65,139, 69, 0,131,248, 25, 15,133,
/* 0x0720 */ 202, 2, 0, 0, 73,139, 77, 32, 72,133,201, 15,132,189, 2, 0,
/* 0x0730 */ 0, 73,139, 85, 48, 72,139,124, 36, 24, 72,137, 84, 36, 96, 73,
/* 0x0740 */ 3,125, 24, 73,137,215, 72,137,251, 72,137,253, 72,141, 12, 15,
/* 0x0750 */ 129,227,255, 15, 0, 0, 72,137,124, 36,104, 72, 41,221, 73, 1,
/* 0x0760 */ 223, 72,137, 76, 36, 8, 15,132, 28, 1, 0, 0, 72,131,124, 36,
/* 0x0770 */ 72, 0, 73,141, 71, 3, 72,139, 76, 36, 56, 73, 15, 68,199, 72,
/* 0x0780 */ 137, 4, 36, 72,139, 1, 72,131,248, 1, 25,192,131,224,240, 72,
/* 0x0790 */ 131,124, 36, 72, 0, 68,141,112, 18,117, 5, 72,133,210,117, 7,
/* 0x07a0 */ 65,129,206, 0, 16, 0, 0,131,203,255, 73,131,125, 48, 0, 68,
/* 0x07b0 */ 139,100, 36, 84, 15, 69, 92, 36, 68, 69, 3,101, 40, 69,137,240,
/* 0x07c0 */ 255,116, 36, 24,185, 3, 0, 0, 0, 72,137,238, 49,192,232, 67,
/* 0x07d0 */ 0, 0, 0,109,109, 97,112, 32, 32, 97,100,100,114, 61, 37,112,
/* 0x07e0 */ 32, 32,108,101,110, 61, 37,112, 32, 32,112,114,111,116, 61, 37,
/* 0x07f0 */ 120, 32, 32,102,108, 97,103,115, 61, 37,120, 32, 32,102,100, 61,
/* 0x0800 */ 37,100, 32, 32,111,102,102, 61, 37,112, 32, 32,114,101,108,111,
/* 0x0810 */ 99, 61, 37,112, 10, 0, 95, 65, 84, 72,139, 84, 36, 16, 65,137,
/* 0x0820 */ 217,232,125,249,255,255, 94, 95, 69,137,225, 65,137,216, 68,137,
/* 0x0830 */ 241,186, 3, 0, 0, 0, 72,137,239, 72,139, 52, 36,232,134,248,
/* 0x0840 */ 255,255, 72,137,198, 72,139, 68, 36, 56, 72,131, 56, 0,117, 11,
/* 0x0850 */ 72,137,245, 72,137, 48, 72,137,116, 36, 24, 72, 57,245,116, 40,
/* 0x0860 */ 72,137,234, 49,192,232, 19, 0, 0, 0,109, 97,100,100,114, 61,
/* 0x0870 */ 37,112, 32, 32, 97,100,100,114, 61, 37,112, 10, 0, 95,232, 32,
/* 0x0880 */ 249,255,255,233,250, 0, 0, 0, 72,131,124, 36, 72, 0,116, 47,
/* 0x0890 */ 73,131,125, 48, 0,116, 40, 73,131,125, 40, 0,117, 8, 72,139,
/* 0x08a0 */ 84, 36, 56, 72,137, 42, 72,139, 76, 36, 40, 72,139, 84, 36, 48,
/* 0x08b0 */ 72,141,116, 36, 96, 72,139,124, 36, 72,232,236,251,255,255, 72,
/* 0x08c0 */ 139, 76, 36, 56, 72,131, 57, 0, 15,149,194, 49,192, 77,133,255,
/* 0x08d0 */ 15,149,192,133,194,116,111, 73,131,125, 40, 0,117,104, 65,131,
/* 0x08e0 */ 125, 64, 0,116, 97, 76,137,233, 72, 43, 76, 36, 88, 73,137,232,
/* 0x08f0 */ 49,192,232, 37, 0, 0, 0,104, 97,116, 99,104, 61, 37,112, 32,
/* 0x0900 */ 32,115,101, 99,112, 61, 37,112, 32, 32,115,101,103,112, 61, 37,
/* 0x0910 */ 112, 32, 32,109,104,100,114, 61, 37,112, 10, 0, 95, 72,141, 76,
/* 0x0920 */ 13, 0, 72,141, 81, 72,139, 90, 48, 72,141, 92, 29, 0, 76,141,
/* 0x0930 */ 99,252, 76,137,230,232,105,248,255,255,199, 67,252,144, 15, 5,
/* 0x0940 */ 195, 76,137,100, 36, 32, 76,137,251, 74,141, 84, 61, 0, 72,247,
/* 0x0950 */ 219,129,227,255, 15, 0, 0, 72,137,216, 72,133,219,116, 11,198,
/* 0x0960 */ 2, 0, 72,255,194, 72,255,200,235,243, 77,133,255,116, 29, 65,
/* 0x0970 */ 139, 85, 60, 76,137,254, 72,137,239,232, 54,247,255,255,133,192,
/* 0x0980 */ 116, 10,191,127, 0, 0, 0,232, 36,247,255,255, 73,141, 4, 31,
/* 0x0990 */ 72, 1,197, 72, 59,108, 36, 8,115, 46, 72,133,237,116,124, 72,
/* 0x09a0 */ 41,108, 36, 8, 65,139, 85, 60, 69, 49,201, 72,139,116, 36, 8,
/* 0x09b0 */ 65,131,200,255,185, 18, 16, 0, 0, 72,137,239,232, 7,247,255,
/* 0x09c0 */ 255, 72, 57,197,116, 85,235,186, 72,131,124, 36, 72, 0,116, 75,
/* 0x09d0 */ 73,131,199, 3, 65,129,231,255, 15, 0, 0, 73,131,255, 3,119,
/* 0x09e0 */ 58, 76,137,254, 72,137,239,232,204,246,255,255,235, 45,131,232,
/* 0x09f0 */ 4,131,248, 1,119, 37, 72,184, 4, 0, 0, 0, 42, 0, 0, 0,
/* 0x0a00 */ 73, 57, 69, 8,117, 21, 72,139, 68, 36, 24, 73, 1,133,144, 0,
/* 0x0a10 */ 0, 0, 73,141, 85, 16, 72,137, 84, 36, 32, 65,139, 69, 4, 72,
/* 0x0a20 */ 139, 76, 36, 88,255, 68, 36, 20, 73, 1,197,139, 68, 36, 20, 59,
/* 0x0a30 */ 65, 16,233,218,252,255,255, 72,139, 68, 36, 32, 72,131,196,120,
/* 0x0a40 */ 91, 93, 65, 92, 65, 93, 65, 94, 65, 95,195, 65, 87, 77,137,207,
/* 0x0a50 */ 65, 86, 65, 85, 77,137,197, 65, 84, 85, 72,137,213, 72,141, 87,
/* 0x0a60 */ 24, 83, 72,131,236,104, 68,139, 79, 24, 72,137,116, 36, 88, 72,
/* 0x0a70 */ 139, 68, 36, 88, 76,141,116, 36, 48, 76,139,164, 36,160, 0, 0,
/* 0x0a80 */ 0, 72,137, 76, 36, 16, 76,137,249, 72,137, 84, 36, 72, 72,137,
/* 0x0a90 */ 84, 36, 40, 77,137,240, 72,131,232, 24, 76,137, 76, 36, 48, 72,
/* 0x0aa0 */ 139,116, 36, 88, 72,137, 68, 36, 64, 72,137, 68, 36, 32, 72,199,
/* 0x0ab0 */ 68, 36, 8, 0, 0, 0, 0,199, 68, 36, 4, 0, 0, 0, 0, 72,
/* 0x0ac0 */ 137,108, 36, 56, 65,255, 52, 36,232, 88, 0, 0, 0,117,112,120,
/* 0x0ad0 */ 95,109, 97,105,110, 32,115,122, 99, 61, 37,120, 32, 32,102, 95,
/* 0x0ae0 */ 100,101, 99, 61, 37,112, 32, 32,102, 95,117,110,102, 61, 37,112,
/* 0x0af0 */ 32, 32, 32, 32,120,111, 61, 37,112, 40, 37,120, 32, 37,112, 41,
/* 0x0b00 */ 32, 32,120,105, 61, 37,112, 40, 37,120, 32, 37,112, 41, 32, 32,
/* 0x0b10 */ 109,104,100,114,112,112, 61, 37,112, 32, 32,109,104,100,114,112,
/* 0x0b20 */ 61, 37,112, 10, 0, 95, 65, 84, 82, 76,137,234, 80, 49,192, 72,
/* 0x0b30 */ 141, 92, 36, 96, 83, 85,232,104,246,255,255, 72,131,196, 48, 76,
/* 0x0b40 */ 137,234, 76,137,246, 49,201, 72,137,223,232, 92,249,255,255, 80,
/* 0x0b50 */ 77,137,233, 77,137,224,131,201,255, 49,246, 72,137,239, 72,141,
/* 0x0b60 */ 84, 36, 40, 65, 87,232,211,250,255,255, 65, 92, 65, 94,139,117,
/* 0x0b70 */ 16, 72,141, 85, 32, 73,137,197, 49,201, 57,241, 15,131,218, 0,
/* 0x0b80 */ 0, 0,131, 58, 14, 15,133,196, 0, 0, 0,139,122, 8, 49,246,
/* 0x0b90 */ 49,192, 72,141, 60, 58, 49,210,232, 39,245,255,255,133,192, 65,
/* 0x0ba0 */ 137,196,120, 27,139, 76, 36, 4, 72,139, 84, 36, 16, 72,137,238,
/* 0x0bb0 */ 68,137,231,232, 4,245,255,255, 72, 57, 68, 36, 16,116, 19,191,
/* 0x0bc0 */ 127, 0, 0, 0,232,231,244,255,255,139, 91, 8,137, 92, 36, 4,
/* 0x0bd0 */ 235,210,139, 69, 0, 61,202,254,186,190,116, 7, 61,190,186,254,
/* 0x0be0 */ 202,117, 49, 72, 15,182,117, 7, 72,137,239, 72,141, 93, 8, 72,
/* 0x0bf0 */ 107,246, 20,131,198, 8,232,161,244,255,255,139, 69, 4, 49,201,
/* 0x0c00 */ 57,193,115, 16,129, 59, 7, 0, 0, 1,116,189,255,193, 72,131,
/* 0x0c10 */ 195, 20,235,236, 72,199, 68, 36, 24, 0, 0, 0, 0, 83, 69, 49,
/* 0x0c20 */ 201, 68,137,225, 49,210,106, 0,139,116, 36, 20, 72,137,239, 76,
/* 0x0c30 */ 141, 68, 36, 40,232, 4,250,255,255, 68,137,231, 76,137, 40, 72,
/* 0x0c40 */ 137, 68, 36, 24,232,119,244,255,255, 65, 90, 65, 91,235, 13,139,
/* 0x0c50 */ 66, 4,255,193, 72, 1,194,233, 30,255,255,255, 72,139, 68, 36,
/* 0x0c60 */ 8, 72,131,196,104, 91, 93, 65, 92, 65, 93, 65, 94, 65, 95,195
};
+1 -1
View File
@@ -96,7 +96,7 @@ SYS_open = 5 + SYSBASE
//0: .word -0b + l_info
section MACHMAINX
_start: .globl _start
int3
//// int3
call main // push &f_exp
section MACH_UNC
+8 -4
View File
@@ -39,6 +39,9 @@ sz_b_info= 12
sz_l_info= 12
sz_p_info= 12
sz_Mach_header64= 8*4
sz_Mach_segment_command= 2*4 + 16 + 4*8 + 4*4
_start: .globl _start # ignored, but silence "cannot find entry symbol _start" from ld
@@ -63,17 +66,18 @@ L90:
push %rax // (arg7) mhdrpp= &mhdrp
// upx_main(&l_info,len_cpr,temp[sz_mhdr],sz_mhdr,f_exp,f_unf,mhdr **)
call upx_main # Out: rax= &Mach_AMD64_thread_state of dyld
movq %r12,%rsp // unalloca
AMD64_ts_rip= 16*NBPW
movq AMD64_ts_rip(%rax),%rcx
movq (%rax),%rbp // &hatch
movq AMD64_ts_rip(%rax),%rcx // from temp char mhdr[] before unalloca
movq %r12,%rsp // unalloca
movq %rcx,3*NBPW(%rsp) // entry
push %rax; pop %rbp // save &thread_state
pop %arg1 // fd
call close
pop %arg1 // ADRU
pop %arg2 // LENU
mov $SYS_munmap+SYSBASE,%eax
jmp *%rbp // munmap(ADRU,LENU); ret
jmp *%rbp // goto hatch: syscall.munmap(ADRU,LENU); ret
bswap: .globl bswap
0:
+56 -19
View File
@@ -129,7 +129,7 @@ err_exit(int a)
{
DPRINTF("err_exit %%x\\n", a);
(void)a; // debugging convenience
exit(127);
exit(a);
}
#endif //}
@@ -326,6 +326,20 @@ typedef struct {
VM_PROT_EXECUTE = 4
};
typedef struct {
char sectname[16];
char segname[16];
uint64_t addr; /* memory address */
uint64_t size; /* size in bytes */
unsigned offset; /* file offset */
unsigned align; /* power of 2 */
unsigned reloff; /* file offset of relocation entries */
unsigned nreloc; /* number of relocation entries */
unsigned flags; /* section type and attributes */
unsigned reserved1; /* for offset or index */
unsigned reserved2; /* for count or sizeof */
} Mach_section_command;
typedef struct {
uint32_t cmd; // LC_MAIN; MH_EXECUTE only
uint32_t cmdsize; // 24
@@ -374,9 +388,9 @@ ssize_t pread(int, void *, size_t, off_t_upx_stub);
extern void bswap(void *, unsigned);
// FIXME: must reserve convex hull of pages; must reloc PIE
static Mach_AMD64_thread_state const *
unsigned char * // &hatch if main; &Mach_AMD64_thread_state if dyld
do_xmap(
Mach_header64 const *const mhdr,
Mach_header64 *const mhdr,
off_t_upx_stub const fat_offset,
Extent *const xi,
int const fdi,
@@ -385,20 +399,21 @@ do_xmap(
f_unfilter *const f_unf
)
{
Mach_segment_command const *sc = (Mach_segment_command const *)(1+ mhdr);
Mach_AMD64_thread_state const *entry = 0;
unsigned char *rv = 0;
Mach_segment_command *sc = (Mach_segment_command *)(1+ mhdr);
size_t reloc = 0;
unsigned j;
DPRINTF("do_xmap fdi=%%x mhdr=%%p xi=%%p(%%x %%p) f_unf=%%p\\n",
fdi, mhdr, xi, (xi? xi->size: 0), (xi? xi->buf: 0), f_unf);
for ( j=0; j < mhdr->ncmds; ++j,
(sc = (Mach_segment_command const *)(sc->cmdsize + (void const *)sc))
(sc = (Mach_segment_command *)(sc->cmdsize + (unsigned char *)sc))
) if (LC_SEGMENT_64==sc->cmd && sc->vmsize!=0) {
Extent xo;
size_t mlen = xo.size = sc->filesize;
unsigned char *addr = xo.buf = (unsigned char *)sc->vmaddr;
unsigned char *haddr = sc->vmsize + addr;
unsigned char *addr = xo.buf = reloc + (unsigned char *)sc->vmaddr;
unsigned char *haddr = sc->vmsize + addr;
size_t frag = (int)(uint64_t)addr &~ PAGE_MASK;
addr -= frag;
mlen += frag;
@@ -407,14 +422,20 @@ do_xmap(
// Decompressor can overrun the destination by 3 bytes. [x86 only]
size_t const mlen3 = mlen + (xi ? 3 : 0);
unsigned const prot = VM_PROT_READ | VM_PROT_WRITE;
unsigned const flags = MAP_FIXED | MAP_PRIVATE |
unsigned const flags = (*mhdrpp ? MAP_FIXED : 0) | MAP_PRIVATE |
((xi || 0==sc->filesize) ? MAP_ANON : 0);
int const fdm = ((0==sc->filesize) ? MAP_ANON_FD : fdi);
off_t_upx_stub const offset = sc->fileoff + fat_offset;
DPRINTF("mmap addr=%%p len=%%p prot=%%x flags=%%x fd=%%d off=%%p\\n",
addr, mlen3, prot, flags, fdm, offset);
if (addr != mmap(addr, mlen3, prot, flags, fdm, offset)) {
DPRINTF("mmap addr=%%p len=%%p prot=%%x flags=%%x fd=%%d off=%%p reloc=%%p\\n",
addr, mlen3, prot, flags, fdm, offset, reloc);
unsigned char *maddr = mmap(addr, mlen3, prot, flags, fdm, offset);
if (!*mhdrpp) { // MH_DYLINKER
*mhdrpp = (Mach_header64*)(addr = maddr);
reloc = (size_t)addr;
}
if (addr != maddr) {
DPRINTF("maddr=%%p addr=%%p\\n", maddr, addr);
err_exit(8);
}
}
@@ -424,6 +445,17 @@ do_xmap(
}
unpackExtent(xi, &xo, f_decompress, f_unf);
}
if (*mhdrpp && mlen && !sc->fileoff && sc->nsects) {
// main target __TEXT segment at beginning of file with sections (__text)
// Use 4 bytes of header padding for the escape hatch.
// fold.S could do this easier, except PROT_WRITE is missing then.
Mach_segment_command *segp = (Mach_segment_command *)(((char *)sc - (char *)mhdr) + addr);
Mach_section_command *const secp = (Mach_section_command *)(1+ segp);
unsigned *hatch= -1+ (unsigned *)(secp->offset + (char *)addr);
DPRINTF("hatch=%%p secp=%%p segp=%%p mhdr=%%p\\n", hatch, secp, segp, addr);
*hatch = 0xc3050f90; // nop; syscall; ret
rv= (unsigned char *)hatch;
}
/*bzero(addr, frag);*/ // fragment at lo end
frag = (-mlen) &~ PAGE_MASK; // distance to next page boundary
bzero(mlen+addr, frag); // fragment at hi end
@@ -450,13 +482,14 @@ ERR_LAB
}
}
else if (LC_UNIXTHREAD==sc->cmd || LC_THREAD==sc->cmd) {
Mach_thread_command const *const thrc = (Mach_thread_command const *)sc;
Mach_thread_command *const thrc = (Mach_thread_command *)sc;
if (AMD64_THREAD_STATE ==thrc->flavor
&& AMD64_THREAD_STATE_COUNT==thrc->count ) {
entry = &thrc->state;
thrc->state.rip += reloc;
rv = (unsigned char *)&thrc->state;
}
}
return entry;
return rv;
}
@@ -476,7 +509,8 @@ upx_main(
Mach_header64 **const mhdrpp // Out: *mhdrpp= &real Mach_header64
)
{
Mach_AMD64_thread_state const *entry;
Mach_AMD64_thread_state *ts = 0;
unsigned char *hatch;
off_t_upx_stub fat_offset = 0;
Extent xi, xo, xi0;
xi.buf = CONST_CAST(unsigned char *, 1+ (struct p_info const *)(1+ li)); // &b_info
@@ -493,7 +527,8 @@ upx_main(
// Uncompress Macho headers
unpackExtent(&xi, &xo, f_decompress, 0); // never filtered?
entry = do_xmap(mhdr, fat_offset, &xi0, MAP_ANON_FD, mhdrpp, f_decompress, f_unf);
// Overwrite the OS-chosen address space at *mhdrpp.
hatch = do_xmap(mhdr, fat_offset, &xi0, MAP_ANON_FD, mhdrpp, f_decompress, f_unf);
{ // Map dyld dynamic loader
Mach_load_command const *lc = (Mach_load_command const *)(1+ mhdr);
@@ -530,13 +565,15 @@ ERR_LAB
}
} break;
} // switch
entry = do_xmap(mhdr, fat_offset, 0, fdi, 0, 0, 0);
Mach_header64 *dyhdr = 0;
ts = (Mach_AMD64_thread_state *)do_xmap(mhdr, fat_offset, 0, fdi, &dyhdr, 0, 0);
ts->rax = (uint64_t)hatch;
close(fdi);
break;
}
}
return entry;
return ts;
}
#if DEBUG //{
+14 -14
View File
@@ -3,19 +3,19 @@ file format elf64-x86-64
Sections:
Idx Name Size VMA LMA File off Algn Flags
0 AMD64BXX 0000004c 0000000000000000 0000000000000000 00000040 2**0 CONTENTS, READONLY
1 MACHMAINX 00000006 0000000000000000 0000000000000000 0000008c 2**0 CONTENTS, RELOC, READONLY
2 MACH_UNC 00000008 0000000000000000 0000000000000000 00000092 2**0 CONTENTS, READONLY
3 NRV_HEAD 00000067 0000000000000000 0000000000000000 0000009a 2**0 CONTENTS, READONLY
4 NRV2E 000000b7 0000000000000000 0000000000000000 00000101 2**0 CONTENTS, RELOC, READONLY
5 NRV2D 0000009e 0000000000000000 0000000000000000 000001b8 2**0 CONTENTS, RELOC, READONLY
6 NRV2B 00000090 0000000000000000 0000000000000000 00000256 2**0 CONTENTS, RELOC, READONLY
7 LZMA_ELF00 00000064 0000000000000000 0000000000000000 000002e6 2**0 CONTENTS, RELOC, READONLY
8 LZMA_DEC10 000009f7 0000000000000000 0000000000000000 0000034a 2**0 CONTENTS, READONLY
9 LZMA_DEC20 000009f7 0000000000000000 0000000000000000 00000d41 2**0 CONTENTS, READONLY
10 LZMA_DEC30 00000014 0000000000000000 0000000000000000 00001738 2**0 CONTENTS, READONLY
11 NRV_TAIL 00000000 0000000000000000 0000000000000000 0000174c 2**0 CONTENTS, READONLY
12 MACHMAINY 00000011 0000000000000000 0000000000000000 0000174c 2**0 CONTENTS, READONLY
13 MACHMAINZ 00000107 0000000000000000 0000000000000000 0000175d 2**0 CONTENTS, RELOC, READONLY
1 MACHMAINX 00000005 0000000000000000 0000000000000000 0000008c 2**0 CONTENTS, RELOC, READONLY
2 MACH_UNC 00000008 0000000000000000 0000000000000000 00000091 2**0 CONTENTS, READONLY
3 NRV_HEAD 00000067 0000000000000000 0000000000000000 00000099 2**0 CONTENTS, READONLY
4 NRV2E 000000b7 0000000000000000 0000000000000000 00000100 2**0 CONTENTS, RELOC, READONLY
5 NRV2D 0000009e 0000000000000000 0000000000000000 000001b7 2**0 CONTENTS, RELOC, READONLY
6 NRV2B 00000090 0000000000000000 0000000000000000 00000255 2**0 CONTENTS, RELOC, READONLY
7 LZMA_ELF00 00000064 0000000000000000 0000000000000000 000002e5 2**0 CONTENTS, RELOC, READONLY
8 LZMA_DEC10 000009f7 0000000000000000 0000000000000000 00000349 2**0 CONTENTS, READONLY
9 LZMA_DEC20 000009f7 0000000000000000 0000000000000000 00000d40 2**0 CONTENTS, READONLY
10 LZMA_DEC30 00000014 0000000000000000 0000000000000000 00001737 2**0 CONTENTS, READONLY
11 NRV_TAIL 00000000 0000000000000000 0000000000000000 0000174b 2**0 CONTENTS, READONLY
12 MACHMAINY 00000011 0000000000000000 0000000000000000 0000174b 2**0 CONTENTS, READONLY
13 MACHMAINZ 00000107 0000000000000000 0000000000000000 0000175c 2**0 CONTENTS, RELOC, READONLY
SYMBOL TABLE:
0000000000000000 l d NRV_HEAD 0000000000000000 NRV_HEAD
0000000000000000 l d LZMA_DEC30 0000000000000000 LZMA_DEC30
@@ -36,7 +36,7 @@ SYMBOL TABLE:
RELOCATION RECORDS FOR [MACHMAINX]:
OFFSET TYPE VALUE
0000000000000002 R_X86_64_PC32 MACHMAINZ+0x000000000000009a
0000000000000001 R_X86_64_PC32 MACHMAINZ+0x000000000000009a
RELOCATION RECORDS FOR [NRV2E]:
OFFSET TYPE VALUE
+46 -45
View File
@@ -72,31 +72,32 @@ LOAD tmp/amd64-darwin.macho-main.o
.plt
*(.plt)
.text 0x0000000008048000 0x590
.text 0x0000000008048000 0xc70
*(.text .stub .text.* .gnu.linkonce.t.*)
.text 0x0000000008048000 0xe1 tmp/amd64-darwin.macho-fold.o
0x00000000080480b7 munmap
0x000000000804809b bswap
0x00000000080480c7 mmap
0x00000000080480ab write
.text 0x0000000008048000 0xe2 tmp/amd64-darwin.macho-fold.o
0x00000000080480b8 munmap
0x000000000804809c bswap
0x00000000080480c8 mmap
0x00000000080480ac write
0x0000000008048000 _start
0x00000000080480cb read
0x00000000080480bb pread
0x00000000080480af exit
0x00000000080480c3 open
0x00000000080480b3 mprotect
0x00000000080480bf close
*fill* 0x00000000080480e1 0x3 90909090
.text 0x00000000080480e4 0x4ac tmp/amd64-darwin.macho-main.o
0x0000000008048426 upx_main
0x00000000080480cc read
0x00000000080480bc pread
0x00000000080480b0 exit
0x00000000080480c4 open
0x00000000080480b4 mprotect
0x00000000080480c0 close
*fill* 0x00000000080480e2 0x2 90909090
.text 0x00000000080480e4 0xb8c tmp/amd64-darwin.macho-main.o
0x000000000804863d do_xmap
0x0000000008048a4b upx_main
*(.text.*personality*)
*(.gnu.warning)
.fini
*(.fini)
0x0000000008048590 PROVIDE (__etext, .)
0x0000000008048590 PROVIDE (_etext, .)
0x0000000008048590 PROVIDE (etext, .)
0x0000000008048c70 PROVIDE (__etext, .)
0x0000000008048c70 PROVIDE (_etext, .)
0x0000000008048c70 PROVIDE (etext, .)
.rodata
*(.rodata .rodata.* .gnu.linkonce.r.*)
@@ -112,8 +113,8 @@ LOAD tmp/amd64-darwin.macho-main.o
.gcc_except_table
*(.gcc_except_table .gcc_except_table.*)
0x0000000008048590 . = (ALIGN (0x1000) - ((0x1000 - .) & 0xfff))
0x0000000008049590 . = (0x1000 DATA_SEGMENT_ALIGN 0x1000)
0x0000000008048c70 . = (ALIGN (0x1000) - ((0x1000 - .) & 0xfff))
0x0000000008049c70 . = (0x1000 DATA_SEGMENT_ALIGN 0x1000)
.eh_frame
*(.eh_frame)
@@ -128,22 +129,22 @@ LOAD tmp/amd64-darwin.macho-main.o
*(.tbss .tbss.* .gnu.linkonce.tb.*)
*(.tcommon)
.preinit_array 0x0000000008049590 0x0
0x0000000008049590 PROVIDE (__preinit_array_start, .)
.preinit_array 0x0000000008049c70 0x0
0x0000000008049c70 PROVIDE (__preinit_array_start, .)
*(.preinit_array)
0x0000000008049590 PROVIDE (__preinit_array_end, .)
0x0000000008049c70 PROVIDE (__preinit_array_end, .)
.init_array 0x0000000008049590 0x0
0x0000000008049590 PROVIDE (__init_array_start, .)
.init_array 0x0000000008049c70 0x0
0x0000000008049c70 PROVIDE (__init_array_start, .)
*(SORT(.init_array.*))
*(.init_array)
0x0000000008049590 PROVIDE (__init_array_end, .)
0x0000000008049c70 PROVIDE (__init_array_end, .)
.fini_array 0x0000000008049590 0x0
0x0000000008049590 PROVIDE (__fini_array_start, .)
.fini_array 0x0000000008049c70 0x0
0x0000000008049c70 PROVIDE (__fini_array_start, .)
*(.fini_array)
*(SORT(.fini_array.*))
0x0000000008049590 PROVIDE (__fini_array_end, .)
0x0000000008049c70 PROVIDE (__fini_array_end, .)
.ctors
*crtbegin*.o(.ctors)
@@ -169,35 +170,35 @@ LOAD tmp/amd64-darwin.macho-main.o
.got
*(.got)
0x0000000008049590 . = (. DATA_SEGMENT_RELRO_END 0xc)
0x0000000008049c70 . = (. DATA_SEGMENT_RELRO_END 0xc)
.got.plt
*(.got.plt)
.data 0x0000000008049590 0x0
.data 0x0000000008049c70 0x0
*(.data .data.* .gnu.linkonce.d.*)
.data 0x0000000008049590 0x0 tmp/amd64-darwin.macho-fold.o
.data 0x0000000008049590 0x0 tmp/amd64-darwin.macho-main.o
.data 0x0000000008049c70 0x0 tmp/amd64-darwin.macho-fold.o
.data 0x0000000008049c70 0x0 tmp/amd64-darwin.macho-main.o
*(.gnu.linkonce.d.*personality*)
.data1
*(.data1)
0x0000000008049590 _edata = .
0x0000000008049590 PROVIDE (edata, .)
0x0000000008049590 __bss_start = .
0x0000000008049c70 _edata = .
0x0000000008049c70 PROVIDE (edata, .)
0x0000000008049c70 __bss_start = .
.bss 0x0000000008049590 0x0
.bss 0x0000000008049c70 0x0
*(.dynbss)
*(.bss .bss.* .gnu.linkonce.b.*)
.bss 0x0000000008049590 0x0 tmp/amd64-darwin.macho-fold.o
.bss 0x0000000008049590 0x0 tmp/amd64-darwin.macho-main.o
.bss 0x0000000008049c70 0x0 tmp/amd64-darwin.macho-fold.o
.bss 0x0000000008049c70 0x0 tmp/amd64-darwin.macho-main.o
*(COMMON)
0x0000000008049590 . = ALIGN ((. != 0x0)?0x4:0x1)
0x0000000008049590 . = ALIGN (0x4)
0x0000000008049590 . = ALIGN (0x4)
0x0000000008049590 _end = .
0x0000000008049590 PROVIDE (end, .)
0x0000000008049590 . = DATA_SEGMENT_END (.)
0x0000000008049c70 . = ALIGN ((. != 0x0)?0x4:0x1)
0x0000000008049c70 . = ALIGN (0x4)
0x0000000008049c70 . = ALIGN (0x4)
0x0000000008049c70 _end = .
0x0000000008049c70 PROVIDE (end, .)
0x0000000008049c70 . = DATA_SEGMENT_END (.)
.stab
*(.stab)