Fix size of 'imul'

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

	modified:   .github/travis_testsuite_1.sh
	modified:   src/stub/i386-linux.elf-fold.h
	modified:   src/stub/tmp/i386-linux.elf-fold.map
This commit is contained in:
John Reiser 2017-04-26 15:24:19 -07:00
parent 9be94e4b58
commit 24c924d668
5 changed files with 28 additions and 53 deletions

View File

@ -153,7 +153,7 @@ expected_sha256sums__t110_compress_ucl_nrv2b_3_no_filter="\
5b9ec916beae0eadc665235158a9ae5bce1309823a344503268a88e32e77824a *arm-wince.pe/upx-3.91.exe
18c154dd87227867cf6390038499393d454064af0668bf3451ef1e2e66290176 *armeb-linux.elf/upx-3.91
960dc15876221832510142816605b9ef568c0de3050ca0a79f3553643c5d5e0f *i386-dos32.djgpp2.coff/upx-3.91.exe
96b8ca17587795451b1c164222468a4052443c2360f7fd812e7a6dbdf7ac92c3 *i386-linux.elf/upx-3.91
43ec77282bbe73eb5d6f5471e9593127928bcfc2ebaedd93dd86969b12c9c61d *i386-linux.elf/upx-3.91
ca6925a15c1ab8931f0a8fe9ef87f5893403d6e46098f4cd1a5f6f6f0fbdeb44 *i386-win32.pe/upx-3.91.exe
14ff2a4e215a25ed7442b004bca3d82094f7c01784fc4876eb50d365441f35c3 *m68k-atari.tos/upx-3.91.ttp
4163afbb2475b669e131265c0f7ea179c35f19ccce66732feee08fe20c33775e *mipsel-linux.elf/upx-3.91
@ -164,7 +164,7 @@ expected_sha256sums__t120_compress_ucl_nrv2d_3_no_filter="\
22216286b1bf3066d9022b921f37beff6712b5f3fc8c092f2dc1477638d9f8cc *arm-wince.pe/upx-3.91.exe
f7338f71b4e7ed729aecf6c6e7704c39f4d5b274685c28b877247686357c776e *armeb-linux.elf/upx-3.91
b6e98d36bd916fa63ec799e47dd7cac3674154370a9680492d84f1853bf14c3e *i386-dos32.djgpp2.coff/upx-3.91.exe
870a1875388417751360dab13e45486e1ecb33583833ba33920d9b1668d72b76 *i386-linux.elf/upx-3.91
483e4a7eba0b88302658fcaacb7ee1de32fb514dac5dccb010a55a5202918c0c *i386-linux.elf/upx-3.91
d2692b3e4a278559456e299164714c4bb8ebbcf230ab12521619e2e94580597d *i386-win32.pe/upx-3.91.exe
cd1ae0f2781787bf7c61f3600cc889313e6027615d78e562d624d717671e55c3 *m68k-atari.tos/upx-3.91.ttp
26b30c10ba8980fa6fc564b79eb2931e07bb7b2f89f07a0656c28be71185a3ea *mipsel-linux.elf/upx-3.91
@ -175,7 +175,7 @@ expected_sha256sums__t130_compress_ucl_nrv2e_3_no_filter="\
08c55815175ce0d34fca3b368336dd346a2354dbe4f046210c82f6961350a50f *arm-wince.pe/upx-3.91.exe
b5f27af98d063473853ee28f6572c7438c167d80bcc2b89c30fb436cc5e79309 *armeb-linux.elf/upx-3.91
45f50d69e685f7ea752f76c05554d4c2ce023c0218465a4f8919138a76ae6c71 *i386-dos32.djgpp2.coff/upx-3.91.exe
2cde86ee89c67e5162a6065f0a7d76c852a9c366dbf8b61add07e14936bd7cf9 *i386-linux.elf/upx-3.91
f1db16f6be23b0bd96226e7e57f8b41ddfb93ede5ca0750ae680bbd615523083 *i386-linux.elf/upx-3.91
eb7c2f74979c11b35193a0a9d428596bda46420d9363666fe1b967f5cd1610c6 *i386-win32.pe/upx-3.91.exe
cefb13395220fb2e931d0fb32e27663c4a27035f9e79131bbabc44fa54e6336e *m68k-atari.tos/upx-3.91.ttp
602be188fca1dd63593a2ace68ea221d720fd2ddf9df85c1ab019feda69f1cad *mipsel-linux.elf/upx-3.91
@ -186,7 +186,7 @@ expected_sha256sums__t140_compress_lzma_2_no_filter="\
9759deb5aa8fb004c4b23bbe174042e45869aedeea1a1dd1b729be0e736814da *arm-wince.pe/upx-3.91.exe
c476387cb0f9a011f46e2c96bc0b481012cf6a3c6d4a4529c0630c1582cb4c4b *armeb-linux.elf/upx-3.91
a2a800d2ba5cfc1b6bb2b48c91adccb5d3c3b6c0b5c548affccac9244197a312 *i386-dos32.djgpp2.coff/upx-3.91.exe
aca3e8fbb23609a6210a05c5d2d41e37e6aa2de6a1e4d2a1819f423bbe6090ad *i386-linux.elf/upx-3.91
1865bc9b76579e33df4038f3d0abf848993b0c865b687f4b4bd482099416ef80 *i386-linux.elf/upx-3.91
80aba41aad8268085e853ec872f885981838a625c14095d21ba70cb7abe045a5 *i386-win32.pe/upx-3.91.exe
bbed61e42fa7b330b5cde66e4614329f41e21facff1f3667edc03495219c29f9 *m68k-atari.tos/upx-3.91.ttp
57b47244a3a0d01725cbdc9af8572cbe20e2d173857015ad4d32245b52577dc2 *mipsel-linux.elf/upx-3.91
@ -197,7 +197,7 @@ f41cfb7ceb0a760281ecb8bdd47c4635ccbb9134537e5e4a22b277d692146239 *amd64-linux.el
c7b0f611e9941be58b700219e7a5d34cdbdbf972b6184b13dec5e98fe84de808 *arm-wince.pe/upx-3.91.exe
4c6348cc3e99ba1f27dc8602b890ad7ff7e40351148470a7ed56dcbd112aad02 *armeb-linux.elf/upx-3.91
425c9128285f49b41f9b736f48794f5bebba6981250f669e5a342016b89f2170 *i386-dos32.djgpp2.coff/upx-3.91.exe
65fb2b8b9e7b9c4748f5e09276611b2e1e19a8cdca3a62289cad89b511418af1 *i386-linux.elf/upx-3.91
d6cb6d50dfda98ff8efbab2d2c8751adfb67df58652313c630d45db1b89e921e *i386-linux.elf/upx-3.91
5565f8196d971feec261dc663ca7ec329fd82b1b18ad49593b865edbaa15765d *i386-win32.pe/upx-3.91.exe
78f24d77855034d467568f05c22cb5e3abd167c90a4d89f4e2059c3e6faa3e2b *m68k-atari.tos/upx-3.91.ttp
23d6856df8f31b9176e0f4709135ce81656ed94539bf909e873b787ce89821cd *mipsel-linux.elf/upx-3.91
@ -208,7 +208,7 @@ a21f3829b1d78a0bb456f22035304b0b39d58e1aad782113af1de02786fd7c37 *amd64-linux.el
6b2333719a4fe6c8d2067f682d57cf6fc5fd928bffad4e61aaffcc31287772a7 *arm-wince.pe/upx-3.91.exe
e6c5e7ed8935980983ccce9871414e39fe06dbd0f94660d67dde447a1cd51aea *armeb-linux.elf/upx-3.91
d09af3652aa601650f9cd0f125d54e50dfe57b45b9871567140e62a04d032407 *i386-dos32.djgpp2.coff/upx-3.91.exe
30e86a1aefd2e63657cd77b9faab5cd32d24ac05b47d10da34cf2c95e60903cd *i386-linux.elf/upx-3.91
110bb3344a27b2677085e130956371df43ca6c231c01070480bb3a9e519fed30 *i386-linux.elf/upx-3.91
c3c8b428f7e57a528db89f1365b4f3fda60f0dc03eadb30775ecdbadaa19f0aa *i386-win32.pe/upx-3.91.exe
53c77efbccf41072c4c206343ba3c838be04c47eab415d18c08f086d481612db *m68k-atari.tos/upx-3.91.ttp
616cefa819c0e516c554faac20e6aaf9350a2aacf0041a2641d5809c0da220df *mipsel-linux.elf/upx-3.91
@ -219,7 +219,7 @@ expected_sha256sums__t170_compress_all_methods_no_lzma_5_no_filter="\
685b7e419b8b0fe3cabdf338a5cad17da55edc608c1bb91c13580b5988d38908 *arm-wince.pe/upx-3.91.exe
536b092822a86875b73ccc95f6685419c7903beb1e48a4afd872e243a7761830 *armeb-linux.elf/upx-3.91
fd0652470c19ebb4a2d1a49e02e71acf9fadab78e513bb4f75d1dc26a0caa7a3 *i386-dos32.djgpp2.coff/upx-3.91.exe
3addcdad5fb7812e3ce6593136667b2c265ad0ac57672ea3df873daf356533f9 *i386-linux.elf/upx-3.91
3b9dd7de613541f567b2573063399473deeaa015a1c3679fe0fb339d80724e0d *i386-linux.elf/upx-3.91
5b334db8debd2d59470cad25c7b45e38f6195cdafe92dc8281e4edc9c51385ef *i386-win32.pe/upx-3.91.exe
db1c6a70d990cb9a8e02db9b28054267658ce371b8a50e909efdd04cd3670279 *m68k-atari.tos/upx-3.91.ttp
19b801ace68ca0ff034dd557d3ef0a8340d8f17d7b97f120727f67ce098a7d7a *mipsel-linux.elf/upx-3.91

View File

@ -3610,19 +3610,6 @@ void PackLinuxElf32::pack4(OutputFile *fo, Filter &ft)
elfout.phdr[0].p_memsz = elfout.phdr[0].p_filesz;
super::pack4(fo, ft); // write PackHeader and overlay_offset
// rewrite Elf header
if (Elf32_Ehdr::ET_DYN==get_te16(&ehdri.e_type)) {
unsigned const base= get_te32(&elfout.phdr[0].p_vaddr);
set_te16(&elfout.ehdr.e_type, Elf32_Ehdr::ET_DYN);
set_te16(&elfout.ehdr.e_phnum, 1);
set_te32( &elfout.ehdr.e_entry,
get_te32(&elfout.ehdr.e_entry) - base);
set_te32(&elfout.phdr[0].p_vaddr, get_te32(&elfout.phdr[0].p_vaddr) - base);
set_te32(&elfout.phdr[0].p_paddr, get_te32(&elfout.phdr[0].p_paddr) - base);
// Strict SELinux (or PaX, grSecurity) disallows PF_W with PF_X
//elfout.phdr[0].p_flags |= Elf32_Phdr::PF_W;
}
fo->seek(0, SEEK_SET);
if (0!=xct_off) { // shared library
fo->rewrite(&ehdri, sizeof(ehdri));
@ -3741,19 +3728,6 @@ void PackLinuxElf64::pack4(OutputFile *fo, Filter &ft)
elfout.phdr[0].p_memsz = elfout.phdr[0].p_filesz;
super::pack4(fo, ft); // write PackHeader and overlay_offset
// rewrite Elf header
if (Elf64_Ehdr::ET_DYN==get_te16(&ehdri.e_type)) {
upx_uint64_t const base= get_te64(&elfout.phdr[0].p_vaddr);
set_te16(&elfout.ehdr.e_type, Elf64_Ehdr::ET_DYN);
set_te16(&elfout.ehdr.e_phnum, 1);
set_te64( &elfout.ehdr.e_entry,
get_te64(&elfout.ehdr.e_entry) - base);
set_te64(&elfout.phdr[0].p_vaddr, get_te64(&elfout.phdr[0].p_vaddr) - base);
set_te64(&elfout.phdr[0].p_paddr, get_te64(&elfout.phdr[0].p_paddr) - base);
// Strict SELinux (or PaX, grSecurity) disallows PF_W with PF_X
//elfout.phdr[0].p_flags |= Elf64_Phdr::PF_W;
}
fo->seek(0, SEEK_SET);
if (0!=xct_off) { // shared library
fo->rewrite(&ehdri, sizeof(ehdri));

View File

@ -32,8 +32,8 @@
#define STUB_I386_LINUX_ELF_FOLD_SIZE 1758
#define STUB_I386_LINUX_ELF_FOLD_ADLER32 0x63c7f6f3
#define STUB_I386_LINUX_ELF_FOLD_CRC32 0x572fb338
#define STUB_I386_LINUX_ELF_FOLD_ADLER32 0xb898f888
#define STUB_I386_LINUX_ELF_FOLD_CRC32 0xf0b90466
unsigned char stub_i386_linux_elf_fold[1758] = {
/* 0x0000 */ 127, 69, 76, 70, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
@ -45,23 +45,23 @@ unsigned char stub_i386_linux_elf_fold[1758] = {
/* 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 */ 185, 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,154,
/* 0x0090 */ 188, 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,157,
/* 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,129,236, 0, 10, 0, 0, 83,139, 83,
/* 0x00f0 */ 72,141,148, 26,255, 31, 0, 0,129,226, 0,240,255,255, 82, 41,
/* 0x0100 */ 192,102,131,123, 16, 3,117, 1,146, 80,107, 67, 44, 32,141, 68,
/* 0x0110 */ 24, 76,139, 24,139, 72, 4,131,193, 12,141, 84, 36, 12, 96, 71,
/* 0x0120 */ 232,113, 4, 0, 0,131,196, 36, 89, 91,129,196, 0, 10, 0, 0,
/* 0x0130 */ 90,193,226, 12, 1,211, 80, 79, 41,192, 60,175,175,117,252, 80,
/* 0x0140 */ 80, 80, 80, 80, 80, 80, 80, 41,217,176, 91,255, 39,173,171,173,
/* 0x0150 */ 171,173,171,173,171,173,171,133,192,117,250,135,223, 1,223,173,
/* 0x0160 */ 171,133,192,117,250, 87,173,171,131,248, 32,115, 3, 15,179,194,
/* 0x0170 */ 133,192,173,171,117,240,131,239, 8, 1,201, 64,243,171, 72,171,
/* 0x0180 */ 171,137,254, 95,195, 83,141, 92, 36, 8,106, 90, 88,205,128, 91,
/* 0x0190 */ 195, 0, 0, 0, 87, 86,137,206, 83,137,195, 57, 8,139,120, 4,
/* 0x0100 */ 192,102,131,123, 16, 3,117, 1,146, 80, 15,183, 67, 44,107,192,
/* 0x0110 */ 32,141, 68, 24, 76,139, 24,139, 72, 4,131,193, 12,141, 84, 36,
/* 0x0120 */ 12, 96, 71,232,110, 4, 0, 0,131,196, 36, 89, 91,129,196, 0,
/* 0x0130 */ 10, 0, 0, 90,193,226, 12, 1,211, 80, 79, 41,192, 60,175,175,
/* 0x0140 */ 117,252, 80, 80, 80, 80, 80, 80, 80, 80, 41,217,176, 91,255, 39,
/* 0x0150 */ 173,171,173,171,173,171,173,171,173,171,133,192,117,250,135,223,
/* 0x0160 */ 1,223,173,171,133,192,117,250, 87,173,171,131,248, 32,115, 3,
/* 0x0170 */ 15,179,194,133,192,173,171,117,240,131,239, 8, 1,201, 64,243,
/* 0x0180 */ 171, 72,171,171,137,254, 95,195, 83,141, 92, 36, 8,106, 90, 88,
/* 0x0190 */ 205,128, 91,195, 87, 86,137,206, 83,137,195, 57, 8,139,120, 4,
/* 0x01a0 */ 115, 10,106,127, 91,106, 1, 88,205,128,235,254,133,201,116, 8,
/* 0x01b0 */ 138, 7, 71,136, 2, 66,226,248, 1,115, 4, 41, 51, 91, 94, 95,
/* 0x01c0 */ 195, 85,137,229, 87, 86,137,198, 83,137,211,131,236, 24,139, 69,
@ -89,7 +89,7 @@ unsigned char stub_i386_linux_elf_fold[1758] = {
/* 0x0320 */ 3, 81, 20, 57,215,115, 2,137,215,131,193, 32, 75,117,227,129,
/* 0x0330 */ 230, 0,240,255,255, 41,247,137,242,141,159,255, 15, 0, 0,129,
/* 0x0340 */ 227, 0,240,255,255,133,192,117, 22,106, 0,131,200, 34,106,255,
/* 0x0350 */ 80,106, 0, 83, 86,232, 43,254,255,255,131,196, 24,137,194,141,
/* 0x0350 */ 80,106, 0, 83, 86,232, 46,254,255,255,131,196, 24,137,194,141,
/* 0x0360 */ 4, 26, 41,242,139,117,224,137, 85,200,137, 69,240,102,131,126,
/* 0x0370 */ 44, 0,199, 69,196, 0, 0, 0, 0, 15,132,221, 1, 0, 0,131,
/* 0x0380 */ 125,220, 0,116, 32,139, 69,204,131, 56, 6,117, 24,139, 77,200,
@ -100,11 +100,11 @@ unsigned char stub_i386_linux_elf_fold[1758] = {
/* 0x03d0 */ 232,131,225, 7,137, 69,236,137, 77,192,139, 78, 20,137,198, 1,
/* 0x03e0 */ 193,137, 77,188,137,193,129,225,255, 15, 0, 0, 41,206,131,125,
/* 0x03f0 */ 220, 0,141, 60, 10,116, 63,106, 0,139, 69,192,106,255,106, 50,
/* 0x0400 */ 131,200, 2, 80,141, 71, 3, 80, 86,232,119,253,255,255,131,196,
/* 0x0400 */ 131,200, 2, 80,141, 71, 3, 80, 86,232,122,253,255,255,131,196,
/* 0x0410 */ 24, 57,198, 15,133,221, 0, 0, 0,128,227, 4,139, 69,208,117,
/* 0x0420 */ 2, 49,192, 80,139, 69,220,255,117,228,141, 85,232,232,143,253,
/* 0x0430 */ 255,255, 88, 90,235, 35,139, 93,204,139, 67, 4, 41,200, 80,255,
/* 0x0440 */ 117,228,106, 18,255,117,192, 87, 86,232, 55,253,255,255,131,196,
/* 0x0440 */ 117,228,106, 18,255,117,192, 87, 86,232, 58,253,255,255,131,196,
/* 0x0450 */ 24, 57,198, 15,133,157, 0, 0, 0,137,248,247,216, 37,255, 15,
/* 0x0460 */ 0, 0,246, 69,192, 2,137, 69,184,116, 18,131,125,184, 0,141,
/* 0x0470 */ 4, 62,116, 9,139, 77,184,198, 0, 0, 64,226,250,131,125,220,
@ -117,7 +117,7 @@ unsigned char stub_i386_linux_elf_fold[1758] = {
/* 0x04e0 */ 254,232,187,253,255,255,137,243,137,249,139, 85,192,106,125, 88,
/* 0x04f0 */ 205,128,133,192,116, 10,106,127, 91,106, 1, 88,205,128,235,254,
/* 0x0500 */ 139, 85,184,141, 4, 23,141, 28, 6, 59, 93,188,115, 30,106, 0,
/* 0x0510 */ 106,255,106, 50,255,117,192, 41, 93,188,255,117,188, 83,232, 98,
/* 0x0510 */ 106,255,106, 50,255,117,192, 41, 93,188,255,117,188, 83,232,101,
/* 0x0520 */ 252,255,255,131,196, 24, 57,195,116, 27,235,202,131,125,220, 0,
/* 0x0530 */ 116, 19,141, 79, 3,129,225,255, 15, 0, 0,131,249, 3,119, 5,
/* 0x0540 */ 106, 91, 88,205,128,139, 77,224,255, 69,196, 15,183, 65, 44,131,

View File

@ -139,7 +139,8 @@ L55:
L53:
push eax // dynbase
imul eax,[e_phnum + ebx],szElf32_Phdr // sz_Phdrs
movzwl eax,[e_phnum + ebx]
imul eax,szElf32_Phdr // sz_Phdrs
lea eax, [szElf32_Ehdr + eax + szl_info + szp_info + ebx] // 1st &b_info
mov ebx, [ eax] // length of uncompressed ELF headers
mov ecx, [4+ eax] // length of compressed ELF headers

View File

@ -12,7 +12,7 @@ TARGET(elf32-i386)
.text 0x0000000000c01080 0x660
*(.text)
.text 0x0000000000c01080 0x114 tmp/i386-linux.elf-fold.o
0x0000000000c01185 mmap
0x0000000000c01188 mmap
.text 0x0000000000c01194 0x54a tmp/i386-linux.elf-main.o
0x0000000000c01596 upx_main
*(.data)