i386-linux ET_EXEC working

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

	modified:   stub/i386-linux.elf-fold.h
	modified:   stub/tmp/i386-linux.elf-fold.map
This commit is contained in:
John Reiser 2017-04-07 16:08:13 -07:00
parent 8524e73f59
commit 360b94dd6c
3 changed files with 244 additions and 261 deletions

View File

@ -1,5 +1,5 @@
/* i386-linux.elf-fold.h
created from i386-linux.elf-fold.bin, 1754 (0x6da) bytes
created from i386-linux.elf-fold.bin, 1834 (0x72a) bytes
This file is part of the UPX executable compressor.
@ -31,119 +31,124 @@
*/
#define STUB_I386_LINUX_ELF_FOLD_SIZE 1754
#define STUB_I386_LINUX_ELF_FOLD_ADLER32 0x6bd9f42a
#define STUB_I386_LINUX_ELF_FOLD_CRC32 0x418bff92
#define STUB_I386_LINUX_ELF_FOLD_SIZE 1834
#define STUB_I386_LINUX_ELF_FOLD_ADLER32 0x91a11027
#define STUB_I386_LINUX_ELF_FOLD_CRC32 0x567b6966
unsigned char stub_i386_linux_elf_fold[1754] = {
unsigned char stub_i386_linux_elf_fold[1834] = {
/* 0x0000 */ 127, 69, 76, 70, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
/* 0x0010 */ 2, 0, 3, 0, 1, 0, 0, 0,128, 16,192, 0, 52, 0, 0, 0,
/* 0x0020 */ 0, 0, 0, 0, 0, 0, 0, 0, 52, 0, 32, 0, 2, 0, 0, 0,
/* 0x0030 */ 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 16,192, 0,
/* 0x0040 */ 0, 16,192, 0,218, 6, 0, 0,220, 6, 0, 0, 5, 0, 0, 0,
/* 0x0050 */ 0, 16, 0, 0, 1, 0, 0, 0,218, 6, 0, 0, 0, 0, 0, 0,
/* 0x0040 */ 0, 16,192, 0, 42, 7, 0, 0, 44, 7, 0, 0, 5, 0, 0, 0,
/* 0x0050 */ 0, 16, 0, 0, 1, 0, 0, 0, 42, 7, 0, 0, 0, 0, 0, 0,
/* 0x0060 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
/* 0x0070 */ 0, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
/* 0x0080 */ 87, 83, 41,201,186,120, 2, 0, 0,137,230,137,231, 41,219,232,
/* 0x0090 */ 181, 0, 0, 0,141, 89, 4,137,230,209,234, 25,192, 41,193,141,
/* 0x00a0 */ 36,196,133,210,117,243,129,236, 8, 16, 0, 0,137,231,232,150,
/* 0x00b0 */ 0, 0, 0,199, 6, 32, 32, 32, 61,137, 51,186, 0, 16, 0, 0,
/* 0x00c0 */ 141, 78, 4,232, 15, 0, 0, 0, 47,112,114,111, 99, 47,115,101,
/* 0x00d0 */ 108,102, 47,101,120,101, 0, 91,106, 85, 88,205,128,133,192,120,
/* 0x00e0 */ 4,198, 4, 1, 0, 91, 94, 89,129,236, 0, 10, 0, 0, 83,139,
/* 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,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,
/* 0x0170 */ 117,240,131,239, 8, 1,201, 64,243,171, 72,171,171,137,254, 95,
/* 0x0180 */ 195, 83,141, 92, 36, 8,106, 90, 88,205,128, 91,195, 0, 0, 0,
/* 0x0190 */ 87, 86,137,206, 83,137,195, 57, 8,139,120, 4,115, 10,106,127,
/* 0x01a0 */ 91,106, 1, 88,205,128,235,254,133,201,116, 8,138, 7, 71,136,
/* 0x01b0 */ 2, 66,226,248, 1,115, 4, 41, 51, 91, 94, 95,195, 85,137,229,
/* 0x01c0 */ 87, 86,137,198, 83,137,211,131,236, 24,139, 69, 8,139,125, 12,
/* 0x01d0 */ 137, 69,220,131, 58, 0, 15,132,185, 0, 0, 0,141, 85,228,185,
/* 0x01e0 */ 12, 0, 0, 0,137,240,232,165,255,255,255,139, 69,228,139, 77,
/* 0x01f0 */ 232,133,192,117, 19,129,249, 85, 80, 88, 33,117, 15,131, 62, 0,
/* 0x0200 */ 15,132,143, 0, 0, 0,235, 4,133,201,117, 10,106,127, 91,106,
/* 0x0210 */ 1, 88,205,128,235,254, 57,193,119,242, 59, 3,119,238, 57,193,
/* 0x0220 */ 115, 86,137, 69,224,141, 69,224,255,117,236, 80,255,115, 4, 81,
/* 0x0230 */ 255,118, 4,255, 85,220,131,196, 20,133,192,117,207,139, 85,224,
/* 0x0240 */ 59, 85,228,117,199,138, 69,237,132,192,116, 34,133,255,116, 30,
/* 0x0250 */ 129,250, 0, 2, 0, 0,119, 4, 57, 19,117, 18, 15,182,192, 80,
/* 0x0260 */ 15,182, 69,238, 80, 82,255,115, 4,255,215,131,196, 16,139, 69,
/* 0x0270 */ 232, 1, 70, 4, 41, 6,235, 10,139, 83, 4,137,240,232, 14,255,
/* 0x0280 */ 255,255,139, 85,228,139, 3, 1, 83, 4, 41,208,133,192,137, 3,
/* 0x0290 */ 233, 65,255,255,255,141,101,244, 91, 94, 95,201,195,133,192,116,
/* 0x02a0 */ 13,168, 1,117, 9, 57, 16,116, 7,131,192, 8,235,247, 49,192,
/* 0x02b0 */ 133,192,116, 3,137, 72, 4,195, 85,137,229, 87, 86, 83,131,236,
/* 0x02c0 */ 72,137, 69,228,139, 69, 8,137, 85,224,139, 93, 20,137, 69,220,
/* 0x02d0 */ 139,117,224,139, 69,224,137, 93,208,139, 85, 12,139, 93,224, 3,
/* 0x02e0 */ 118, 28,137, 85,216,102,131,120, 16, 2, 15,183, 83, 44,139, 77,
/* 0x02f0 */ 16,137,117,204, 15,148,192, 49,255, 15,182,192,137,211,137, 77,
/* 0x0300 */ 212,193,224, 4,137,241,131,206,255, 75,120, 31,137,211,131, 57,
/* 0x0310 */ 1,117, 18,139, 81, 8, 57,242,115, 2,137,214, 3, 81, 20, 57,
/* 0x0320 */ 215,115, 2,137,215,131,193, 32, 75,117,227,129,230, 0,240,255,
/* 0x0330 */ 255, 41,247,137,242,141,159,255, 15, 0, 0,129,227, 0,240,255,
/* 0x0340 */ 255,133,192,117, 22,106, 0,131,200, 34,106,255, 80,106, 0, 83,
/* 0x0350 */ 86,232, 43,254,255,255,131,196, 24,137,194,141, 4, 26, 41,242,
/* 0x0360 */ 139,117,224,137, 85,200,137, 69,240,102,131,126, 44, 0,199, 69,
/* 0x0370 */ 196, 0, 0, 0, 0, 15,132,221, 1, 0, 0,131,125,220, 0,116,
/* 0x0380 */ 32,139, 69,204,131, 56, 6,117, 24,139, 77,200,186, 3, 0, 0,
/* 0x0390 */ 0, 3, 72, 8,139, 69,216,232, 1,255,255,255,233,160, 1, 0,
/* 0x03a0 */ 0,139, 85,204,131, 58, 1, 15,133,148, 1, 0, 0,139, 74, 24,
/* 0x03b0 */ 187, 64, 98, 81,115,137,214,139, 69,200,131,225, 7, 3, 70, 8,
/* 0x03c0 */ 193,225, 2,139, 82, 16,211,235,137,217,137, 85,232,131,225, 7,
/* 0x03d0 */ 137, 69,236,137, 77,192,139, 78, 20,137,198, 1,193,137, 77,188,
/* 0x03e0 */ 137,193,129,225,255, 15, 0, 0, 41,206,131,125,220, 0,141, 60,
/* 0x03f0 */ 10,116, 63,106, 0,139, 69,192,106,255,106, 50,131,200, 2, 80,
/* 0x0400 */ 141, 71, 3, 80, 86,232,119,253,255,255,131,196, 24, 57,198, 15,
/* 0x0410 */ 133,221, 0, 0, 0,128,227, 4,139, 69,208,117, 2, 49,192, 80,
/* 0x0420 */ 139, 69,220,255,117,228,141, 85,232,232,143,253,255,255, 88, 90,
/* 0x0430 */ 235, 35,139, 93,204,139, 67, 4, 41,200, 80,255,117,228,106, 18,
/* 0x0440 */ 255,117,192, 87, 86,232, 55,253,255,255,131,196, 24, 57,198, 15,
/* 0x0450 */ 133,157, 0, 0, 0,137,248,247,216, 37,255, 15, 0, 0,246, 69,
/* 0x0460 */ 192, 2,137, 69,184,116, 18,131,125,184, 0,141, 4, 62,116, 9,
/* 0x0470 */ 139, 77,184,198, 0, 0, 64,226,250,131,125,220, 0,116,125,139,
/* 0x0480 */ 85,204,131, 58, 1,117, 91,246, 66, 24, 1,116, 85,137,209,139,
/* 0x0490 */ 82, 20,139, 89, 8,139, 69,204,141, 12, 26, 3, 77,200, 59, 80,
/* 0x04a0 */ 16,117, 14,137,200,247,216, 37,255, 15, 0, 0,131,248, 3,119,
/* 0x04b0 */ 17,139, 85,204,107, 69,200, 52,131,122, 4, 0,141, 76, 3, 12,
/* 0x04c0 */ 117, 32,139, 1, 61,205,128, 97,195,116, 6,199, 1,205,128, 97,
/* 0x04d0 */ 195,133,201,116, 13,139, 69,216, 49,210,131,224,254,232,187,253,
/* 0x04e0 */ 255,255,137,243,137,249,139, 85,192,106,125, 88,205,128,133,192,
/* 0x04f0 */ 116, 10,106,127, 91,106, 1, 88,205,128,235,254,139, 85,184,141,
/* 0x0500 */ 4, 23,141, 28, 6, 59, 93,188,115, 30,106, 0,106,255,106, 50,
/* 0x0510 */ 255,117,192, 41, 93,188,255,117,188, 83,232, 98,252,255,255,131,
/* 0x0520 */ 196, 24, 57,195,116, 27,235,202,131,125,220, 0,116, 19,141, 79,
/* 0x0530 */ 3,129,225,255, 15, 0, 0,131,249, 3,119, 5,106, 91, 88,205,
/* 0x0540 */ 128,139, 77,224,255, 69,196, 15,183, 65, 44,131, 69,204, 32, 57,
/* 0x0550 */ 69,196, 15,140, 35,254,255,255,131,125,220, 0,116, 18,139, 93,
/* 0x0560 */ 224,102,131,123, 16, 3,116, 8,139, 93,240,106, 45, 88,205,128,
/* 0x0570 */ 131,125,212, 0,116, 8,139, 69,200,139,117,212,137, 6,139, 85,
/* 0x0580 */ 224,139, 82, 24, 1, 85,200,139, 69,200,141,101,244, 91, 94, 95,
/* 0x0590 */ 201,195, 85,137,229, 87, 86, 83,131,236, 36,139, 85, 16,106, 0,
/* 0x05a0 */ 139,125, 28,139, 69, 8,137, 85,232,255,117,232,131,194, 2,141,
/* 0x05b0 */ 79, 52,139, 93, 32,137, 69,236,137, 85,228,137,206,141, 85, 24,
/* 0x05c0 */ 141, 69, 32,137, 77,224,232,242,251,255,255,139, 69, 12, 15,183,
/* 0x05d0 */ 79, 44,186, 5, 0, 0, 0,137, 69, 32,139, 69,236, 41, 93, 36,
/* 0x05e0 */ 232,184,252,255,255, 15,183, 79, 42,139, 69,236,186, 4, 0, 0,
/* 0x05f0 */ 0,232,167,252,255,255, 89, 91,131,127, 52, 1,116, 8,131,198,
/* 0x0600 */ 32,131, 62, 1,235,246,139, 77, 40,186, 3, 0, 0, 0, 3, 78,
/* 0x0610 */ 8,141, 93,240,139, 69,236,131,193, 52,232,126,252,255,255,255,
/* 0x0620 */ 117,228, 83,137,250,141, 69, 32,255,117,236, 80,139, 69,232,232,
/* 0x0630 */ 132,252,255,255,186, 9, 0, 0, 0,137,193,137, 69,220,139, 69,
/* 0x0640 */ 236,232, 87,252,255,255,102,139, 79, 44,131,196, 16, 49,210,102,
/* 0x0650 */ 133,201,116,123,139, 69,224,131, 56, 3,117,103,139, 93,240, 49,
/* 0x0660 */ 201, 3, 88, 8,137,202,106, 5, 88,205,128,133,192,137,198,120,
/* 0x0670 */ 21,186, 0, 2, 0, 0,137,195,137,249,106, 3, 88,205,128, 61,
/* 0x0680 */ 0, 2, 0, 0,116, 10,106,127, 91,106, 1, 88,205,128,235,254,
/* 0x0690 */ 141, 69,240,137,250,106, 0,137,243, 80,137,240,255,117,236,106,
/* 0x06a0 */ 0,232, 18,252,255,255,139, 77,240,137, 69,220,139, 69,236,186,
/* 0x06b0 */ 7, 0, 0, 0,232,228,251,255,255,131,196, 16,106, 6, 88,205,
/* 0x06c0 */ 128,235, 12, 66, 15,183,193,131, 69,224, 32, 57,194,124,133,139,
/* 0x06d0 */ 69,220,141,101,244, 91, 94, 95,201,195
/* 0x0080 */ 88, 90,137,249,137,230,129,236, 0, 48, 0, 0,137,231, 82, 80,
/* 0x0090 */ 81, 83, 85,137,229,173,133,192,171,117,250, 87,171,173,133,192,
/* 0x00a0 */ 171,117,250, 87,173,133,192,171,165,117,249, 64,131,239, 8,185,
/* 0x00b0 */ 10, 0, 0, 0,243,171, 72,171,171, 41,125,248, 87, 86,186,255,
/* 0x00c0 */ 15, 0, 0,137,249,232, 15, 0, 0, 0, 47,112,114,111, 99, 47,
/* 0x00d0 */ 115,101,108,102, 47,101,120,101, 0, 91,184, 85, 0, 0, 0,205,
/* 0x00e0 */ 128,133,192,121, 7,137,217,184, 14, 0, 0, 0,141,116, 1,255,
/* 0x00f0 */ 145,253, 95, 79,176, 0,170,243,164,184, 32, 32, 32, 61,131,239,
/* 0x0100 */ 3,137, 7,139, 69,252,137, 56,193,239, 12, 79,193,231, 12, 87,
/* 0x0110 */ 41,201,184, 5, 0, 0, 0,205,128, 91,185, 0, 16, 0, 0,186,
/* 0x0120 */ 1, 0, 0, 0,190, 18, 0, 0, 0,151, 41,237,184,192, 0, 0,
/* 0x0130 */ 0,205,128,135,223,184, 6, 0, 0, 0,205,128, 94, 90, 1,250,
/* 0x0140 */ 131,239, 4,137,241,131,238, 4, 41,225,193,233, 2,243,165,141,
/* 0x0150 */ 103, 4,137,215,252, 89, 93, 91, 94, 89,129,236, 0, 10, 0, 0,
/* 0x0160 */ 83,139, 83, 72,141,148, 26,255, 31, 0, 0,129,226, 0,240,255,
/* 0x0170 */ 255, 82, 41,192,102,131,123, 16, 3,117, 1,146, 80,141, 4, 25,
/* 0x0180 */ 139, 24,139, 72, 4,131,193, 12,141, 84, 36, 12, 96, 71,232, 79,
/* 0x0190 */ 4, 0, 0,131,196, 36, 89, 91,129,196, 0, 10, 0, 0, 80, 79,
/* 0x01a0 */ 41,192, 60,175,175,117,252, 80, 80, 80, 80, 80, 80, 80, 80, 41,
/* 0x01b0 */ 217,176, 91,255, 39, 85, 83, 86, 87,139, 92, 36, 20,139, 76, 36,
/* 0x01c0 */ 24,139, 84, 36, 28,139,116, 36, 32,139,124, 36, 36,139,108, 36,
/* 0x01d0 */ 40,193,237, 12,184,192, 0, 0, 0,205,128, 95, 94, 91, 93,195,
/* 0x01e0 */ 87, 86,137,206, 83,137,195, 57, 8,139,120, 4,115, 10,106,127,
/* 0x01f0 */ 91,106, 1, 88,205,128,235,254,133,201,116, 8,138, 7, 71,136,
/* 0x0200 */ 2, 66,226,248, 1,115, 4, 41, 51, 91, 94, 95,195, 85,137,229,
/* 0x0210 */ 87, 86,137,198, 83,137,211,131,236, 24,139, 69, 8,139,125, 12,
/* 0x0220 */ 137, 69,220,131, 58, 0, 15,132,185, 0, 0, 0,141, 85,228,185,
/* 0x0230 */ 12, 0, 0, 0,137,240,232,165,255,255,255,139, 69,228,139, 77,
/* 0x0240 */ 232,133,192,117, 19,129,249, 85, 80, 88, 33,117, 15,131, 62, 0,
/* 0x0250 */ 15,132,143, 0, 0, 0,235, 4,133,201,117, 10,106,127, 91,106,
/* 0x0260 */ 1, 88,205,128,235,254, 57,193,119,242, 59, 3,119,238, 57,193,
/* 0x0270 */ 115, 86,137, 69,224,141, 69,224,255,117,236, 80,255,115, 4, 81,
/* 0x0280 */ 255,118, 4,255, 85,220,131,196, 20,133,192,117,207,139, 85,224,
/* 0x0290 */ 59, 85,228,117,199,138, 69,237,132,192,116, 34,133,255,116, 30,
/* 0x02a0 */ 129,250, 0, 2, 0, 0,119, 4, 57, 19,117, 18, 15,182,192, 80,
/* 0x02b0 */ 15,182, 69,238, 80, 82,255,115, 4,255,215,131,196, 16,139, 69,
/* 0x02c0 */ 232, 1, 70, 4, 41, 6,235, 10,139, 83, 4,137,240,232, 14,255,
/* 0x02d0 */ 255,255,139, 85,228,139, 3, 1, 83, 4, 41,208,133,192,137, 3,
/* 0x02e0 */ 233, 65,255,255,255,141,101,244, 91, 94, 95,201,195,133,192,116,
/* 0x02f0 */ 13,168, 1,117, 9, 57, 16,116, 7,131,192, 8,235,247, 49,192,
/* 0x0300 */ 133,192,116, 3,137, 72, 4,195, 85,137,229, 87, 86, 83,131,236,
/* 0x0310 */ 72,137, 69,228,139, 69, 8,137, 85,224,139, 93, 20,137, 69,220,
/* 0x0320 */ 139,117,224,139, 69,224,137, 93,208,139, 85, 12,139, 93,224, 3,
/* 0x0330 */ 118, 28,137, 85,216,102,131,120, 16, 2, 15,183, 83, 44,139, 77,
/* 0x0340 */ 16,137,117,204, 15,148,192, 49,255, 15,182,192,137,211,137, 77,
/* 0x0350 */ 212,193,224, 4,137,241,131,206,255, 75,120, 31,137,211,131, 57,
/* 0x0360 */ 1,117, 18,139, 81, 8, 57,242,115, 2,137,214, 3, 81, 20, 57,
/* 0x0370 */ 215,115, 2,137,215,131,193, 32, 75,117,227,129,230, 0,240,255,
/* 0x0380 */ 255, 41,247,137,242,141,159,255, 15, 0, 0,129,227, 0,240,255,
/* 0x0390 */ 255,133,192,117, 22,106, 0,131,200, 34,106,255, 80,106, 0, 83,
/* 0x03a0 */ 86,232, 15,254,255,255,131,196, 24,137,194,141, 4, 26, 41,242,
/* 0x03b0 */ 139,117,224,137, 85,200,137, 69,240,102,131,126, 44, 0,199, 69,
/* 0x03c0 */ 196, 0, 0, 0, 0, 15,132,221, 1, 0, 0,131,125,220, 0,116,
/* 0x03d0 */ 32,139, 69,204,131, 56, 6,117, 24,139, 77,200,186, 3, 0, 0,
/* 0x03e0 */ 0, 3, 72, 8,139, 69,216,232, 1,255,255,255,233,160, 1, 0,
/* 0x03f0 */ 0,139, 85,204,131, 58, 1, 15,133,148, 1, 0, 0,139, 74, 24,
/* 0x0400 */ 187, 64, 98, 81,115,137,214,139, 69,200,131,225, 7, 3, 70, 8,
/* 0x0410 */ 193,225, 2,139, 82, 16,211,235,137,217,137, 85,232,131,225, 7,
/* 0x0420 */ 137, 69,236,137, 77,192,139, 78, 20,137,198, 1,193,137, 77,188,
/* 0x0430 */ 137,193,129,225,255, 15, 0, 0, 41,206,131,125,220, 0,141, 60,
/* 0x0440 */ 10,116, 63,106, 0,139, 69,192,106,255,106, 50,131,200, 2, 80,
/* 0x0450 */ 141, 71, 3, 80, 86,232, 91,253,255,255,131,196, 24, 57,198, 15,
/* 0x0460 */ 133,221, 0, 0, 0,128,227, 4,139, 69,208,117, 2, 49,192, 80,
/* 0x0470 */ 139, 69,220,255,117,228,141, 85,232,232,143,253,255,255, 88, 90,
/* 0x0480 */ 235, 35,139, 93,204,139, 67, 4, 41,200, 80,255,117,228,106, 18,
/* 0x0490 */ 255,117,192, 87, 86,232, 27,253,255,255,131,196, 24, 57,198, 15,
/* 0x04a0 */ 133,157, 0, 0, 0,137,248,247,216, 37,255, 15, 0, 0,246, 69,
/* 0x04b0 */ 192, 2,137, 69,184,116, 18,131,125,184, 0,141, 4, 62,116, 9,
/* 0x04c0 */ 139, 77,184,198, 0, 0, 64,226,250,131,125,220, 0,116,125,139,
/* 0x04d0 */ 85,204,131, 58, 1,117, 91,246, 66, 24, 1,116, 85,137,209,139,
/* 0x04e0 */ 82, 20,139, 89, 8,139, 69,204,141, 12, 26, 3, 77,200, 59, 80,
/* 0x04f0 */ 16,117, 14,137,200,247,216, 37,255, 15, 0, 0,131,248, 3,119,
/* 0x0500 */ 17,139, 85,204,107, 69,200, 52,131,122, 4, 0,141, 76, 3, 12,
/* 0x0510 */ 117, 32,139, 1, 61,205,128, 97,195,116, 6,199, 1,205,128, 97,
/* 0x0520 */ 195,133,201,116, 13,139, 69,216, 49,210,131,224,254,232,187,253,
/* 0x0530 */ 255,255,137,243,137,249,139, 85,192,106,125, 88,205,128,133,192,
/* 0x0540 */ 116, 10,106,127, 91,106, 1, 88,205,128,235,254,139, 85,184,141,
/* 0x0550 */ 4, 23,141, 28, 6, 59, 93,188,115, 30,106, 0,106,255,106, 50,
/* 0x0560 */ 255,117,192, 41, 93,188,255,117,188, 83,232, 70,252,255,255,131,
/* 0x0570 */ 196, 24, 57,195,116, 27,235,202,131,125,220, 0,116, 19,141, 79,
/* 0x0580 */ 3,129,225,255, 15, 0, 0,131,249, 3,119, 5,106, 91, 88,205,
/* 0x0590 */ 128,139, 77,224,255, 69,196, 15,183, 65, 44,131, 69,204, 32, 57,
/* 0x05a0 */ 69,196, 15,140, 35,254,255,255,131,125,220, 0,116, 18,139, 93,
/* 0x05b0 */ 224,102,131,123, 16, 3,116, 8,139, 93,240,106, 45, 88,205,128,
/* 0x05c0 */ 131,125,212, 0,116, 8,139, 69,200,139,117,212,137, 6,139, 85,
/* 0x05d0 */ 224,139, 82, 24, 1, 85,200,139, 69,200,141,101,244, 91, 94, 95,
/* 0x05e0 */ 201,195, 85,137,229, 87, 86, 83,131,236, 36,139, 85, 16,106, 0,
/* 0x05f0 */ 139,125, 28,139, 69, 8,137, 85,232,255,117,232,131,194, 2,141,
/* 0x0600 */ 79, 52,139, 93, 32,137, 69,236,137, 85,228,137,206,141, 85, 24,
/* 0x0610 */ 141, 69, 32,137, 77,224,232,242,251,255,255,139, 69, 12, 15,183,
/* 0x0620 */ 79, 44,186, 5, 0, 0, 0,137, 69, 32,139, 69,236, 41, 93, 36,
/* 0x0630 */ 232,184,252,255,255, 15,183, 79, 42,139, 69,236,186, 4, 0, 0,
/* 0x0640 */ 0,232,167,252,255,255, 89, 91,131,127, 52, 1,116, 8,131,198,
/* 0x0650 */ 32,131, 62, 1,235,246,139, 77, 40,186, 3, 0, 0, 0, 3, 78,
/* 0x0660 */ 8,141, 93,240,139, 69,236,131,193, 52,232,126,252,255,255,255,
/* 0x0670 */ 117,228, 83,137,250,141, 69, 32,255,117,236, 80,139, 69,232,232,
/* 0x0680 */ 132,252,255,255,186, 9, 0, 0, 0,137,193,137, 69,220,139, 69,
/* 0x0690 */ 236,232, 87,252,255,255,102,139, 79, 44,131,196, 16, 49,210,102,
/* 0x06a0 */ 133,201,116,123,139, 69,224,131, 56, 3,117,103,139, 93,240, 49,
/* 0x06b0 */ 201, 3, 88, 8,137,202,106, 5, 88,205,128,133,192,137,198,120,
/* 0x06c0 */ 21,186, 0, 2, 0, 0,137,195,137,249,106, 3, 88,205,128, 61,
/* 0x06d0 */ 0, 2, 0, 0,116, 10,106,127, 91,106, 1, 88,205,128,235,254,
/* 0x06e0 */ 141, 69,240,137,250,106, 0,137,243, 80,137,240,255,117,236,106,
/* 0x06f0 */ 0,232, 18,252,255,255,139, 77,240,137, 69,220,139, 69,236,186,
/* 0x0700 */ 7, 0, 0, 0,232,228,251,255,255,131,196, 16,106, 6, 88,205,
/* 0x0710 */ 128,235, 12, 66, 15,183,193,131, 69,224, 32, 57,194,124,133,139,
/* 0x0720 */ 69,220,141,101,244, 91, 94, 95,201,195
};

View File

@ -32,11 +32,14 @@
#include "arch/i386/macros.S"
#define PAGE_SIZE ( 1<<12)
PAGE_SIZE= ( 1<<12)
PATH_MAX= 4096
ET_DYN= 3
#define szElf32_Ehdr 0x34
#define szElf32_Phdr 8*4
#define e_type 16
#define e_phnum 44
e_type= 16
e_phnum= 44
#define e_entry (16 + 2*2 + 4)
#define p_memsz 5*4
#define szb_info 12
@ -46,83 +49,118 @@
#define a_val 4
#define sz_auxv 8
#define __NR_readlink 85
#define __NR_munmap 91
__NR_readlink= 85
__NR_munmap= 91
__NR_open= 5
__NR_close= 6
__NR_mmap= 0xc0
MAP_PRIVATE= 0x02
MAP_FIXED= 0x10
PROT_READ= 0x1
O_RDONLY= 0
// 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
// %esp: O_BINFO,argc,argv,0,envp,0,auxv,0,strings
// patchLoader will modify to be
// dword sz_uncompressed, sz_compressed
// byte compressed_data...
fold_begin:
pop eax // O_BINFO
pop edx // argc
// 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.
// Linux kernel 2.4.2 and earlier give only AT_HWCAP and AT_PLATFORM
// because we have no PT_INTERP. Linux kernel 2.4.5 (and later?)
// give not quite everything. It is simpler and smaller code for us
// to generate a "complete" table where Elf_auxv[k -1].a_type = k.
// On second thought, that wastes a lot of stack space (the entire kernel
// auxv, plus those slots that remain empty anyway). So try for minimal
// space on stack, without too much code, by doing it serially.
mov ecx,edi // total length of compressed data
mov esi,esp // argv
sub esp,2*PAGE_SIZE + PATH_MAX
mov edi,esp
push edx // argc
push eax // O_BINFO
push ecx // total length of compressed data
push ebx // &Elf32_Ehdr
push ebp // f_exp
mov ebp,esp // frame: f_exp,&Elf32_Ehdr,tot_len,O_BINFO,argc
0:
lodsd; test %eax,%eax; stosd; jne 0b // argv
push edi // &new_env[0]; f_exp,&Elf32_Ehdr,tot_len,O_BINFO,argc
stosd // space for new_env[0]
0:
lodsd; test %eax,%eax; stosd; jne 0b // env
push edi // &old_auxv,&new_env[0]; f_exp,&Elf32_Ehdr,tot_len,O_BINFO,argc
0:
lodsd; test %eax,%eax; stosd; movsd; jne 0b // auxv
#define AT_NULL 0
#define AT_IGNORE 1
#define AT_PHDR 3
#define AT_PHENT 4
#define AT_PHNUM 5
#define AT_PAGESZ 6
#define AT_ENTRY 9
inc eax // 1, AT_IGNORE
sub edi,2*4 // {AT_NULL}
mov ecx,5*2; rep stosd // 5 extra slots
dec eax; stosd; stosd // {AT_IGNORE}
sub [-2*4 + ebp],edi // -len_aux
push edi // &new_aux[N],-len_aux,&new_env[0]; f_exp,&Elf32_Ehdr,tot_len,O_BINFO,argc
push esi // &strings,&new_aux[N],-len_aux,&new_env[0]; f_exp,&Elf32_Ehdr,tot_len,O_BINFO,argc
#define ET_DYN 3
push edi // save total length of compressed data
push ebx // save &Elf32_Ehdr
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
sub ebx, ebx // 0
call do_auxv // clear bits in edx according to existing auxv slots
lea ebx,[4+ ecx] // 4 for new envp[0]
mov esi, esp
L50:
shr edx, 1 // Carry = bottom bit
sbb eax, eax // -1 or 0
sub ecx, eax // count of 1 bits that remained in edx
lea esp, [esp + sz_auxv * eax] // allocate one auxv slot, if needed
test edx,edx
jne L50
sub esp, 4+ 4+ 4096 // new envp[0], " =", buffer
mov edi, esp
call do_auxv // move; fill new auxv slots with AT_IGNORE
mov dword ptr [esi], ('='<<24)|(' '<<16)|(' '<<8)|(' '<<0) // " ="
mov [ebx],esi // additional envp[0]
mov edx,4096 // length
lea ecx,[4+ esi] // buf
call L52
mov edx,-1+ PATH_MAX // buflen
mov ecx,edi // buffer
call 1f
0:
.asciz "/proc/self/exe"
L52:
1:
pop ebx // path
push __NR_readlink
pop eax
int 0x80
test eax,eax
js L55
mov byte ptr [ecx + eax], 0 // NUL terminate the link text
L55:
pop ebx // recover &Elf32_Ehdr
pop esi // recover total length of compressed data
mov eax,__NR_readlink; int 0x80; test eax,eax; jns 0f
mov ecx,ebx // point at name
mov eax,-1+ (1b - 0b) // len
0:
lea esi,[-1+ ecx + eax] // src last byte
xchg ecx,eax // ecx= byte count
std
pop edi; dec edi // abuts old strings; &new_aux[N],-len_aux,&new_env[0]; f_exp,&Elf32_Ehdr,tot_len,O_BINFO,argc
mov al,0; stosb // terminate
rep movsb // slide up
mov eax, 0+ ('='<<24)|(' '<<16)|(' '<<8)|(' '<<0) # env var name
sub edi,3; mov [edi],eax
mov eax,[-1*4 + ebp]; mov [eax],edi // new_env[0]
shr edi,12; dec edi; shl edi,12
push edi // &page,&new_aux[N],-len_aux,&new_env[0]; f_exp,&Elf32_Ehdr,tot_len,O_BINFO,argc
sub ecx,ecx // O_RDONLY
// mov ebx,ebx // name
mov eax,__NR_open; int 0x80
pop ebx // &page; &new_aux[N],-len_aux,&new_env[0]; f_exp,&Elf32_Ehdr,tot_len,O_BINFO,argc
mov ecx,PAGE_SIZE
mov edx,PROT_READ
mov esi,MAP_PRIVATE|MAP_FIXED
xchg eax,edi // fd
sub ebp,ebp // 0 block in file
mov eax,__NR_mmap; int 0x80
xchg edi,ebx // ebx= fd; edi= &page
mov eax,__NR_close; int 0x80
pop esi // &new_aux[N]; -len_aux,&new_env[0]; f_exp,&Elf32_Ehdr,tot_len,O_BINFO,argc
pop edx // -len_aux; &new_env[0]; f_exp,&Elf32_Ehdr,tot_len,O_BINFO,argc
add edx,edi // edx= &final_aux[0]
sub edi,4
mov ecx,esi
sub esi,4
sub ecx,esp
shr ecx,2
rep movsd
lea esp,[4+ edi]
mov edi,edx // &final_aux[0]
cld
pop ecx // toss &new_env[0]
pop ebp // f_exp
pop ebx // &Elf32_Ehdr
pop esi // tot_len
pop ecx // O_BINFO
// stack is back to original state: argc,argv,0,env,0,aux,0,strings,0
#define OVERHEAD 2048
#define MAX_ELF_HDR 512
@ -157,7 +195,6 @@ 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
add ebx,4096 // start of unmap region (assume crumb of 1 page)
push eax // save entry address
dec edi // auxv table
@ -182,83 +219,24 @@ L60:
mov al, __NR_munmap // eax was 0 from L60
jmp [edi] // unmap ourselves via escape hatch, then goto entry
// called twice:
// 1st with esi==edi, ecx=0, edx= bitmap of slots needed: just update edx.
// 2nd with esi!=edi, ecx= slot_count: move, then append AT_IGNORE slots
// entry: esi= src = -1+ &argc; edi= dst; ecx= # slots wanted; edx= bits wanted
// exit: edi= &auxtab; edx= bits still needed; ecx= 0; ebx= &envp[0]; esi= &auxv[N]
do_auxv:
// cld
lodsd; stosd // saved &Elf32_Ehdr
lodsd; stosd // saved total length of compressed data
lodsd; stosd // O_BINFO
lodsd; stosd // argc can be 0
L10: // move argv
lodsd; stosd
test eax,eax
jne L10
xchg edi, ebx // ebx= &envp[0]
add edi, ebx // insert extra space
L20: // move envp
lodsd; stosd
test eax,eax
jne L20
push edi // return value
L30: // process auxv
lodsd // a_type
stosd
cmp eax, 32
jae L32 // prevent aliasing by 'btr' when 32<=a_type
btr edx, eax // no longer need a slot of type eax [Carry only]
L32:
test eax, eax // AT_NULL ?
lodsd
stosd
jnz L30 // a_type != AT_NULL
sub edi, 8 // backup to AT_NULL
add ecx, ecx // two words per auxv
inc eax // convert 0 to AT_IGNORE
rep stosd // allocate and fill
dec eax // convert AT_IGNORE to AT_NULL
stosd // re-terminate with AT_NULL
stosd
mov esi,edi // &auxv[N]
pop edi // &auxtab
ret
#define __NR_mmap 90
#if 0 //{ too big and ugly; instead convert to mmap() via #define in .c
MAP_PRIVATE= 2
MAP_ANON= 0x20
//mmap_privanon: .globl mmap_privanon
int3
push 0
push ~0
mov eax,[4*6 + esp]
or eax,MAP_PRIVATE|MAP_ANON
push eax
push [4*6 + esp]
push [4*6 + esp]
push [4*6 + esp]
call mmap
add esp,6*4
ret
#endif //}
mmap: .globl mmap
mmap: .globl mmap // what happened to the ebx->args_on_stack method?
push ebp
push ebx
lea ebx, [2*4 + esp]
push __NR_mmap
pop eax
push esi
push edi
mov ebx,[ 5*4 + esp]
mov ecx,[ 6*4 + esp]
mov edx,[ 7*4 + esp]
mov esi,[ 8*4 + esp]
mov edi,[ 9*4 + esp]
mov ebp,[10*4 + esp]
shr ebp,12
mov eax,__NR_mmap
int 0x80
pop edi
pop esi
pop ebx
pop ebp
ret
.balign 4,0

View File

@ -9,24 +9,24 @@ Linker script and memory map
TARGET(elf32-i386)
0x0000000000c01080 . = ((0xc01000 + SIZEOF_HEADERS) + 0xc)
.text 0x0000000000c01080 0x65c
.text 0x0000000000c01080 0x6ac
*(.text)
.text 0x0000000000c01080 0x110 tmp/i386-linux.elf-fold.o
0x0000000000c01181 mmap
.text 0x0000000000c01190 0x54a tmp/i386-linux.elf-main.o
0x0000000000c01592 upx_main
.text 0x0000000000c01080 0x160 tmp/i386-linux.elf-fold.o
0x0000000000c011b5 mmap
.text 0x0000000000c011e0 0x54a tmp/i386-linux.elf-main.o
0x0000000000c015e2 upx_main
*(.data)
*fill* 0x0000000000c016da 0x2 00
.data 0x0000000000c016dc 0x0 tmp/i386-linux.elf-fold.o
.data 0x0000000000c016dc 0x0 tmp/i386-linux.elf-main.o
*fill* 0x0000000000c0172a 0x2 00
.data 0x0000000000c0172c 0x0 tmp/i386-linux.elf-fold.o
.data 0x0000000000c0172c 0x0 tmp/i386-linux.elf-main.o
.data
.bss 0x0000000000c016dc 0x0
.bss 0x0000000000c016dc 0x0 tmp/i386-linux.elf-fold.o
.bss 0x0000000000c016dc 0x0 tmp/i386-linux.elf-main.o
.bss 0x0000000000c0172c 0x0
.bss 0x0000000000c0172c 0x0 tmp/i386-linux.elf-fold.o
.bss 0x0000000000c0172c 0x0 tmp/i386-linux.elf-main.o
.rel.dyn 0x0000000000c016dc 0x0
.rel.dyn 0x0000000000c0172c 0x0
.rel.text 0x0000000000000000 0x0 tmp/i386-linux.elf-fold.o
LOAD tmp/i386-linux.elf-fold.o
LOAD tmp/i386-linux.elf-main.o