mirror of
https://github.com/upx/upx
synced 2025-09-28 19:06:07 +08:00
merge
This commit is contained in:
commit
b38cd0a48d
|
@ -1058,6 +1058,7 @@ PackOpenBSDElf32x86::generateElfHdr(
|
|||
set_native32(&h3->phdr[2].p_filesz, sizeof(elfnote));
|
||||
set_native32(&h3->phdr[2].p_memsz, sizeof(elfnote));
|
||||
set_native32(&h3->phdr[2].p_flags, Elf32_Phdr::PF_R);
|
||||
set_native32(&h3->phdr[2].p_align, 4);
|
||||
|
||||
set_native32(&elfnote.namesz, 8);
|
||||
set_native32(&elfnote.descsz, 4);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* i386-bsd.elf-fold.h -- created from i386-bsd.elf-fold.bin, 1714 (0x6b2) bytes
|
||||
/* i386-bsd.elf-fold.h -- created from i386-bsd.elf-fold.bin, 1746 (0x6d2) bytes
|
||||
|
||||
This file is part of the UPX executable compressor.
|
||||
|
||||
|
@ -27,26 +27,26 @@
|
|||
*/
|
||||
|
||||
|
||||
#define BSD_I386ELF_FOLD_SIZE 1714
|
||||
#define BSD_I386ELF_FOLD_ADLER32 0x01dafca5
|
||||
#define BSD_I386ELF_FOLD_CRC32 0x0c3241bd
|
||||
#define BSD_I386ELF_FOLD_SIZE 1746
|
||||
#define BSD_I386ELF_FOLD_ADLER32 0x7c430a03
|
||||
#define BSD_I386ELF_FOLD_CRC32 0x9c1dd61c
|
||||
|
||||
unsigned char bsd_i386elf_fold[1714] = {
|
||||
unsigned char bsd_i386elf_fold[1746] = {
|
||||
127, 69, 76, 70, 1, 1, 1, 9, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x 0 */
|
||||
2, 0, 3, 0, 1, 0, 0, 0,128, 16,192, 0, 52, 0, 0, 0, /* 0x 10 */
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 52, 0, 32, 0, 2, 0, 0, 0, /* 0x 20 */
|
||||
0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 16,192, 0, /* 0x 30 */
|
||||
0, 16,192, 0,178, 6, 0, 0,180, 6, 0, 0, 5, 0, 0, 0, /* 0x 40 */
|
||||
0, 16, 0, 0, 1, 0, 0, 0,178, 6, 0, 0, 0, 0, 0, 0, /* 0x 50 */
|
||||
0, 16,192, 0,210, 6, 0, 0,212, 6, 0, 0, 5, 0, 0, 0, /* 0x 40 */
|
||||
0, 16, 0, 0, 1, 0, 0, 0,210, 6, 0, 0, 0, 0, 0, 0, /* 0x 50 */
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x 60 */
|
||||
0, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x 70 */
|
||||
41,201,186,120, 2, 0, 0,137,230,137,231,232,131, 0, 0, 0, /* 0x 80 */
|
||||
41,201,186,248, 2, 0, 0,137,230,137,231,232,131, 0, 0, 0, /* 0x 80 */
|
||||
137,230,209,234, 25,192, 41,193,141, 36,196,133,210,117,243,137, /* 0x 90 */
|
||||
231,232,109, 0, 0, 0,129,236, 0, 10, 0, 0, 83,139, 83, 72, /* 0x a0 */
|
||||
141,148, 26,255, 31, 0, 0,129,226, 0,240,255,255, 82, 41,192, /* 0x b0 */
|
||||
102,131,123, 16, 3,117, 1,146, 80,139,115, 24,141,131,140, 0, /* 0x c0 */
|
||||
0, 0, 41,198,139, 24,139, 72, 4,131,193, 12,141, 84, 36, 12, /* 0x d0 */
|
||||
96, 71,232,169, 4, 0, 0,131,196, 36, 89, 91,129,196, 0, 10, /* 0x e0 */
|
||||
96, 71,232,179, 4, 0, 0,131,196, 36, 89, 91,129,196, 0, 10, /* 0x e0 */
|
||||
0, 0, 80,106, 0,137,229, 41,217, 41,192, 81, 83, 80, 79, 60, /* 0x f0 */
|
||||
175,175,117,252,255, 55, 49,255, 49,246, 49,210, 49,201, 49,219, /* 0x 100 */
|
||||
176, 73,195,173,171,133,192,117,250,173,171,133,192,117,250, 87, /* 0x 110 */
|
||||
|
@ -86,58 +86,60 @@ unsigned char bsd_i386elf_fold[1714] = {
|
|||
240,255,255, 80, 41,222,106, 0,129,198,255, 15, 0, 0,129,230, /* 0x 330 */
|
||||
0,240,255,255, 86, 83,232,242,253,255,255,131,196, 24,141, 52, /* 0x 340 */
|
||||
48, 41,216,137, 69,208,139, 69,224,137,117,240,102,131,120, 44, /* 0x 350 */
|
||||
0,199, 69,200, 0, 0, 0, 0, 15,132,216, 1, 0, 0,139, 7, /* 0x 360 */
|
||||
131,248, 6,117, 24,139, 77,208,186, 3, 0, 0, 0, 3, 79, 8, /* 0x 370 */
|
||||
139, 69,216,232, 10,255,255,255,233,163, 1, 0, 0, 72, 15,133, /* 0x 380 */
|
||||
156, 1, 0, 0,139, 69,208,199, 69,196, 64, 98, 81,115, 3, 71, /* 0x 390 */
|
||||
8,139, 87, 20,139, 79, 24, 1,194,137, 69,236,137, 85,188,137, /* 0x 3a0 */
|
||||
194,129,226,255, 15, 0, 0,131,225, 7, 41,208,193,225, 2,137, /* 0x 3b0 */
|
||||
69,192,139, 71, 4,211,109,196, 41,208,131,101,196, 7,131,125, /* 0x 3c0 */
|
||||
220, 0,139, 79, 16, 80,139, 69,228,137, 77,232,141, 52, 17,116, /* 0x 3d0 */
|
||||
3,131,200,255,131,125,220, 1, 80, 25,192, 37, 0,240,255,255, /* 0x 3e0 */
|
||||
5, 18, 16, 0, 0,131,125,220, 0, 80,139, 69,196,116, 3,131, /* 0x 3f0 */
|
||||
200, 2,131,125,220, 0, 80,137,240,116, 3,141, 70, 3, 80,255, /* 0x 400 */
|
||||
117,192,232, 38,253,255,255,131,196, 24, 57, 69,192, 15,133,185, /* 0x 410 */
|
||||
0, 0, 0,131,125,220, 0,116, 28,246, 69,196, 4,139, 69,212, /* 0x 420 */
|
||||
117, 2, 49,192, 80,139, 69,220,255,117,228,141, 85,232,232,114, /* 0x 430 */
|
||||
253,255,255, 88, 90,137,240,247,216, 37,255, 15, 0, 0,246, 69, /* 0x 440 */
|
||||
196, 2,137, 69,184,116, 20,139, 69,192, 1,240,131,125,184, 0, /* 0x 450 */
|
||||
116, 9,139, 77,184,198, 0, 0, 64,226,250,131,125,220, 0,116, /* 0x 460 */
|
||||
114,131, 63, 1,117, 83,246, 71, 24, 1,116, 77,139, 87, 20,139, /* 0x 470 */
|
||||
95, 8,141, 12, 26, 3, 77,208, 59, 87, 16,117, 14,137,200,247, /* 0x 480 */
|
||||
216, 37,255, 15, 0, 0,131,248, 3,119, 14,107, 69,208, 52,131, /* 0x 490 */
|
||||
127, 4, 0,141, 76, 3, 12,117, 15,139, 1, 61,205,128,201,195, /* 0x 4a0 */
|
||||
116, 6,199, 1,205,128,201,195,133,201,116, 13,139, 69,216, 49, /* 0x 4b0 */
|
||||
210,131,224,254,232,201,253,255,255,255,117,196, 86,255,117,192, /* 0x 4c0 */
|
||||
232,169,252,255,255,131,196, 12,133,192,116, 7,106,127,232,127, /* 0x 4d0 */
|
||||
252,255,255,139, 85,184,139, 93,192,141, 4, 22, 1,195, 59, 93, /* 0x 4e0 */
|
||||
188,115, 33,106, 0,106,255,104, 18, 16, 0, 0,255,117,196, 41, /* 0x 4f0 */
|
||||
93,188,255,117,188, 83,232, 50,252,255,255,131,196, 24, 57,195, /* 0x 500 */
|
||||
116, 30,235,200,131,125,220, 0,116, 22,141, 70, 3, 37,255, 15, /* 0x 510 */
|
||||
0, 0,131,248, 3,119, 9, 80, 83,232, 76,252,255,255, 89, 91, /* 0x 520 */
|
||||
139, 85,224,131,199, 32,255, 69,200, 15,183, 66, 44, 57, 69,200, /* 0x 530 */
|
||||
15,140, 40,254,255,255,131,125,220, 0,117, 15,255,117,228,232, /* 0x 540 */
|
||||
34,252,255,255, 90,133,192,116, 21,235,129,139, 69,224,102,131, /* 0x 550 */
|
||||
120, 16, 3,116, 9,255,117,240,232,244,251,255,255, 88,131,125, /* 0x 560 */
|
||||
16, 0,116, 8,139, 69,208,139, 85, 16,137, 2,139, 85,224,139, /* 0x 570 */
|
||||
82, 24, 1, 85,208,139, 69,208,141,101,244, 91, 94, 95,201,195, /* 0x 580 */
|
||||
85,137,229, 87, 86, 83,131,236, 16,139,125, 16,106, 0,139, 69, /* 0x 590 */
|
||||
28,141, 87, 2,139,117, 8,137, 69,232,131,192, 52,137, 69,228, /* 0x 5a0 */
|
||||
139, 93, 32,137, 85,236,141, 69, 32,141, 85, 24, 87,232,243,251, /* 0x 5b0 */
|
||||
255,255,139, 69, 12,186, 5, 0, 0, 0, 41, 93, 36,137, 69, 32, /* 0x 5c0 */
|
||||
139, 69,232, 15,183, 72, 44,137,240,232,180,252,255,255,139, 85, /* 0x 5d0 */
|
||||
232,137,240, 15,183, 74, 42,186, 4, 0, 0, 0,232,161,252,255, /* 0x 5e0 */
|
||||
255,139, 69,228,139, 77, 40,186, 3, 0, 0, 0, 3, 72, 8,137, /* 0x 5f0 */
|
||||
240,131,193, 52,232,137,252,255,255,141, 69,240,255,117,236, 80, /* 0x 600 */
|
||||
139, 85,232,141, 69, 32, 86, 80,137,248,232,153,252,255,255,186, /* 0x 610 */
|
||||
9, 0, 0, 0,137,193,137,195,137,240,232, 99,252,255,255,139, /* 0x 620 */
|
||||
85,232,131,196, 24,102,139, 74, 44, 49,210,102,133,201,116,104, /* 0x 630 */
|
||||
139, 69,228,131, 56, 3,117, 84,106, 0,139, 85,228,106, 0,139, /* 0x 640 */
|
||||
69,240, 3, 66, 8, 80,232, 23,251,255,255,131,196, 12,133,192, /* 0x 650 */
|
||||
137,195,120, 24,104, 0, 2, 0, 0,255,117,232, 80,232,248,250, /* 0x 660 */
|
||||
255,255,131,196, 12, 61, 0, 2, 0, 0,116, 7,106,127,232,223, /* 0x 670 */
|
||||
250,255,255,106, 0,139, 85,232,106, 0,137,216,106, 0,106, 0, /* 0x 680 */
|
||||
232, 35,252,255,255,131,196, 16,137,195,235, 12, 66, 15,183,193, /* 0x 690 */
|
||||
131, 69,228, 32, 57,194,124,152,141,101,244,137,216, 91, 94, 95, /* 0x 6a0 */
|
||||
201,195 /* 0x 6b0 */
|
||||
0,199, 69,200, 0, 0, 0, 0, 15,132,226, 1, 0, 0,139, 7, /* 0x 360 */
|
||||
131,248, 6,117, 34,131,125,220, 0, 15,132,187, 1, 0, 0,139, /* 0x 370 */
|
||||
77,208,186, 3, 0, 0, 0, 3, 79, 8,139, 69,216,232, 0,255, /* 0x 380 */
|
||||
255,255,233,163, 1, 0, 0, 72, 15,133,156, 1, 0, 0,139, 69, /* 0x 390 */
|
||||
208,199, 69,196, 64, 98, 81,115, 3, 71, 8,139, 87, 20,139, 79, /* 0x 3a0 */
|
||||
24, 1,194,137, 69,236,137, 85,188,137,194,129,226,255, 15, 0, /* 0x 3b0 */
|
||||
0,131,225, 7, 41,208,193,225, 2,137, 69,192,139, 71, 4,211, /* 0x 3c0 */
|
||||
109,196, 41,208,131,101,196, 7,131,125,220, 0,139, 79, 16, 80, /* 0x 3d0 */
|
||||
139, 69,228,137, 77,232,141, 52, 17,116, 3,131,200,255,131,125, /* 0x 3e0 */
|
||||
220, 1, 80, 25,192, 37, 0,240,255,255, 5, 18, 16, 0, 0,131, /* 0x 3f0 */
|
||||
125,220, 0, 80,139, 69,196,116, 3,131,200, 2,131,125,220, 0, /* 0x 400 */
|
||||
80,137,240,116, 3,141, 70, 3, 80,255,117,192,232, 28,253,255, /* 0x 410 */
|
||||
255,131,196, 24, 57, 69,192, 15,133,185, 0, 0, 0,131,125,220, /* 0x 420 */
|
||||
0,116, 28,246, 69,196, 4,139, 69,212,117, 2, 49,192, 80,139, /* 0x 430 */
|
||||
69,220,255,117,228,141, 85,232,232,104,253,255,255, 88, 90,137, /* 0x 440 */
|
||||
240,247,216, 37,255, 15, 0, 0,246, 69,196, 2,137, 69,184,116, /* 0x 450 */
|
||||
20,139, 69,192, 1,240,131,125,184, 0,116, 9,139, 77,184,198, /* 0x 460 */
|
||||
0, 0, 64,226,250,131,125,220, 0,116,114,131, 63, 1,117, 83, /* 0x 470 */
|
||||
246, 71, 24, 1,116, 77,139, 87, 20,139, 95, 8,141, 12, 26, 3, /* 0x 480 */
|
||||
77,208, 59, 87, 16,117, 14,137,200,247,216, 37,255, 15, 0, 0, /* 0x 490 */
|
||||
131,248, 3,119, 14,107, 69,208, 52,131,127, 4, 0,141, 76, 3, /* 0x 4a0 */
|
||||
12,117, 15,139, 1, 61,205,128,201,195,116, 6,199, 1,205,128, /* 0x 4b0 */
|
||||
201,195,133,201,116, 13,139, 69,216, 49,210,131,224,254,232,191, /* 0x 4c0 */
|
||||
253,255,255,255,117,196, 86,255,117,192,232,159,252,255,255,131, /* 0x 4d0 */
|
||||
196, 12,133,192,116, 7,106,127,232,117,252,255,255,139, 85,184, /* 0x 4e0 */
|
||||
139, 93,192,141, 4, 22, 1,195, 59, 93,188,115, 33,106, 0,106, /* 0x 4f0 */
|
||||
255,104, 18, 16, 0, 0,255,117,196, 41, 93,188,255,117,188, 83, /* 0x 500 */
|
||||
232, 40,252,255,255,131,196, 24, 57,195,116, 30,235,200,131,125, /* 0x 510 */
|
||||
220, 0,116, 22,141, 70, 3, 37,255, 15, 0, 0,131,248, 3,119, /* 0x 520 */
|
||||
9, 80, 83,232, 66,252,255,255, 89, 91,139, 85,224,131,199, 32, /* 0x 530 */
|
||||
255, 69,200, 15,183, 66, 44, 57, 69,200, 15,140, 30,254,255,255, /* 0x 540 */
|
||||
131,125,220, 0,117, 15,255,117,228,232, 24,252,255,255, 90,133, /* 0x 550 */
|
||||
192,116, 21,235,129,139, 69,224,102,131,120, 16, 3,116, 9,255, /* 0x 560 */
|
||||
117,240,232,234,251,255,255, 88,131,125, 16, 0,116, 8,139, 69, /* 0x 570 */
|
||||
208,139, 85, 16,137, 2,139, 85,224,139, 82, 24, 1, 85,208,139, /* 0x 580 */
|
||||
69,208,141,101,244, 91, 94, 95,201,195, 85,137,229, 87, 86, 83, /* 0x 590 */
|
||||
131,236, 16,141, 85, 24,139, 69, 8,106, 0,139,125, 28,137, 69, /* 0x 5a0 */
|
||||
236,139, 69, 16,139, 93, 32,141,119, 52,137, 69,232,131,192, 2, /* 0x 5b0 */
|
||||
255,117,232,137, 69,228,141, 69, 32,232,231,251,255,255,139, 69, /* 0x 5c0 */
|
||||
12,185, 0, 16, 0, 0,186, 6, 0, 0, 0,137, 69, 32,139, 69, /* 0x 5d0 */
|
||||
236, 41, 93, 36,232,169,252,255,255, 15,183, 79, 44,139, 69,236, /* 0x 5e0 */
|
||||
186, 5, 0, 0, 0,232,152,252,255,255, 15,183, 79, 42,139, 69, /* 0x 5f0 */
|
||||
236,186, 4, 0, 0, 0,232,135,252,255,255,139, 77, 40, 3, 78, /* 0x 600 */
|
||||
8,186, 3, 0, 0, 0,139, 69,236,131,193, 52,232,113,252,255, /* 0x 610 */
|
||||
255,141, 69,240,255,117,228,137,250, 80,141, 69, 32,255,117,236, /* 0x 620 */
|
||||
80,139, 69,232,232,127,252,255,255,186, 9, 0, 0, 0,137,193, /* 0x 630 */
|
||||
137,195,139, 69,236,232, 72,252,255,255,102,139, 79, 44,131,196, /* 0x 640 */
|
||||
24, 49,210,102,133,201,116,112,131, 62, 3,117, 96,106, 0,139, /* 0x 650 */
|
||||
69,240,106, 0, 3, 70, 8, 80,232, 5,251,255,255,131,196, 12, /* 0x 660 */
|
||||
133,192,137,195,120, 22,104, 0, 2, 0, 0, 87, 80,232,232,250, /* 0x 670 */
|
||||
255,255,131,196, 12, 61, 0, 2, 0, 0,116, 7,106,127,232,207, /* 0x 680 */
|
||||
250,255,255,141, 69,240,137,250,106, 0, 80,137,216,106, 0,106, /* 0x 690 */
|
||||
0,232, 18,252,255,255,139, 77,240,137,195,139, 69,236,186, 7, /* 0x 6a0 */
|
||||
0, 0, 0,232,218,251,255,255,131,196, 16,235, 11, 66, 15,183, /* 0x 6b0 */
|
||||
193,131,198, 32, 57,194,124,144,141,101,244,137,216, 91, 94, 95, /* 0x 6c0 */
|
||||
201,195 /* 0x 6d0 */
|
||||
};
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* i386-openbsd.elf-fold.h -- created from i386-openbsd.elf-fold.bin, 1708 (0x6ac) bytes
|
||||
/* i386-openbsd.elf-fold.h -- created from i386-openbsd.elf-fold.bin, 1981 (0x7bd) bytes
|
||||
|
||||
This file is part of the UPX executable compressor.
|
||||
|
||||
|
@ -27,26 +27,26 @@
|
|||
*/
|
||||
|
||||
|
||||
#define OPENBSD_I386ELF_FOLD_SIZE 1708
|
||||
#define OPENBSD_I386ELF_FOLD_ADLER32 0xdb47f801
|
||||
#define OPENBSD_I386ELF_FOLD_CRC32 0x8617eefa
|
||||
#define OPENBSD_I386ELF_FOLD_SIZE 1981
|
||||
#define OPENBSD_I386ELF_FOLD_ADLER32 0x345765c5
|
||||
#define OPENBSD_I386ELF_FOLD_CRC32 0x455b252f
|
||||
|
||||
unsigned char openbsd_i386elf_fold[1708] = {
|
||||
unsigned char openbsd_i386elf_fold[1981] = {
|
||||
127, 69, 76, 70, 1, 1, 1, 12, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x 0 */
|
||||
2, 0, 3, 0, 1, 0, 0, 0,128, 16,192, 0, 52, 0, 0, 0, /* 0x 10 */
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 52, 0, 32, 0, 2, 0, 0, 0, /* 0x 20 */
|
||||
0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 16,192, 0, /* 0x 30 */
|
||||
0, 16,192, 0,172, 6, 0, 0,172, 6, 0, 0, 5, 0, 0, 0, /* 0x 40 */
|
||||
0, 16, 0, 0, 1, 0, 0, 0,172, 6, 0, 0, 0, 0, 0, 0, /* 0x 50 */
|
||||
0, 16,192, 0,189, 7, 0, 0,192, 7, 0, 0, 5, 0, 0, 0, /* 0x 40 */
|
||||
0, 16, 0, 0, 1, 0, 0, 0,189, 7, 0, 0, 0, 0, 0, 0, /* 0x 50 */
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x 60 */
|
||||
0, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x 70 */
|
||||
41,201,186,120, 2, 0, 0,137,230,137,231,232,131, 0, 0, 0, /* 0x 80 */
|
||||
41,201,186,248, 2, 0, 0,137,230,137,231,232,131, 0, 0, 0, /* 0x 80 */
|
||||
137,230,209,234, 25,192, 41,193,141, 36,196,133,210,117,243,137, /* 0x 90 */
|
||||
231,232,109, 0, 0, 0,129,236, 0, 10, 0, 0, 83,139, 83, 72, /* 0x a0 */
|
||||
141,148, 26,255, 31, 0, 0,129,226, 0,240,255,255, 82, 41,192, /* 0x b0 */
|
||||
102,131,123, 16, 3,117, 1,146, 80,139,115, 24,141,131,196, 0, /* 0x c0 */
|
||||
0, 0, 41,198,139, 24,139, 72, 4,131,193, 12,141, 84, 36, 12, /* 0x d0 */
|
||||
96, 71,232,163, 4, 0, 0,131,196, 36, 89, 91,129,196, 0, 10, /* 0x e0 */
|
||||
96, 71,232,136, 5, 0, 0,131,196, 36, 89, 91,129,196, 0, 10, /* 0x e0 */
|
||||
0, 0, 80,106, 0,137,229, 41,217, 41,192, 81, 83, 80, 79, 60, /* 0x f0 */
|
||||
175,175,117,252,255, 55, 49,255, 49,246, 49,210, 49,201, 49,219, /* 0x 100 */
|
||||
176, 73,195,173,171,133,192,117,250,173,171,133,192,117,250, 87, /* 0x 110 */
|
||||
|
@ -54,17 +54,17 @@ unsigned char openbsd_i386elf_fold[1708] = {
|
|||
131,239, 8, 1,201, 64,243,171, 72,171,171, 95,195, 85,137,229, /* 0x 130 */
|
||||
49,192, 80,255,117, 28, 80,255,117, 24,255,117, 20,255,117, 16, /* 0x 140 */
|
||||
255,117, 12,255,117, 8, 80,176,197, 80, 80,176,198,205,128,201, /* 0x 150 */
|
||||
195,195,176, 1, 15,182,192,205,128,195,176, 3,235,246,176, 4, /* 0x 160 */
|
||||
235,242,176, 5,235,238,176, 6,235,234,176, 73,235,230,176, 74, /* 0x 170 */
|
||||
235,226, 0, 0, 85,137,229, 87, 86,137,206, 83,137,195, 57, 8, /* 0x 180 */
|
||||
139,120, 4,115, 7,106,127,232,198,255,255,255,133,201,116, 8, /* 0x 190 */
|
||||
195,195,204,195,176, 1, 15,182,192,205,128,195,176, 3,235,246, /* 0x 160 */
|
||||
176, 4,235,242,176, 5,235,238,176, 6,235,234,176, 73,235,230, /* 0x 170 */
|
||||
176, 74,235,226, 85,137,229, 87, 86,137,206, 83,137,195, 57, 8, /* 0x 180 */
|
||||
139,120, 4,115, 7,106,127,232,200,255,255,255,133,201,116, 8, /* 0x 190 */
|
||||
138, 7, 71,136, 2, 66,226,248, 1,115, 4, 41, 51,141,101,244, /* 0x 1a0 */
|
||||
91, 94, 95,201,195, 85,137,229, 87, 86,137,198, 83,137,211,131, /* 0x 1b0 */
|
||||
236, 24,139, 69, 8,139,125, 12,137, 69,220,131, 58, 0, 15,132, /* 0x 1c0 */
|
||||
182, 0, 0, 0,141, 85,228,185, 12, 0, 0, 0,137,240,232,161, /* 0x 1d0 */
|
||||
255,255,255,139, 69,228,139, 77,232,133,192,117, 19,129,249, 85, /* 0x 1e0 */
|
||||
80, 88, 33,117, 15,131, 62, 0, 15,132,140, 0, 0, 0,235, 4, /* 0x 1f0 */
|
||||
133,201,117, 7,106,127,232, 87,255,255,255, 57,193,119,245, 59, /* 0x 200 */
|
||||
133,201,117, 7,106,127,232, 89,255,255,255, 57,193,119,245, 59, /* 0x 200 */
|
||||
3,119,241, 57,193,115, 86,137, 69,224,141, 69,224,255,117,236, /* 0x 210 */
|
||||
80,255,115, 4, 81,255,118, 4,255, 85,220,131,196, 20,133,192, /* 0x 220 */
|
||||
117,210,139, 85,224, 59, 85,228,117,202,138, 69,237,132,192,116, /* 0x 230 */
|
||||
|
@ -76,67 +76,84 @@ unsigned char openbsd_i386elf_fold[1708] = {
|
|||
201,195,133,192, 83,137,211,116, 29,168, 1,117, 25,139, 16, 57, /* 0x 290 */
|
||||
218,116, 7, 74,117, 11,133,219,116, 7,137, 24,137, 72, 4,235, /* 0x 2a0 */
|
||||
5,131,192, 8,235,231, 91,195, 85,137,229, 87, 86, 83,131,236, /* 0x 2b0 */
|
||||
56,137, 85,224,139, 85, 12,137, 69,228,139,125,224,199, 69,208, /* 0x 2c0 */
|
||||
0, 0, 0, 0,137, 85,216,139, 85,224,139, 69, 8, 3,127, 28, /* 0x 2d0 */
|
||||
102,131,122, 16, 2,137, 69,220,139, 69, 20,137, 69,212,116, 99, /* 0x 2e0 */
|
||||
139, 69,224,131,203,255, 49,246,137,250, 15,183, 72, 44,137,200, /* 0x 2f0 */
|
||||
72,120, 28,131, 58, 1,117, 18,139, 66, 8, 57,216,115, 2,137, /* 0x 300 */
|
||||
195, 3, 66, 20, 57,198,115, 2,137,198,131,194, 32,226,228,106, /* 0x 310 */
|
||||
0,129,227, 0,240,255,255,106,255, 41,222,104, 2, 16, 0, 0, /* 0x 320 */
|
||||
129,198,255, 15, 0, 0,106, 0,129,230, 0,240,255,255, 86, 83, /* 0x 330 */
|
||||
232,248,253,255,255,131,196, 24,141, 52, 48, 41,216,137, 69,208, /* 0x 340 */
|
||||
137,117,240,139, 85,224,199, 69,204, 0, 0, 0, 0,102,131,122, /* 0x 350 */
|
||||
44, 0, 15,132,216, 1, 0, 0,139, 7,131,248, 6,117, 24,139, /* 0x 360 */
|
||||
77,208,186, 3, 0, 0, 0, 3, 79, 8,139, 69,216,232, 16,255, /* 0x 370 */
|
||||
255,255,233,163, 1, 0, 0, 72, 15,133,156, 1, 0, 0,139, 69, /* 0x 380 */
|
||||
208,199, 69,200, 64, 98, 81,115, 3, 71, 8,139, 87, 20,139, 79, /* 0x 390 */
|
||||
24, 1,194,137, 69,236,137, 85,192,137,194,129,226,255, 15, 0, /* 0x 3a0 */
|
||||
0,131,225, 7, 41,208,193,225, 2,137, 69,196,139, 71, 4,211, /* 0x 3b0 */
|
||||
109,200, 41,208,131,101,200, 7,131,125,220, 0,139, 79, 16, 80, /* 0x 3c0 */
|
||||
139, 69,228,137, 77,232,141, 52, 17,116, 3,131,200,255,131,125, /* 0x 3d0 */
|
||||
220, 1, 80, 25,192, 37, 0,240,255,255, 5, 18, 16, 0, 0,131, /* 0x 3e0 */
|
||||
125,220, 0, 80,139, 69,200,116, 3,131,200, 2,131,125,220, 0, /* 0x 3f0 */
|
||||
80,137,240,116, 3,141, 70, 3, 80,255,117,196,232, 44,253,255, /* 0x 400 */
|
||||
255,131,196, 24, 57, 69,196, 15,133,185, 0, 0, 0,131,125,220, /* 0x 410 */
|
||||
0,116, 28,246, 69,200, 4,139, 69,212,117, 2, 49,192, 80,139, /* 0x 420 */
|
||||
69,220,255,117,228,141, 85,232,232,120,253,255,255, 88, 90,137, /* 0x 430 */
|
||||
240,247,216, 37,255, 15, 0, 0,246, 69,200, 2,137, 69,188,116, /* 0x 440 */
|
||||
20,139, 69,196, 1,240,131,125,188, 0,116, 9,139, 77,188,198, /* 0x 450 */
|
||||
0, 0, 64,226,250,131,125,220, 0,116,114,131, 63, 1,117, 83, /* 0x 460 */
|
||||
246, 71, 24, 1,116, 77,139, 87, 20,139, 95, 8,141, 12, 26, 3, /* 0x 470 */
|
||||
77,208, 59, 87, 16,117, 14,137,200,247,216, 37,255, 15, 0, 0, /* 0x 480 */
|
||||
131,248, 3,119, 14,107, 69,208, 52,131,127, 4, 0,141, 76, 3, /* 0x 490 */
|
||||
12,117, 15,139, 1, 61,205,128,201,195,116, 6,199, 1,205,128, /* 0x 4a0 */
|
||||
201,195,133,201,116, 13,139, 69,216, 49,210,131,224,254,232,207, /* 0x 4b0 */
|
||||
253,255,255,255,117,200, 86,255,117,196,232,175,252,255,255,131, /* 0x 4c0 */
|
||||
196, 12,133,192,116, 7,106,127,232,133,252,255,255,139, 85,188, /* 0x 4d0 */
|
||||
139, 93,196,141, 4, 22, 1,195, 59, 93,192,115, 33,106, 0,106, /* 0x 4e0 */
|
||||
255,104, 18, 16, 0, 0,255,117,200, 41, 93,192,255,117,192, 83, /* 0x 4f0 */
|
||||
232, 56,252,255,255,131,196, 24, 57,195,116, 30,235,200,131,125, /* 0x 500 */
|
||||
220, 0,116, 22,141, 70, 3, 37,255, 15, 0, 0,131,248, 3,119, /* 0x 510 */
|
||||
9, 80, 83,232, 82,252,255,255, 89, 91,139, 85,224,131,199, 32, /* 0x 520 */
|
||||
255, 69,204, 15,183, 66, 44, 57, 69,204, 15,140, 40,254,255,255, /* 0x 530 */
|
||||
131,125,220, 0,117, 15,255,117,228,232, 40,252,255,255, 90,133, /* 0x 540 */
|
||||
192,116, 21,235,129,139, 69,224,102,131,120, 16, 3,116, 9,255, /* 0x 550 */
|
||||
117,240,232,250,251,255,255, 88,131,125, 16, 0,116, 8,139, 69, /* 0x 560 */
|
||||
208,139, 85, 16,137, 2,139, 85,224,139, 82, 24, 1, 85,208,139, /* 0x 570 */
|
||||
69,208,141,101,244, 91, 94, 95,201,195, 85,137,229, 87, 86, 83, /* 0x 580 */
|
||||
131,236, 16,139,125, 16,106, 0,139, 69, 28,141, 87, 2,139,117, /* 0x 590 */
|
||||
8,137, 69,232,131,192, 52,137, 69,228,139, 93, 32,137, 85,236, /* 0x 5a0 */
|
||||
141, 69, 32,141, 85, 24, 87,232,249,251,255,255,139, 69, 12,186, /* 0x 5b0 */
|
||||
5, 0, 0, 0, 41, 93, 36,137, 69, 32,139, 69,232, 15,183, 72, /* 0x 5c0 */
|
||||
44,137,240,232,186,252,255,255,139, 85,232,137,240, 15,183, 74, /* 0x 5d0 */
|
||||
42,186, 4, 0, 0, 0,232,167,252,255,255,139, 69,228,139, 77, /* 0x 5e0 */
|
||||
40,186, 3, 0, 0, 0, 3, 72, 8,137,240,131,193, 52,232,143, /* 0x 5f0 */
|
||||
252,255,255,141, 69,240,255,117,236, 80,139, 85,232,141, 69, 32, /* 0x 600 */
|
||||
86, 80,137,248,232,159,252,255,255,186, 9, 0, 0, 0,137,193, /* 0x 610 */
|
||||
137,195,137,240,232,105,252,255,255,139, 85,232,131,196, 24,102, /* 0x 620 */
|
||||
139, 74, 44, 49,210,102,133,201,116,104,139, 69,228,131, 56, 3, /* 0x 630 */
|
||||
117, 84,106, 0,139, 85,228,106, 0,139, 69,240, 3, 66, 8, 80, /* 0x 640 */
|
||||
232, 29,251,255,255,131,196, 12,133,192,137,195,120, 24,104, 0, /* 0x 650 */
|
||||
2, 0, 0,255,117,232, 80,232,254,250,255,255,131,196, 12, 61, /* 0x 660 */
|
||||
0, 2, 0, 0,116, 7,106,127,232,229,250,255,255,106, 0,139, /* 0x 670 */
|
||||
85,232,106, 0,137,216,106, 0,106, 0,232, 41,252,255,255,131, /* 0x 680 */
|
||||
196, 16,137,195,235, 12, 66, 15,183,193,131, 69,228, 32, 57,194, /* 0x 690 */
|
||||
124,152,141,101,244,137,216, 91, 94, 95,201,195 /* 0x 6a0 */
|
||||
104,137, 69,200,139, 69, 12,137, 85,196,139, 77, 24,199, 69,228, /* 0x 2c0 */
|
||||
0, 0, 0, 0,137, 69,192,139, 69,196,137, 77,184,139, 93,196, /* 0x 2d0 */
|
||||
139,117,196,199, 69,232, 0, 0, 0, 0, 15,183, 72, 44,199, 69, /* 0x 2e0 */
|
||||
220, 0, 0, 0, 0,139, 85, 16,199, 69,224, 0, 0, 0, 0, 3, /* 0x 2f0 */
|
||||
91, 28,199, 69,236,255,255,255,255, 15,183,118, 16,137, 85,188, /* 0x 300 */
|
||||
137,202,199, 69,240,255,255,255,255, 74,137, 93,180,137,117,176, /* 0x 310 */
|
||||
199, 69,148, 0, 0, 0, 0,120, 62,137,206,131, 59, 1,117, 49, /* 0x 320 */
|
||||
139, 67, 24,139, 75, 8,131,224, 1,141, 20,133, 0, 0, 0, 0, /* 0x 330 */
|
||||
57, 76, 42,236,118, 11,139, 67, 16,137, 76, 42,236,137, 68, 21, /* 0x 340 */
|
||||
228,139, 67, 20,141,125,220, 1,200, 57, 4, 58,115, 3,137, 4, /* 0x 350 */
|
||||
58,131,195, 32, 78,117,196,131,125,176, 2,116, 63,129,125,220, /* 0x 360 */
|
||||
255,255,255, 31,118, 54,139, 77, 8,139, 93, 8,139, 65, 4,137, /* 0x 370 */
|
||||
194,137,193,139, 3,129,225,255,255,255, 3,129,226, 0, 0, 0, /* 0x 380 */
|
||||
252, 37,255,255,255, 3, 57,193,118, 2,137,200,141,148, 2,255, /* 0x 390 */
|
||||
15, 0, 0,129,226, 0,240,255,255,137, 85,148,139,117, 8, 49, /* 0x 3a0 */
|
||||
255,199, 69,144, 1, 0, 0, 0,137,117,152,141, 69,236,139, 85, /* 0x 3b0 */
|
||||
148,139,117,152,139, 28, 7,137,217,129,227, 0,240,255,255,129, /* 0x 3c0 */
|
||||
225,255, 15, 0, 0, 3, 76, 47,228,137, 28, 7,139, 68, 47,220, /* 0x 3d0 */
|
||||
1,194, 41,216,137, 22, 3, 93,148,106, 0, 5,255, 15, 0, 0, /* 0x 3e0 */
|
||||
106,255, 37, 0,240,255,255,104, 18, 16, 0, 0,129,193,255, 15, /* 0x 3f0 */
|
||||
0, 0,106, 0,129,225, 0,240,255,255, 80,131,198, 4, 83,137, /* 0x 400 */
|
||||
68, 47,220,137, 76, 47,228,232, 33,253,255,255,137, 68, 61,212, /* 0x 410 */
|
||||
131,196, 24,131,199, 4,255, 77,144,137,117,152,121,141,139, 69, /* 0x 420 */
|
||||
212,199, 69,168, 0, 0, 0, 0,139, 85,236,139, 77,196, 41,208, /* 0x 430 */
|
||||
102,131,121, 44, 0,137, 69,172, 15,132,236, 1, 0, 0,139, 93, /* 0x 440 */
|
||||
180,139, 3,131,248, 6,117, 34,131,125,192, 0, 15,132,193, 1, /* 0x 450 */
|
||||
0, 0,139, 77,172,186, 3, 0, 0, 0, 3, 75, 8,139, 69,188, /* 0x 460 */
|
||||
232, 29,254,255,255,233,169, 1, 0, 0, 72, 15,133,162, 1, 0, /* 0x 470 */
|
||||
0,139,117,180,199, 69,164, 64, 98, 81,115,139, 69,172, 3, 70, /* 0x 480 */
|
||||
8,139, 78, 24,139, 86, 20,131,225, 7,137, 69,208, 1,194,193, /* 0x 490 */
|
||||
225, 2,211,109,164,137, 85,156,139, 78, 16,137,194,131,101,164, /* 0x 4a0 */
|
||||
7,129,226,255, 15, 0, 0,137, 77,204,141, 52, 17,139, 77,180, /* 0x 4b0 */
|
||||
41,208,137, 69,160,139, 65, 4, 41,208,131,125,192, 0, 80,139, /* 0x 4c0 */
|
||||
69,200,116, 3,131,200,255,131,125,192, 1, 80, 25,192, 37, 0, /* 0x 4d0 */
|
||||
240,255,255, 5, 18, 16, 0, 0,131,125,192, 0, 80,139, 69,164, /* 0x 4e0 */
|
||||
116, 3,131,200, 2,131,125,192, 0, 80,137,240,116, 3,141, 70, /* 0x 4f0 */
|
||||
3, 80,255,117,160,232, 51,252,255,255,131,196, 24, 57, 69,160, /* 0x 500 */
|
||||
15,133,188, 0, 0, 0,131,125,192, 0,116, 28,246, 69,164, 4, /* 0x 510 */
|
||||
139, 69,184,117, 2, 49,192, 80,139, 69,192,255,117,200,141, 85, /* 0x 520 */
|
||||
204,232,127,252,255,255, 95, 88,137,247,247,223,129,231,255, 15, /* 0x 530 */
|
||||
0, 0,246, 69,164, 2,116, 17,139, 69,160, 1,240,133,255,116, /* 0x 540 */
|
||||
8,137,249,198, 0, 0, 64,226,250,131,125,192, 0,116,122,139, /* 0x 550 */
|
||||
93,180,131, 59, 1,117, 88,246, 67, 24, 1,116, 82,139, 83, 20, /* 0x 560 */
|
||||
137,216,139, 91, 8,141, 12, 26, 3, 77,172, 59, 80, 16,117, 14, /* 0x 570 */
|
||||
137,200,247,216, 37,255, 15, 0, 0,131,248, 3,119, 17,139, 85, /* 0x 580 */
|
||||
180,107, 69,172, 52,131,122, 4, 0,141, 76, 3, 12,117, 15,139, /* 0x 590 */
|
||||
1, 61,205,128,201,195,116, 6,199, 1,205,128,201,195,133,201, /* 0x 5a0 */
|
||||
116, 13,139, 69,188, 49,210,131,224,254,232,211,252,255,255,255, /* 0x 5b0 */
|
||||
117,164, 86,255,117,160,232,181,251,255,255,131,196, 12,133,192, /* 0x 5c0 */
|
||||
116, 7,106,127,232,139,251,255,255,141, 4, 62,139, 93,160, 1, /* 0x 5d0 */
|
||||
195, 59, 93,156,115, 33,106, 0,106,255,104, 18, 16, 0, 0,255, /* 0x 5e0 */
|
||||
117,164, 41, 93,156,255,117,156, 83,232, 63,251,255,255,131,196, /* 0x 5f0 */
|
||||
24, 57,195,116, 30,235,203,131,125,192, 0,116, 22,141, 70, 3, /* 0x 600 */
|
||||
37,255, 15, 0, 0,131,248, 3,119, 9, 80, 83,232, 91,251,255, /* 0x 610 */
|
||||
255, 89, 91,139, 77,196,255, 69,168, 15,183, 65, 44,131, 69,180, /* 0x 620 */
|
||||
32, 57, 69,168, 15,140, 20,254,255,255,131,125,192, 0,117, 13, /* 0x 630 */
|
||||
255,117,200,232, 48,251,255,255, 90,133,192,117,133,131,125, 20, /* 0x 640 */
|
||||
0,116, 8,139,117,172,139, 93, 20,137, 51,139, 69,196,139, 64, /* 0x 650 */
|
||||
24, 1, 69,172,139, 69,172,141,101,244, 91, 94, 95,201,195, 85, /* 0x 660 */
|
||||
137,229, 87, 86, 83,131,236, 24,141, 85, 24,139, 69, 8,106, 0, /* 0x 670 */
|
||||
139,125, 28,199, 69,232, 0, 0, 0, 0,137, 69,228,139, 69, 16, /* 0x 680 */
|
||||
139, 93, 32,199, 69,236, 0, 0, 0, 0,137, 69,224,131,192, 2, /* 0x 690 */
|
||||
255,117,224,137, 69,220,141, 69, 32,141,119, 52,232, 4,251,255, /* 0x 6a0 */
|
||||
255,139, 69, 12,185, 0, 16, 0, 0,186, 6, 0, 0, 0,137, 69, /* 0x 6b0 */
|
||||
32,139, 69,228, 41, 93, 36,232,198,251,255,255, 15,183, 79, 44, /* 0x 6c0 */
|
||||
139, 69,228,186, 5, 0, 0, 0,232,181,251,255,255, 15,183, 79, /* 0x 6d0 */
|
||||
42,139, 69,228,186, 4, 0, 0, 0,232,164,251,255,255,139, 77, /* 0x 6e0 */
|
||||
40, 3, 78, 8,186, 3, 0, 0, 0,139, 69,228,131,193, 52,232, /* 0x 6f0 */
|
||||
142,251,255,255,141, 69,240,255,117,220,137,250, 80,141, 69, 32, /* 0x 700 */
|
||||
255,117,228, 80,141, 69,232, 80,139, 69,224,232,152,251,255,255, /* 0x 710 */
|
||||
186, 9, 0, 0, 0,137,193,137,195,139, 69,228,232, 97,251,255, /* 0x 720 */
|
||||
255,102,139, 79, 44,131,196, 28, 49,210,102,133,201,116,116,131, /* 0x 730 */
|
||||
62, 3,117,100,106, 0,139, 69,240,106, 0, 3, 70, 8, 80,232, /* 0x 740 */
|
||||
32,250,255,255,131,196, 12,133,192,137,195,120, 22,104, 0, 2, /* 0x 750 */
|
||||
0, 0, 87, 80,232, 3,250,255,255,131,196, 12, 61, 0, 2, 0, /* 0x 760 */
|
||||
0,116, 7,106,127,232,234,249,255,255,141, 69,240,137,250,106, /* 0x 770 */
|
||||
0, 80,106, 0,141, 69,232,106, 0, 80,137,216,232, 39,251,255, /* 0x 780 */
|
||||
255,139, 77,240,137,195,139, 69,228,186, 7, 0, 0, 0,232,239, /* 0x 790 */
|
||||
250,255,255,131,196, 20,235, 11, 66, 15,183,193,131,198, 32, 57, /* 0x 7a0 */
|
||||
194,124,140,141,101,244,137,216, 91, 94, 95,201,195 /* 0x 7b0 */
|
||||
};
|
||||
|
|
|
@ -71,12 +71,13 @@ fold_begin: ; enter: %ebx= &Elf32_Ehdr of this program
|
|||
%define AT_PHENT 4
|
||||
%define AT_PHNUM 5
|
||||
%define AT_PAGESZ 6
|
||||
%define AT_BASE 7
|
||||
%define AT_ENTRY 9
|
||||
|
||||
%define ET_DYN 3
|
||||
|
||||
sub ecx, ecx
|
||||
mov edx, (1<<AT_PHDR) | (1<<AT_PHENT) | (1<<AT_PHNUM) | (1<<AT_PAGESZ) | (1<<AT_ENTRY)
|
||||
mov edx, (1<<AT_PHDR) | (1<<AT_PHENT) | (1<<AT_PHNUM) | (1<<AT_PAGESZ) | (1<<AT_BASE) | (1<<AT_ENTRY)
|
||||
mov esi, esp
|
||||
mov edi, esp
|
||||
call do_auxv ; clear bits in edx according to existing auxv slots
|
||||
|
|
|
@ -416,7 +416,9 @@ do_xmap(int const fdi, Elf32_Ehdr const *const ehdr, struct Extent *const xi,
|
|||
fdi, ehdr, xi, (xi? xi->size: 0), (xi? xi->buf: 0), av, p_reloc, f_unf));
|
||||
for (j=0; j < ehdr->e_phnum; ++phdr, ++j)
|
||||
if (PT_PHDR==phdr->p_type) {
|
||||
auxv_up(av, AT_PHDR, phdr->p_vaddr + reloc);
|
||||
if (xi) {
|
||||
auxv_up(av, AT_PHDR, phdr->p_vaddr + reloc);
|
||||
}
|
||||
}
|
||||
else if (PT_LOAD==phdr->p_type) {
|
||||
unsigned const prot = PF_TO_PROT(phdr->p_flags);
|
||||
|
@ -552,7 +554,7 @@ void *upx_main(
|
|||
|
||||
// Some kernels omit AT_PHNUM,AT_PHENT,AT_PHDR because this stub has no PT_INTERP.
|
||||
// That is "too much" optimization. Linux 2.6.x seems to give all AT_*.
|
||||
//auxv_up(av, AT_PAGESZ, PAGE_SIZE); /* ld-linux.so.2 does not need this */
|
||||
auxv_up(av, AT_PAGESZ, PAGE_SIZE);
|
||||
auxv_up(av, AT_PHNUM , ehdr->e_phnum);
|
||||
auxv_up(av, AT_PHENT , ehdr->e_phentsize);
|
||||
auxv_up(av, AT_PHDR , dynbase + (unsigned)(1+(Elf32_Ehdr *)phdr->p_vaddr));
|
||||
|
@ -573,7 +575,8 @@ void *upx_main(
|
|||
ERR_LAB
|
||||
err_exit(19);
|
||||
}
|
||||
entry = do_xmap(fdi, ehdr, 0, 0, 0, 0);
|
||||
entry = do_xmap(fdi, ehdr, 0, 0, &reloc, 0);
|
||||
auxv_up(av, AT_BASE, reloc);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -72,12 +72,13 @@ fold_begin: ; enter: %ebx= &Elf32_Ehdr of this program
|
|||
%define AT_PHENT 4
|
||||
%define AT_PHNUM 5
|
||||
%define AT_PAGESZ 6
|
||||
%define AT_BASE 7
|
||||
%define AT_ENTRY 9
|
||||
|
||||
%define ET_DYN 3
|
||||
|
||||
sub ecx, ecx
|
||||
mov edx, (1<<AT_PHDR) | (1<<AT_PHENT) | (1<<AT_PHNUM) | (1<<AT_PAGESZ) | (1<<AT_ENTRY)
|
||||
mov edx, (1<<AT_PHDR) | (1<<AT_PHENT) | (1<<AT_PHNUM) | (1<<AT_PAGESZ) | (1<<AT_BASE) | (1<<AT_ENTRY)
|
||||
mov esi, esp
|
||||
mov edi, esp
|
||||
call do_auxv ; clear bits in edx according to existing auxv slots
|
||||
|
@ -230,6 +231,11 @@ mmap:
|
|||
brk:
|
||||
ret
|
||||
|
||||
global bkpt
|
||||
bkpt:
|
||||
int3
|
||||
ret
|
||||
|
||||
%define __NR_exit 1
|
||||
%define __NR_read 3
|
||||
%define __NR_write 4
|
||||
|
|
|
@ -176,12 +176,6 @@ err_exit(int a) __attribute__ ((__noreturn__));
|
|||
}
|
||||
#endif //}
|
||||
|
||||
static void *
|
||||
do_brk(void *addr)
|
||||
{
|
||||
return brk(addr);
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
// UPX & NRV stuff
|
||||
**************************************************************************/
|
||||
|
@ -368,53 +362,80 @@ auxv_up(Elf32_auxv_t *av, unsigned const type, unsigned const value)
|
|||
) >> ((pf & (PF_R|PF_W|PF_X))<<2) ))
|
||||
|
||||
|
||||
// Find convex hull of PT_LOAD (the minimal interval which covers all PT_LOAD),
|
||||
// and mmap that much, to be sure that a kernel using exec-shield-randomize
|
||||
// won't place the first piece in a way that leaves no room for the rest.
|
||||
static unsigned
|
||||
umax(unsigned a, unsigned b)
|
||||
{
|
||||
return ((a<=b) ? b : a);
|
||||
}
|
||||
|
||||
// OpenBSD 3.9 wants all .text from all modules together, then (above that)
|
||||
// all .data from all modules together, in order to maximize the effectiveness
|
||||
// of lowering the segment limit on %cs as an implementation of "no-execute
|
||||
// .data". Thus OpenBSD 3.9 puts a gap of 0x20000000 (512MB) between the
|
||||
// origins of .text and .data in each module. So, mapping ET_DYN must "level"
|
||||
// the excursion in .text and .data of anything which preceeded it,
|
||||
// then add the new PT_LOAD.
|
||||
|
||||
static unsigned long // returns relocation constant
|
||||
#if defined(__i386__) /*{*/
|
||||
__attribute__((regparm(3), stdcall))
|
||||
#endif /*}*/
|
||||
xfind_pages(Elf32_Phdr const *phdr, int phnum, char **const p_brk)
|
||||
xfind_pages(unsigned const e_type, Elf32_Phdr const *phdr, int phnum,
|
||||
Elf32_Addr old_hi[2])
|
||||
{
|
||||
size_t lo= ~0, hi= 0, szlo= 0;
|
||||
char *addr;
|
||||
unsigned const mflags = MAP_PRIVATE | MAP_ANONYMOUS;
|
||||
size_t sz[2]= { 0u, 0u}; // [0] is .data; [1] is .text
|
||||
size_t hi[2]= { 0u, 0u};
|
||||
size_t lo[2]= {~0u, ~0u};
|
||||
char *addr[2];
|
||||
unsigned level= 0;
|
||||
int j;
|
||||
|
||||
DPRINTF((STR_xfind_pages(), mflags, phdr, phnum, p_brk));
|
||||
for (; --phnum>=0; ++phdr) if (PT_LOAD==phdr->p_type) {
|
||||
if (phdr->p_vaddr < lo) {
|
||||
lo = phdr->p_vaddr;
|
||||
szlo = phdr->p_filesz;
|
||||
unsigned const td = PF_X & phdr->p_flags; // requires 1==PF_X
|
||||
if (lo[td] > phdr->p_vaddr) {
|
||||
lo[td] = phdr->p_vaddr;
|
||||
sz[td] = phdr->p_filesz;
|
||||
}
|
||||
if (hi < (phdr->p_memsz + phdr->p_vaddr)) {
|
||||
hi = phdr->p_memsz + phdr->p_vaddr;
|
||||
if (hi[td] < (phdr->p_memsz + phdr->p_vaddr)) {
|
||||
hi[td] = phdr->p_memsz + phdr->p_vaddr;
|
||||
}
|
||||
}
|
||||
szlo += ~PAGE_MASK & lo; // page fragment on lo edge
|
||||
lo -= ~PAGE_MASK & lo; // round down to page boundary
|
||||
hi = PAGE_MASK & (hi - lo - PAGE_MASK -1); // page length
|
||||
szlo = PAGE_MASK & (szlo - PAGE_MASK -1); // page length
|
||||
addr = mmap((void *)lo, hi, PROT_NONE, mflags, -1, 0);
|
||||
*p_brk = hi + addr; // the logical value of brk(0)
|
||||
//mprotect(szlo + addr, hi - szlo, PROT_NONE); // no access, but keep the frames!
|
||||
return (unsigned long)addr - lo;
|
||||
if ((ET_EXEC!=e_type) && 0x20000000u<=hi[0]) { // is split
|
||||
level= (0xfc000000u & old_hi[1]) + // "segment base" of old .text
|
||||
umax(0x03ffffffu & old_hi[1],
|
||||
0x03ffffffu & old_hi[0] );
|
||||
level= PAGE_MASK & (level - PAGE_MASK -1); // ALIGN_UP
|
||||
}
|
||||
for (j=0; j<=1; ++j) {
|
||||
sz[j] += ~PAGE_MASK & lo[j]; // page fragment on lo edge
|
||||
lo[j] -= ~PAGE_MASK & lo[j]; // round down to page boundary
|
||||
old_hi[j] = level + hi[j];
|
||||
hi[j] = PAGE_MASK & (hi[j] - lo[j] - PAGE_MASK -1); // page length
|
||||
sz[j] = PAGE_MASK & (sz[j] - PAGE_MASK -1); // page length
|
||||
addr[j] = mmap((void *)(level + lo[j]), hi[j], PROT_NONE,
|
||||
MAP_FIXED | MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
|
||||
}
|
||||
return (unsigned long)addr[0] - lo[0];
|
||||
}
|
||||
|
||||
static Elf32_Addr // entry address
|
||||
do_xmap(int const fdi, Elf32_Ehdr const *const ehdr, struct Extent *const xi,
|
||||
do_xmap(int const fdi, Elf32_Ehdr const *const ehdr,
|
||||
Elf32_Addr old_hi[2], struct Extent *const xi,
|
||||
Elf32_auxv_t *const av, unsigned *p_reloc, f_unfilter *const f_unf)
|
||||
{
|
||||
Elf32_Phdr const *phdr = (Elf32_Phdr const *) (ehdr->e_phoff +
|
||||
(void const *)ehdr);
|
||||
char *v_brk;
|
||||
unsigned const reloc = (ET_EXEC==ehdr->e_type) ?
|
||||
0 : xfind_pages(phdr, ehdr->e_phnum, &v_brk);
|
||||
unsigned const reloc = xfind_pages(ehdr->e_type, phdr, ehdr->e_phnum, old_hi);
|
||||
int j;
|
||||
|
||||
DPRINTF((STR_do_xmap(),
|
||||
fdi, ehdr, xi, (xi? xi->size: 0), (xi? xi->buf: 0), av, p_reloc, f_unf));
|
||||
for (j=0; j < ehdr->e_phnum; ++phdr, ++j)
|
||||
if (PT_PHDR==phdr->p_type) {
|
||||
auxv_up(av, AT_PHDR, phdr->p_vaddr + reloc);
|
||||
if (xi) {
|
||||
auxv_up(av, AT_PHDR, phdr->p_vaddr + reloc);
|
||||
}
|
||||
}
|
||||
else if (PT_LOAD==phdr->p_type) {
|
||||
unsigned const prot = PF_TO_PROT(phdr->p_flags);
|
||||
|
@ -487,12 +508,6 @@ ERR_LAB
|
|||
err_exit(11);
|
||||
}
|
||||
}
|
||||
else { // 1st call (main); also have (0!=av) here
|
||||
if (ET_DYN!=ehdr->e_type) {
|
||||
// Needed only if compressed shell script invokes compressed shell.
|
||||
do_brk(v_brk);
|
||||
}
|
||||
}
|
||||
if (0!=p_reloc) {
|
||||
*p_reloc = reloc;
|
||||
}
|
||||
|
@ -528,6 +543,7 @@ void *upx_main(
|
|||
{
|
||||
Elf32_Ehdr *const ehdr = (Elf32_Ehdr *)(void *)xo.buf; // temp char[MAX_ELF_HDR+OVERHEAD]
|
||||
Elf32_Phdr const *phdr = (Elf32_Phdr const *)(1+ ehdr);
|
||||
Elf32_Addr old_hi[2]= {0u, 0u};
|
||||
Elf32_Addr reloc;
|
||||
Elf32_Addr entry;
|
||||
|
||||
|
@ -550,14 +566,14 @@ void *upx_main(
|
|||
|
||||
// Some kernels omit AT_PHNUM,AT_PHENT,AT_PHDR because this stub has no PT_INTERP.
|
||||
// That is "too much" optimization. Linux 2.6.x seems to give all AT_*.
|
||||
//auxv_up(av, AT_PAGESZ, PAGE_SIZE); /* ld-linux.so.2 does not need this */
|
||||
auxv_up(av, AT_PAGESZ, PAGE_SIZE);
|
||||
auxv_up(av, AT_PHNUM , ehdr->e_phnum);
|
||||
auxv_up(av, AT_PHENT , ehdr->e_phentsize);
|
||||
auxv_up(av, AT_PHDR , dynbase + (unsigned)(1+(Elf32_Ehdr *)phdr->p_vaddr));
|
||||
// AT_PHDR.a_un.a_val is set again by do_xmap if PT_PHDR is present.
|
||||
// This is necessary for ET_DYN if|when we override a prelink address.
|
||||
|
||||
entry = do_xmap((int)f_decompress, ehdr, &xi, av, &reloc, f_unf);
|
||||
entry = do_xmap((int)f_decompress, ehdr, old_hi, &xi, av, &reloc, f_unf);
|
||||
auxv_up(av, AT_ENTRY , entry); // might not be necessary?
|
||||
|
||||
{ // Map PT_INTERP program interpreter
|
||||
|
@ -571,7 +587,8 @@ void *upx_main(
|
|||
ERR_LAB
|
||||
err_exit(19);
|
||||
}
|
||||
entry = do_xmap(fdi, ehdr, 0, 0, 0, 0);
|
||||
entry = do_xmap(fdi, ehdr, old_hi, 0, 0, &reloc, 0);
|
||||
auxv_up(av, AT_BASE, reloc);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -262,6 +262,7 @@ typedef struct
|
|||
#define AT_PHENT 4
|
||||
#define AT_PHNUM 5
|
||||
#define AT_PAGESZ 6
|
||||
#define AT_BASE 7
|
||||
#define AT_ENTRY 9
|
||||
|
||||
#define ET_EXEC 2
|
||||
|
|
Loading…
Reference in New Issue
Block a user