i386: clear the stack when leaving (for buggy programs); align esp to 0 mod 8

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

	modified:   ../.github/travis_testsuite_1.sh
	modified:   stub/i386-linux.elf-entry.h
	modified:   stub/i386-linux.elf-fold.h
	modified:   stub/tmp/i386-linux.elf-entry.bin.dump
	modified:   stub/tmp/i386-linux.elf-fold.map
This commit is contained in:
John Reiser
2017-06-16 21:36:21 -07:00
parent d67bf16a08
commit b2115a4162
7 changed files with 2195 additions and 2164 deletions
File diff suppressed because it is too large Load Diff
+116 -114
View File
@@ -1,5 +1,5 @@
/* i386-linux.elf-fold.h
created from i386-linux.elf-fold.bin, 1884 (0x75c) bytes
created from i386-linux.elf-fold.bin, 1912 (0x778) bytes
This file is part of the UPX executable compressor.
@@ -31,127 +31,129 @@
*/
#define STUB_I386_LINUX_ELF_FOLD_SIZE 1884
#define STUB_I386_LINUX_ELF_FOLD_ADLER32 0x2c5018f0
#define STUB_I386_LINUX_ELF_FOLD_CRC32 0x0a25f2a1
#define STUB_I386_LINUX_ELF_FOLD_SIZE 1912
#define STUB_I386_LINUX_ELF_FOLD_ADLER32 0x11c72d9e
#define STUB_I386_LINUX_ELF_FOLD_CRC32 0xefe3f69e
unsigned char stub_i386_linux_elf_fold[1884] = {
unsigned char stub_i386_linux_elf_fold[1912] = {
/* 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, 92, 7, 0, 0, 92, 7, 0, 0, 5, 0, 0, 0,
/* 0x0050 */ 0, 16, 0, 0, 1, 0, 0, 0, 92, 7, 0, 0, 0, 0, 0, 0,
/* 0x0040 */ 0, 16,192, 0,120, 7, 0, 0,120, 7, 0, 0, 5, 0, 0, 0,
/* 0x0050 */ 0, 16, 0, 0, 1, 0, 0, 0,120, 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 */ 137,230,129,236, 0, 16, 0, 0,137,231,106, 8, 89,243,165, 85,
/* 0x0090 */ 137,229,173,133,192,171,117,250, 87,171,173,133,192,171,117,250,
/* 0x00a0 */ 87,173,133,192,171,165,117,249, 64,131,239, 8,185, 10, 0, 0,
/* 0x00b0 */ 0,243,171, 72,171,171, 41,125,248, 87, 86,186,215, 15, 0, 0,
/* 0x00c0 */ 137,249,232, 15, 0, 0, 0, 47,112,114,111, 99, 47,115,101,108,
/* 0x00d0 */ 102, 47,101,120,101, 0, 91,106, 85, 88,205,128,133,192,121, 7,
/* 0x00e0 */ 137,217,184, 14, 0, 0, 0,141,116, 1,255,145,253, 95, 79,176,
/* 0x00f0 */ 0,170,243,164,184, 32, 32, 32, 61,131,239, 3,137, 7,139, 69,
/* 0x0100 */ 252,137, 56,131,231,252, 41,201,106, 5, 88,205,128,137, 69, 16,
/* 0x0110 */ 94, 90, 1,250,175,137,241,173, 41,225,193,233, 2,243,165,141,
/* 0x0120 */ 103, 4,137,215,252, 89, 93, 94, 88, 89,129,236, 0, 10, 0, 0,
/* 0x0130 */ 137,226, 81,139, 24,139, 72, 4,131,193, 12, 96, 71,232,162, 4,
/* 0x0140 */ 0, 0, 79,129,196, 36, 10, 0, 0,137, 68, 36, 12, 89, 87, 81,
/* 0x0150 */ 41,237,137,207,190, 2, 0, 0, 0,186, 1, 0, 0, 0,185, 0,
/* 0x0160 */ 16, 0, 0, 41,219,104,192, 0, 0, 0, 88,205,128, 91,106, 6,
/* 0x0170 */ 88,205,128, 95, 41,192, 60,175,175,117,252, 89, 91, 80, 80, 80,
/* 0x0180 */ 80, 80, 80, 80, 80,176, 91,255, 39, 85, 83, 86, 87,139, 92, 36,
/* 0x0190 */ 20,139, 76, 36, 24,139, 84, 36, 28,139,116, 36, 32,139,124, 36,
/* 0x01a0 */ 36,139,108, 36, 40,193,237, 12,104,192, 0, 0, 0, 88,205,128,
/* 0x01b0 */ 95, 94, 91, 93,195, 0, 0, 0, 87, 86,137,206, 83,137,195, 57,
/* 0x01c0 */ 8,139,120, 4,115, 10,106,127, 91,106, 1, 88,205,128,235,254,
/* 0x01d0 */ 133,201,116, 8,138, 7, 71,136, 2, 66,226,248, 1,115, 4, 41,
/* 0x01e0 */ 51, 91, 94, 95,195,106,127, 91,106, 1, 88,205,128,235,254, 85,
/* 0x01f0 */ 137,229, 87, 86,137,198, 83,137,211,131,236, 24,139, 69, 8,139,
/* 0x0200 */ 125, 12,137, 69,220,131, 58, 0, 15,132,205, 0, 0, 0,141, 85,
/* 0x0210 */ 228,185, 12, 0, 0, 0,137,240,232,155,255,255,255,139, 69,228,
/* 0x0220 */ 139, 77,232,133,192,117, 25,129,249, 85, 80, 88, 33,176, 2,117,
/* 0x0230 */ 85,131, 62, 0,184, 3, 0, 0, 0,117, 75,233,155, 0, 0, 0,
/* 0x0240 */ 133,201,117, 7,184, 4, 0, 0, 0,235, 59, 57,193,119, 4, 59,
/* 0x0250 */ 3,118, 7,184, 5, 0, 0, 0,235, 44, 57,193,115, 96,137, 69,
/* 0x0260 */ 224,141, 69,224,255,117,236, 80,255,115, 4, 81,255,118, 4,255,
/* 0x0270 */ 85,220,131,196, 20,133,192,117, 8,139, 85,224, 59, 85,228,116,
/* 0x0280 */ 10,184, 7, 0, 0, 0,232, 90,255,255,255,138, 69,237,132,192,
/* 0x0290 */ 116, 34,133,255,116, 30,129,250, 0, 2, 0, 0,119, 4, 57, 19,
/* 0x02a0 */ 117, 18, 15,182,192, 80, 15,182, 69,238, 80, 82,255,115, 4,255,
/* 0x02b0 */ 215,131,196, 16,139, 69,232, 1, 70, 4, 41, 6,235, 10,139, 83,
/* 0x02c0 */ 4,137,240,232,240,254,255,255,139, 85,228,139, 3, 1, 83, 4,
/* 0x02d0 */ 41,208,133,192,137, 3,233, 45,255,255,255,141,101,244, 91, 94,
/* 0x02e0 */ 95,201,195,133,192,116, 13,168, 1,117, 9, 57, 16,116, 7,131,
/* 0x02f0 */ 192, 8,235,247, 49,192,133,192,116, 3,137, 72, 4,195, 85,137,
/* 0x0300 */ 229, 87, 86, 83,131,236, 72,137, 69,228,139, 69, 8,137, 85,224,
/* 0x0310 */ 139, 93, 20,137, 69,220,139,117,224,139, 69,224,137, 93,208,139,
/* 0x0320 */ 85, 12,139, 93,224, 3,118, 28,137, 85,216,102,131,120, 16, 2,
/* 0x0330 */ 15,183, 83, 44,139, 77, 16,137,117,204, 15,148,192, 49,255, 15,
/* 0x0340 */ 182,192,137,211,137, 77,212,193,224, 4,137,241,131,206,255, 75,
/* 0x0350 */ 120, 31,137,211,131, 57, 1,117, 18,139, 81, 8, 57,242,115, 2,
/* 0x0360 */ 137,214, 3, 81, 20, 57,215,115, 2,137,215,131,193, 32, 75,117,
/* 0x0370 */ 227,129,230, 0,240,255,255, 41,247,137,242,141,159,255, 15, 0,
/* 0x0380 */ 0,129,227, 0,240,255,255,133,192,117, 22,106, 0,131,200, 34,
/* 0x0390 */ 106,255, 80,106, 0, 83, 86,232,237,253,255,255,131,196, 24,137,
/* 0x03a0 */ 194,141, 4, 26, 41,242,139,117,224,137, 85,200,137, 69,240,102,
/* 0x03b0 */ 131,126, 44, 0,199, 69,196, 0, 0, 0, 0, 15,132,233, 1, 0,
/* 0x03c0 */ 0,131,125,220, 0,116, 32,139, 69,204,131, 56, 6,117, 24,139,
/* 0x03d0 */ 77,200,186, 3, 0, 0, 0, 3, 72, 8,139, 69,216,232, 1,255,
/* 0x03e0 */ 255,255,233,172, 1, 0, 0,139, 85,204,131, 58, 1, 15,133,160,
/* 0x03f0 */ 1, 0, 0,139, 74, 24,187, 64, 98, 81,115,137,214,139, 69,200,
/* 0x0400 */ 131,225, 7, 3, 70, 8,193,225, 2,139, 82, 16,211,235,137,217,
/* 0x0410 */ 137, 85,232,131,225, 7,137, 69,236,137, 77,192,139, 78, 20,137,
/* 0x0420 */ 198, 1,193,137, 77,188,137,193,129,225,255, 15, 0, 0, 41,206,
/* 0x0430 */ 131,125,220, 0,141, 60, 10,116, 64,106, 0,106,255,106, 50,141,
/* 0x0440 */ 71, 3,106, 3, 80, 86,232, 62,253,255,255,131,196, 24, 57,198,
/* 0x0450 */ 116, 10,184, 6, 0, 0, 0,233, 25, 1, 0, 0,128,227, 4,139,
/* 0x0460 */ 69,208,117, 2, 49,192, 80,139, 69,220,255,117,228,141, 85,232,
/* 0x0470 */ 232,122,253,255,255, 88, 90,235, 41,139, 93,204,139, 67, 4, 41,
/* 0x0480 */ 200, 80,255,117,228,106, 18,255,117,192, 87, 86,232,248,252,255,
/* 0x0490 */ 255,131,196, 24, 57,198,116, 10,184, 8, 0, 0, 0,233,211, 0,
/* 0x04a0 */ 0, 0,137,248,247,216, 37,255, 15, 0, 0,246, 69,192, 2,137,
/* 0x04b0 */ 69,184,116, 18,131,125,184, 0,141, 4, 62,116, 9,139, 77,184,
/* 0x04c0 */ 198, 0, 0, 64,226,250,131,125,220, 0,116,122,139, 85,204,131,
/* 0x04d0 */ 58, 1,117, 91,246, 66, 24, 1,116, 85,137,209,139, 82, 20,139,
/* 0x04e0 */ 89, 8,139, 69,204,141, 12, 26, 3, 77,200, 59, 80, 16,117, 14,
/* 0x04f0 */ 137,200,247,216, 37,255, 15, 0, 0,131,248, 3,119, 17,139, 85,
/* 0x0500 */ 204,107, 69,200, 52,131,122, 4, 0,141, 76, 3, 12,117, 32,139,
/* 0x0510 */ 1, 61,205,128, 97,195,116, 6,199, 1,205,128, 97,195,133,201,
/* 0x0520 */ 116, 13,139, 69,216, 49,210,131,224,254,232,180,253,255,255,137,
/* 0x0530 */ 243,137,249,139, 85,192,106,125, 88,205,128,133,192,116, 7,184,
/* 0x0540 */ 10, 0, 0, 0,235, 47,139, 85,184,141, 4, 23,141, 28, 6, 59,
/* 0x0550 */ 93,188,115, 38,106, 0,106,255,106, 50,255,117,192, 41, 93,188,
/* 0x0560 */ 255,117,188, 83,232, 32,252,255,255,131,196, 24, 57,195,116, 35,
/* 0x0570 */ 184, 9, 0, 0, 0,232,107,252,255,255,131,125,220, 0,116, 19,
/* 0x0580 */ 141, 79, 3,129,225,255, 15, 0, 0,131,249, 3,119, 5,106, 91,
/* 0x0590 */ 88,205,128,139, 77,224,255, 69,196, 15,183, 65, 44,131, 69,204,
/* 0x05a0 */ 32, 57, 69,196, 15,140, 23,254,255,255,131,125,220, 0,116, 18,
/* 0x05b0 */ 139, 93,224,102,131,123, 16, 3,116, 8,139, 93,240,106, 45, 88,
/* 0x05c0 */ 205,128,131,125,212, 0,116, 8,139, 69,200,139,117,212,137, 6,
/* 0x05d0 */ 139, 85,224,139, 82, 24, 1, 85,200,139, 69,200,141,101,244, 91,
/* 0x05e0 */ 94, 95,201,195, 85,137,229, 87, 86, 83,131,236, 28,199, 69,232,
/* 0x05f0 */ 0, 0, 0, 0,139, 69, 8,139,117, 16,137, 69,236,139,125, 28,
/* 0x0600 */ 128, 62,235,139, 93, 32,117, 6,141, 86, 2,137, 85,232,106, 0,
/* 0x0610 */ 141, 85, 24,141, 69, 32, 86,232,211,251,255,255,139, 77, 40,139,
/* 0x0620 */ 69, 12,186, 3, 0, 0, 0,137, 77,240, 3, 79, 28,137, 69, 32,
/* 0x0630 */ 139, 69,236, 41, 93, 36,232,168,252,255,255, 15,183, 79, 44,139,
/* 0x0640 */ 69,236,186, 5, 0, 0, 0,141, 95, 52,232,148,252,255,255, 15,
/* 0x0650 */ 183, 79, 42,139, 69,236,186, 4, 0, 0, 0,232,131,252,255,255,
/* 0x0660 */ 102,131,127, 16, 3, 89, 88,117, 50,139, 77,240,102,199, 71, 16,
/* 0x0670 */ 2, 0, 3, 79, 24,186, 9, 0, 0, 0,139, 69,236,137, 79, 24,
/* 0x0680 */ 232, 94,252,255,255, 15,183, 79, 44,133,201,116, 14,139, 69,240,
/* 0x0690 */ 1, 67, 8, 1, 67, 12,131,195, 32,226,245,141, 77,240,137,250,
/* 0x06a0 */ 255,117,232, 81,255,117,236,141, 69, 32, 80,137,240,232, 76,252,
/* 0x06b0 */ 255,255,186, 9, 0, 0, 0,137,193,137, 69,228,139, 69,236,232,
/* 0x06c0 */ 31,252,255,255,102,139, 95, 44,131,196, 16, 49,201,102,133,219,
/* 0x06d0 */ 141, 87, 52,116,124,131, 58, 3,117,108,139, 93,240, 49,201, 3,
/* 0x06e0 */ 90, 8,137,202,106, 5, 88,205,128,137,198,133,246,184, 18, 0,
/* 0x06f0 */ 0, 0,120, 26,186, 0, 2, 0, 0,137,243,137,249,106, 3, 88,
/* 0x0700 */ 205,128, 61, 0, 2, 0, 0,116, 10,184, 19, 0, 0, 0,232,210,
/* 0x0710 */ 250,255,255,141, 69,240,137,250,106, 0,137,243, 80,137,240,255,
/* 0x0720 */ 117,236,106, 0,232,213,251,255,255,139, 77,240,137, 69,228,139,
/* 0x0730 */ 69,236,186, 7, 0, 0, 0,232,167,251,255,255,131,196, 16,106,
/* 0x0740 */ 6, 88,205,128,235, 11, 65, 15,183,195,131,194, 32, 57,193,124,
/* 0x0750 */ 132,139, 69,228,141,101,244, 91, 94, 95,201,195
/* 0x00b0 */ 0,243,171, 72,171,171, 41,125,248, 87, 86,232, 15, 0, 0, 0,
/* 0x00c0 */ 47,112,114,111, 99, 47,115,101,108,102, 47,101,120,101, 0, 91,
/* 0x00d0 */ 41,201,106, 5, 88,205,128,137, 69, 16,186,215, 15, 0, 0,137,
/* 0x00e0 */ 249,106, 85, 88,205,128,133,192,121, 7,137,217,184, 14, 0, 0,
/* 0x00f0 */ 0,141,116, 1,255,145,253, 95, 79,176, 0,170,243,164,184, 32,
/* 0x0100 */ 32, 32, 61,131,239, 3,137, 7,139, 69,252,137, 56,131,231,252,
/* 0x0110 */ 94,137,241, 41,225,137,200, 49,248,131,224, 4, 41,199, 90, 1,
/* 0x0120 */ 250,175,173,193,233, 2, 73,243,165,252,141, 79, 4, 49,192, 41,
/* 0x0130 */ 225,137,231,193,233, 2,243,171,137,252,137,215, 88, 93, 94, 88,
/* 0x0140 */ 89,129,236, 0, 10, 0, 0,137,226, 81,139, 24,139, 72, 4,131,
/* 0x0150 */ 193, 12, 96, 71,232,167, 4, 0, 0, 79,137,198,137,250,137,231,
/* 0x0160 */ 185,137, 2, 0, 0, 49,192,243,171,137,252,137,116, 36, 12, 95,
/* 0x0170 */ 82, 87, 41,237,106, 2, 94,106, 1, 90,185, 0, 16, 0, 0, 41,
/* 0x0180 */ 219,104,192, 0, 0, 0, 88,205,128, 91,106, 6, 88,205,128, 95,
/* 0x0190 */ 41,192, 60,175,175,117,252, 89, 91, 80, 80, 80, 80, 80, 80, 80,
/* 0x01a0 */ 80,176, 91,255, 39, 85, 83, 86, 87,139, 92, 36, 20,139, 76, 36,
/* 0x01b0 */ 24,139, 84, 36, 28,139,116, 36, 32,139,124, 36, 36,139,108, 36,
/* 0x01c0 */ 40,193,237, 12,104,192, 0, 0, 0, 88,205,128, 95, 94, 91, 93,
/* 0x01d0 */ 195, 0, 0, 0, 87, 86,137,206, 83,137,195, 57, 8,139,120, 4,
/* 0x01e0 */ 115, 10,106,127, 91,106, 1, 88,205,128,235,254,133,201,116, 8,
/* 0x01f0 */ 138, 7, 71,136, 2, 66,226,248, 1,115, 4, 41, 51, 91, 94, 95,
/* 0x0200 */ 195,106,127, 91,106, 1, 88,205,128,235,254, 85,137,229, 87, 86,
/* 0x0210 */ 137,198, 83,137,211,131,236, 24,139, 69, 8,139,125, 12,137, 69,
/* 0x0220 */ 220,131, 58, 0, 15,132,205, 0, 0, 0,141, 85,228,185, 12, 0,
/* 0x0230 */ 0, 0,137,240,232,155,255,255,255,139, 69,228,139, 77,232,133,
/* 0x0240 */ 192,117, 25,129,249, 85, 80, 88, 33,176, 2,117, 85,131, 62, 0,
/* 0x0250 */ 184, 3, 0, 0, 0,117, 75,233,155, 0, 0, 0,133,201,117, 7,
/* 0x0260 */ 184, 4, 0, 0, 0,235, 59, 57,193,119, 4, 59, 3,118, 7,184,
/* 0x0270 */ 5, 0, 0, 0,235, 44, 57,193,115, 96,137, 69,224,141, 69,224,
/* 0x0280 */ 255,117,236, 80,255,115, 4, 81,255,118, 4,255, 85,220,131,196,
/* 0x0290 */ 20,133,192,117, 8,139, 85,224, 59, 85,228,116, 10,184, 7, 0,
/* 0x02a0 */ 0, 0,232, 90,255,255,255,138, 69,237,132,192,116, 34,133,255,
/* 0x02b0 */ 116, 30,129,250, 0, 2, 0, 0,119, 4, 57, 19,117, 18, 15,182,
/* 0x02c0 */ 192, 80, 15,182, 69,238, 80, 82,255,115, 4,255,215,131,196, 16,
/* 0x02d0 */ 139, 69,232, 1, 70, 4, 41, 6,235, 10,139, 83, 4,137,240,232,
/* 0x02e0 */ 240,254,255,255,139, 85,228,139, 3, 1, 83, 4, 41,208,133,192,
/* 0x02f0 */ 137, 3,233, 45,255,255,255,141,101,244, 91, 94, 95,201,195,133,
/* 0x0300 */ 192,116, 13,168, 1,117, 9, 57, 16,116, 7,131,192, 8,235,247,
/* 0x0310 */ 49,192,133,192,116, 3,137, 72, 4,195, 85,137,229, 87, 86, 83,
/* 0x0320 */ 131,236, 72,137, 69,228,139, 69, 8,137, 85,224,139, 93, 20,137,
/* 0x0330 */ 69,220,139,117,224,139, 69,224,137, 93,208,139, 85, 12,139, 93,
/* 0x0340 */ 224, 3,118, 28,137, 85,216,102,131,120, 16, 2, 15,183, 83, 44,
/* 0x0350 */ 139, 77, 16,137,117,204, 15,148,192, 49,255, 15,182,192,137,211,
/* 0x0360 */ 137, 77,212,193,224, 4,137,241,131,206,255, 75,120, 31,137,211,
/* 0x0370 */ 131, 57, 1,117, 18,139, 81, 8, 57,242,115, 2,137,214, 3, 81,
/* 0x0380 */ 20, 57,215,115, 2,137,215,131,193, 32, 75,117,227,129,230, 0,
/* 0x0390 */ 240,255,255, 41,247,137,242,141,159,255, 15, 0, 0,129,227, 0,
/* 0x03a0 */ 240,255,255,133,192,117, 22,106, 0,131,200, 34,106,255, 80,106,
/* 0x03b0 */ 0, 83, 86,232,237,253,255,255,131,196, 24,137,194,141, 4, 26,
/* 0x03c0 */ 41,242,139,117,224,137, 85,200,137, 69,240,102,131,126, 44, 0,
/* 0x03d0 */ 199, 69,196, 0, 0, 0, 0, 15,132,233, 1, 0, 0,131,125,220,
/* 0x03e0 */ 0,116, 32,139, 69,204,131, 56, 6,117, 24,139, 77,200,186, 3,
/* 0x03f0 */ 0, 0, 0, 3, 72, 8,139, 69,216,232, 1,255,255,255,233,172,
/* 0x0400 */ 1, 0, 0,139, 85,204,131, 58, 1, 15,133,160, 1, 0, 0,139,
/* 0x0410 */ 74, 24,187, 64, 98, 81,115,137,214,139, 69,200,131,225, 7, 3,
/* 0x0420 */ 70, 8,193,225, 2,139, 82, 16,211,235,137,217,137, 85,232,131,
/* 0x0430 */ 225, 7,137, 69,236,137, 77,192,139, 78, 20,137,198, 1,193,137,
/* 0x0440 */ 77,188,137,193,129,225,255, 15, 0, 0, 41,206,131,125,220, 0,
/* 0x0450 */ 141, 60, 10,116, 64,106, 0,106,255,106, 50,141, 71, 3,106, 3,
/* 0x0460 */ 80, 86,232, 62,253,255,255,131,196, 24, 57,198,116, 10,184, 6,
/* 0x0470 */ 0, 0, 0,233, 25, 1, 0, 0,128,227, 4,139, 69,208,117, 2,
/* 0x0480 */ 49,192, 80,139, 69,220,255,117,228,141, 85,232,232,122,253,255,
/* 0x0490 */ 255, 88, 90,235, 41,139, 93,204,139, 67, 4, 41,200, 80,255,117,
/* 0x04a0 */ 228,106, 18,255,117,192, 87, 86,232,248,252,255,255,131,196, 24,
/* 0x04b0 */ 57,198,116, 10,184, 8, 0, 0, 0,233,211, 0, 0, 0,137,248,
/* 0x04c0 */ 247,216, 37,255, 15, 0, 0,246, 69,192, 2,137, 69,184,116, 18,
/* 0x04d0 */ 131,125,184, 0,141, 4, 62,116, 9,139, 77,184,198, 0, 0, 64,
/* 0x04e0 */ 226,250,131,125,220, 0,116,122,139, 85,204,131, 58, 1,117, 91,
/* 0x04f0 */ 246, 66, 24, 1,116, 85,137,209,139, 82, 20,139, 89, 8,139, 69,
/* 0x0500 */ 204,141, 12, 26, 3, 77,200, 59, 80, 16,117, 14,137,200,247,216,
/* 0x0510 */ 37,255, 15, 0, 0,131,248, 3,119, 17,139, 85,204,107, 69,200,
/* 0x0520 */ 52,131,122, 4, 0,141, 76, 3, 12,117, 32,139, 1, 61,205,128,
/* 0x0530 */ 97,195,116, 6,199, 1,205,128, 97,195,133,201,116, 13,139, 69,
/* 0x0540 */ 216, 49,210,131,224,254,232,180,253,255,255,137,243,137,249,139,
/* 0x0550 */ 85,192,106,125, 88,205,128,133,192,116, 7,184, 10, 0, 0, 0,
/* 0x0560 */ 235, 47,139, 85,184,141, 4, 23,141, 28, 6, 59, 93,188,115, 38,
/* 0x0570 */ 106, 0,106,255,106, 50,255,117,192, 41, 93,188,255,117,188, 83,
/* 0x0580 */ 232, 32,252,255,255,131,196, 24, 57,195,116, 35,184, 9, 0, 0,
/* 0x0590 */ 0,232,107,252,255,255,131,125,220, 0,116, 19,141, 79, 3,129,
/* 0x05a0 */ 225,255, 15, 0, 0,131,249, 3,119, 5,106, 91, 88,205,128,139,
/* 0x05b0 */ 77,224,255, 69,196, 15,183, 65, 44,131, 69,204, 32, 57, 69,196,
/* 0x05c0 */ 15,140, 23,254,255,255,131,125,220, 0,116, 18,139, 93,224,102,
/* 0x05d0 */ 131,123, 16, 3,116, 8,139, 93,240,106, 45, 88,205,128,131,125,
/* 0x05e0 */ 212, 0,116, 8,139, 69,200,139,117,212,137, 6,139, 85,224,139,
/* 0x05f0 */ 82, 24, 1, 85,200,139, 69,200,141,101,244, 91, 94, 95,201,195,
/* 0x0600 */ 85,137,229, 87, 86, 83,131,236, 28,199, 69,232, 0, 0, 0, 0,
/* 0x0610 */ 139, 69, 8,139,117, 16,137, 69,236,139,125, 28,128, 62,235,139,
/* 0x0620 */ 93, 32,117, 6,141, 86, 2,137, 85,232,106, 0,141, 85, 24,141,
/* 0x0630 */ 69, 32, 86,232,211,251,255,255,139, 77, 40,139, 69, 12,186, 3,
/* 0x0640 */ 0, 0, 0,137, 77,240, 3, 79, 28,137, 69, 32,139, 69,236, 41,
/* 0x0650 */ 93, 36,232,168,252,255,255, 15,183, 79, 44,139, 69,236,186, 5,
/* 0x0660 */ 0, 0, 0,141, 95, 52,232,148,252,255,255, 15,183, 79, 42,139,
/* 0x0670 */ 69,236,186, 4, 0, 0, 0,232,131,252,255,255,102,131,127, 16,
/* 0x0680 */ 3, 89, 88,117, 50,139, 77,240,102,199, 71, 16, 2, 0, 3, 79,
/* 0x0690 */ 24,186, 9, 0, 0, 0,139, 69,236,137, 79, 24,232, 94,252,255,
/* 0x06a0 */ 255, 15,183, 79, 44,133,201,116, 14,139, 69,240, 1, 67, 8, 1,
/* 0x06b0 */ 67, 12,131,195, 32,226,245,141, 77,240,137,250,255,117,232, 81,
/* 0x06c0 */ 255,117,236,141, 69, 32, 80,137,240,232, 76,252,255,255,186, 9,
/* 0x06d0 */ 0, 0, 0,137,193,137, 69,228,139, 69,236,232, 31,252,255,255,
/* 0x06e0 */ 102,139, 95, 44,131,196, 16, 49,201,102,133,219,141, 87, 52,116,
/* 0x06f0 */ 124,131, 58, 3,117,108,139, 93,240, 49,201, 3, 90, 8,137,202,
/* 0x0700 */ 106, 5, 88,205,128,137,198,133,246,184, 18, 0, 0, 0,120, 26,
/* 0x0710 */ 186, 0, 2, 0, 0,137,243,137,249,106, 3, 88,205,128, 61, 0,
/* 0x0720 */ 2, 0, 0,116, 10,184, 19, 0, 0, 0,232,210,250,255,255,141,
/* 0x0730 */ 69,240,137,250,106, 0,137,243, 80,137,240,255,117,236,106, 0,
/* 0x0740 */ 232,213,251,255,255,139, 77,240,137, 69,228,139, 69,236,186, 7,
/* 0x0750 */ 0, 0, 0,232,167,251,255,255,131,196, 16,106, 6, 88,205,128,
/* 0x0760 */ 235, 11, 65, 15,183,195,131,194, 32, 57,193,124,132,139, 69,228,
/* 0x0770 */ 141,101,244, 91, 94, 95,201,195
};
+9 -1
View File
@@ -145,6 +145,7 @@ section LEXEC020
#define __NR_write 4
#define __NR_exit 1
EINVAL= 22
#define pushsbli .byte 0x6a, /* push sign-extended byte to long immediate*/
@@ -254,8 +255,15 @@ AT_SYSINFO_EHDR=33
push edi // length
push eax // destination
mov ebx, esp // address of parameter vector for __NR_mmap
0:
push __NR_mmap; pop eax; int 0x80 // changes only %eax; %edx is live
cmp eax,[ebx]; jne msg_SELinux // not the expected address (includes error)
sub ecx,ecx; cmp [ebx],ecx; je 7f // "any address" always succeeds
cmp eax,[ebx]; je 7f // success
mov [ebx],ecx // any addr
mov [word ptr 3*4 + ebx], MAP_PRIVATE | MAP_ANONYMOUS // not MAP_FIXED
cmp eax,-EINVAL; je 0b
jmp msg_SELinux
7:
add esp,6*4
pop ecx // O_BINFO
push eax // ADRU
+43 -23
View File
@@ -94,16 +94,21 @@ F_fd= 4*4 // frame offset to fd
mov ecx,5*2; rep stosd // 5 extra slots of AT_IGNORE
dec eax; stosd; stosd // 0, AT_NULL
sub [-2*4 + ebp],edi // -len_aux
push edi // &new_aux[N],-len_aux,&new_env[0]; f_exp,LENX,ADRX,slide,fd,LENU,ADRU,entry,argc
push edi // P_07 &new_aux[N],-len_aux,&new_env[0]; f_exp,LENX,ADRX,slide,fd,LENU,ADRU,entry,argc
push esi // &strings,&new_aux[N],-len_aux,&new_env[0]; f_exp,LENX,ADRX,slide,fd,LENU,ADRU,fd,entry,argc
mov edx,-5*2*4 -1+ PATH_MAX // buflen
mov ecx,edi // buffer
call 1f
0:
.asciz "/proc/self/exe"
1:
pop ebx // path
sub ecx,ecx // O_RDONLY
push __NR_open; pop eax; int 0x80
mov [F_fd + ebp],eax // fd for later mmap
mov edx,-5*2*4 -1+ PATH_MAX // buflen
mov ecx,edi // buffer
// mov ebx,ebx // name
push __NR_readlink; pop eax; int 0x80; test eax,eax; jns 0f
mov ecx,ebx // point at name
mov eax,-1+ (1b - 0b) // len
@@ -120,26 +125,32 @@ F_fd= 4*4 // frame offset to fd
mov eax,[-1*4 + ebp]; mov [eax],edi // new_env[0]
and edi,~3 // word align
sub ecx,ecx // O_RDONLY
// mov ebx,ebx // name
push __NR_open; pop eax; int 0x80
mov [F_fd + ebp],eax // fd for later mmap
pop esi // P_07 &new_aux[N]; -len_aux,&new_env[0]; f_exp,LENX,ADRX,slide,fd,LENU,ADRU,entry,argc
// Final sp must be 0 mod 8. There are now 10 words below argc.
mov ecx,esi // last
sub ecx,esp // length of moved block
mov eax,ecx
xor eax,edi // check parity of purported destination
and eax,4
sub edi,eax // align &new_aux[last]
pop esi // &new_aux[N]; -len_aux,&new_env[0]; f_exp,LENX,ADRX,slide,fd,LENU,ADRU,entry,argc
pop edx // -len_aux; &new_env[0]; f_exp,LENX,ADRX,slide,fd,LENU,ADRU,entry,argc
add edx,edi // edx= &final_aux[0]
scasd // edi -= 4
mov ecx,esi
lodsd // esi -= 4
sub ecx,esp
shr ecx,2
rep movsd
lea esp,[4+ edi]
mov edi,edx // &final_aux[0]
shr ecx,2; dec ecx; rep movsd // dec: compensate for P_07
cld
// Clear the vacated stack, for buggy programs that assume it is 0
lea ecx,[1*4+ edi] // correct for 'std'
xor eax,eax // 0
sub ecx,esp
mov edi,esp
shr ecx,2; rep stosd
mov esp,edi
mov edi,edx // &final_aux[0]
pop ecx // toss &new_env[0]
pop eax // toss &new_env[0]
pop ebp // f_exp
// stack is back to original state: LENX,ADRX,slide,fd,LENU,ADRU,entry,argc
@@ -160,16 +171,25 @@ F_fd= 4*4 // frame offset to fd
.extern upx_main
call upx_main // returns entry address
dec edi
add esp, (8 +1)*4 + MAX_ELF_HDR + OVERHEAD // 8 params, slide, un-alloca
mov [3*4 + esp],eax // entry
pop ecx // fd
push edi // auxv
push ecx // fd, auxv, LENU, ADRU, entry, argc
// Buggy programs may depend on uninit stack being 0, so clear what we used.
mov esi,eax // save entry
mov edx,edi // save auxv
mov edi,esp
mov ecx,((8 +1)*4 + MAX_ELF_HDR + OVERHEAD) >>2 // 8 params, slide, un-alloca
xor eax,eax // 0
rep stosd // clear frame on exit
mov esp,edi // end of frame
mov [3*4 + esp],esi // entry
pop edi // fd
push edx // auxv
push edi // fd, auxv, LENU, ADRU, entry, argc
sub ebp,ebp // 0 block in file
mov edi,ecx // fd
mov esi,MAP_PRIVATE
mov edx,PROT_READ
// edi has fd
push MAP_PRIVATE; pop esi
push PROT_READ; pop edx
mov ecx,PAGE_SIZE
sub ebx,ebx // 0 ==> Linux chooses page frame
push __NR_mmap; pop eax; int 0x80
+4 -4
View File
@@ -171,8 +171,8 @@ Idx Name Size VMA LMA File off Algn Flags
166 LEXEC017 00000002 00000000 00000000 00001ab7 2**0 CONTENTS, READONLY
167 LEXEC020 0000003e 00000000 00000000 00001ab9 2**0 CONTENTS, READONLY
168 LEXECEXE 00000033 00000000 00000000 00001af7 2**0 CONTENTS, RELOC, READONLY
169 LEXECDYN 00000087 00000000 00000000 00001b2a 2**0 CONTENTS, RELOC, READONLY
170 LEXEC025 00000041 00000000 00000000 00001bb1 2**0 CONTENTS, RELOC, READONLY
169 LEXECDYN 0000009b 00000000 00000000 00001b2a 2**0 CONTENTS, RELOC, READONLY
170 LEXEC025 00000041 00000000 00000000 00001bc5 2**0 CONTENTS, RELOC, READONLY
SYMBOL TABLE:
00000000 l d N2BSMA10 00000000 N2BSMA10
00000000 l d N2BFAS11 00000000 N2BFAS11
@@ -668,8 +668,8 @@ OFFSET TYPE VALUE
RELOCATION RECORDS FOR [LEXECDYN]:
OFFSET TYPE VALUE
00000031 R_386_32 LEXEC025
00000081 R_386_32 LEXEC025
00000051 R_386_PC32 LEXEC020
00000095 R_386_32 LEXEC025
00000065 R_386_PC32 LEXEC020
RELOCATION RECORDS FOR [LEXEC025]:
OFFSET TYPE VALUE
+11 -11
View File
@@ -9,23 +9,23 @@ Linker script and memory map
TARGET(elf32-i386)
0x0000000000c01080 . = ((0xc01000 + SIZEOF_HEADERS) + 0xc)
.text 0x0000000000c01080 0x6dc
.text 0x0000000000c01080 0x6f8
*(.text)
.text 0x0000000000c01080 0x138 tmp/i386-linux.elf-fold.o
0x0000000000c01189 mmap
.text 0x0000000000c011b8 0x5a4 tmp/i386-linux.elf-main.o
0x0000000000c015e4 upx_main
.text 0x0000000000c01080 0x154 tmp/i386-linux.elf-fold.o
0x0000000000c011a5 mmap
.text 0x0000000000c011d4 0x5a4 tmp/i386-linux.elf-main.o
0x0000000000c01600 upx_main
*(.data)
.data 0x0000000000c0175c 0x0 tmp/i386-linux.elf-fold.o
.data 0x0000000000c0175c 0x0 tmp/i386-linux.elf-main.o
.data 0x0000000000c01778 0x0 tmp/i386-linux.elf-fold.o
.data 0x0000000000c01778 0x0 tmp/i386-linux.elf-main.o
.data
.bss 0x0000000000c0175c 0x0
.bss 0x0000000000c0175c 0x0 tmp/i386-linux.elf-fold.o
.bss 0x0000000000c0175c 0x0 tmp/i386-linux.elf-main.o
.bss 0x0000000000c01778 0x0
.bss 0x0000000000c01778 0x0 tmp/i386-linux.elf-fold.o
.bss 0x0000000000c01778 0x0 tmp/i386-linux.elf-main.o
.rel.dyn 0x0000000000c0175c 0x0
.rel.dyn 0x0000000000c01778 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