1
0
mirror of https://github.com/upx/upx synced 2025-09-28 19:06:07 +08:00

Work better with SELinux. We still require allow_execmem.

p_lx_elf.cpp
	stub/fold_elfppc32.h
	stub/l_lx_elfppc32.h
	stub/l_lx_elfppc32.S
	stub/m_lx_elfppc32.c

committer: jreiser <jreiser> 1145666524 +0000
This commit is contained in:
John Reiser 2006-04-22 00:42:04 +00:00
parent 23f3e4396c
commit b739bd3d79
5 changed files with 148 additions and 130 deletions

View File

@ -646,7 +646,7 @@ PackLinuxElf32ppc::generateElfHdr(
if (ph.format==UPX_F_LINUX_ELFPPC32) {
cprElfHdr2 *const h2 = (cprElfHdr2 *)&elfout;
assert(2==get_native16(&h2->ehdr.e_phnum));
set_native32(&h2->phdr[0].p_flags, Elf32_Phdr::PF_W | get_native32(&h2->phdr[0].p_flags));
set_native32(&h2->phdr[0].p_flags, ~Elf32_Phdr::PF_W & get_native32(&h2->phdr[0].p_flags));
memset(&h2->linfo, 0, sizeof(h2->linfo));
fo->write(h2, sizeof(*h2));
}

View File

@ -1,4 +1,4 @@
/* fold_elfppc32.h -- created from fold_elfppc32.bin, 2324 (0x914) bytes
/* fold_elfppc32.h -- created from fold_elfppc32.bin, 2260 (0x8d4) bytes
This file is part of the UPX executable compressor.
@ -27,18 +27,18 @@
*/
#define LINUX_ELFPPC32_FOLD_SIZE 2324
#define LINUX_ELFPPC32_FOLD_ADLER32 0x0789a535
#define LINUX_ELFPPC32_FOLD_CRC32 0x665028e2
#define LINUX_ELFPPC32_FOLD_SIZE 2260
#define LINUX_ELFPPC32_FOLD_ADLER32 0x6c8685d0
#define LINUX_ELFPPC32_FOLD_CRC32 0xa1bffc23
unsigned char linux_elfppc32_fold[2324] = {
unsigned char linux_elfppc32_fold[2260] = {
127, 69, 76, 70, 1, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x 0 */
0, 2, 0, 20, 0, 0, 0, 1, 0, 16, 0,128, 0, 0, 0, 52, /* 0x 10 */
0, 0, 7,252, 0, 0, 0, 0, 0, 52, 0, 32, 0, 2, 0, 40, /* 0x 20 */
0, 0, 7,188, 0, 0, 0, 0, 0, 52, 0, 32, 0, 2, 0, 40, /* 0x 20 */
0, 7, 0, 6, 0, 0, 0, 1, 0, 0, 0, 0, 0, 16, 0, 0, /* 0x 30 */
0, 16, 0, 0, 0, 0, 7,196, 0, 0, 7,196, 0, 0, 0, 5, /* 0x 40 */
0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 7,196, 0, 16, 7,196, /* 0x 50 */
0, 16, 7,196, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, /* 0x 60 */
0, 16, 0, 0, 0, 0, 7,132, 0, 0, 7,132, 0, 0, 0, 5, /* 0x 40 */
0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 7,132, 0, 16, 7,132, /* 0x 50 */
0, 16, 7,132, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, /* 0x 60 */
0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x 70 */
72, 0, 0,125, 40, 6, 0,208, 76,130, 0, 32, 84,132,240,191, /* 0x 80 */
77,130, 0, 32, 60, 0, 0, 16,124, 4, 0, 64, 65,128, 0, 8, /* 0x 90 */
@ -50,7 +50,7 @@ unsigned char linux_elfppc32_fold[2324] = {
47,130, 0, 0, 64,158,255,244, 78,128, 0, 32,125, 8, 2,166, /* 0x f0 */
129, 33, 0, 0, 75,255,255,229, 75,255,255,225,128,159,255,248, /* 0x 100 */
85, 30, 0, 38, 56,161,248, 0,127,231,251,120,124,100,248, 80, /* 0x 110 */
56, 33,247,240, 84,125, 0, 38,128,195, 0, 24, 72, 0, 5, 73, /* 0x 120 */
56, 33,247,240, 84,125, 0, 38,128,195, 0, 24, 72, 0, 5, 9, /* 0x 120 */
124,127, 27,120,127,163,235,120,124,157,240, 80, 72, 0, 0, 81, /* 0x 130 */
127,232, 3,166,184, 65, 8, 20,128, 33, 8, 16, 78,128, 0, 32, /* 0x 140 */
56, 0, 0, 90, 68, 0, 0, 2, 64,163, 0, 8, 56, 96,255,255, /* 0x 150 */
@ -86,96 +86,92 @@ unsigned char linux_elfppc32_fold[2324] = {
129, 63, 0, 0,128, 31, 0, 4,125, 43, 72, 80, 47,137, 0, 0, /* 0x 330 */
124, 0, 90, 20,144, 31, 0, 4,145, 63, 0, 0, 75,255,254,228, /* 0x 340 */
128, 1, 0, 68,187,129, 0, 48, 56, 33, 0, 64,124, 8, 3,166, /* 0x 350 */
78,128, 0, 32,124,128, 35,121,124, 9, 3,166, 77,130, 0, 32, /* 0x 360 */
56, 0, 0, 0,152, 3, 0, 0, 56, 99, 0, 1, 66, 0,255,248, /* 0x 370 */
78,128, 0, 32, 44, 3, 0, 0, 77,130, 0, 32, 48, 4,255,255, /* 0x 380 */
125, 96, 33, 16,128, 3, 0, 0,127,128, 32, 0,104, 9, 0, 1, /* 0x 390 */
33, 73, 0, 0,125, 42, 73, 20,125, 42, 88, 57, 65,158, 0, 8, /* 0x 3a0 */
65,162, 0, 16,144,163, 0, 4,144,131, 0, 0, 78,128, 0, 32, /* 0x 3b0 */
56, 99, 0, 8, 75,255,255,208,124, 8, 2,166,148, 33,255,160, /* 0x 3c0 */
125,128, 0, 38,190, 65, 0, 40,124,121, 27,120,124,151, 35,120, /* 0x 3d0 */
144, 1, 0,100,124,181, 43,120,161, 67, 0, 44,124,210, 51,120, /* 0x 3e0 */
160, 3, 0, 16,124,243, 59,120, 53, 74,255,255,129, 35, 0, 28, /* 0x 3f0 */
104, 0, 0, 3,145,129, 0, 36,124, 0, 0,208,127, 99, 74, 20, /* 0x 400 */
84, 3, 46,246,125, 20, 67,120, 56, 99, 8, 34,127,107,219,120, /* 0x 410 */
59,128,255,255, 59,192, 0, 0, 59,224, 0, 0, 65,128, 0, 72, /* 0x 420 */
57, 74, 0, 1,125, 73, 3,166,128, 11, 0, 0, 47,128, 0, 1, /* 0x 430 */
64,190, 0, 44,129, 43, 0, 8,127,137,224, 64, 64,156, 0, 12, /* 0x 440 */
131,235, 0, 16,125, 60, 75,120,128, 11, 0, 20,124, 0, 74, 20, /* 0x 450 */
127,158, 0, 64, 64,156, 0, 8,124, 30, 3,120, 57,107, 0, 32, /* 0x 460 */
66, 0,255,200, 87,128, 5, 62, 87,156, 0, 38,125, 60,240, 80, /* 0x 470 */
127,255, 2, 20, 57, 41, 15,255, 56, 31, 15,255, 85, 62, 0, 38, /* 0x 480 */
84, 31, 0, 38,124,102, 27,120,127,196,243,120, 56,160, 0, 7, /* 0x 490 */
126,167,171,120, 57, 0, 0, 0,127,131,227,120, 75,255,252,165, /* 0x 4a0 */
124,159,240, 80,124, 3,242, 20,124,125, 27,120, 56,160, 0, 0, /* 0x 4b0 */
124, 99,250, 20,144, 1, 0, 8, 75,255,252,189,160, 25, 0, 44, /* 0x 4c0 */
58,192, 0, 0,127, 28,232, 80,127,150, 0, 0, 64,156, 1,116, /* 0x 4d0 */
45,151, 0, 0, 65,142, 0, 40,128, 27, 0, 0, 47,128, 0, 6, /* 0x 4e0 */
64,190, 0, 28,128,187, 0, 8,126, 67,147,120, 56,128, 0, 3, /* 0x 4f0 */
124,165,194, 20, 75,255,254,129, 72, 0, 1, 52,128, 27, 0, 0, /* 0x 500 */
47,128, 0, 1, 64,190, 1, 40,128, 27, 0, 24, 61, 32,115, 81, /* 0x 510 */
129, 91, 0, 8, 97, 41, 98, 64, 84, 0, 22,250,129,123, 0, 20, /* 0x 520 */
125, 41, 4, 48, 85, 94, 5, 62, 48, 23,255,255,124,160,185, 16, /* 0x 530 */
128, 27, 0, 16, 85, 58, 7,126,127,170, 90, 20, 84,165, 8, 60, /* 0x 540 */
127,254, 80, 80,144, 1, 0, 16,127,128,242, 20,145, 65, 0, 20, /* 0x 550 */
127,255,194, 20,127,189,194, 20,124,165,211,120, 65,142, 0, 12, /* 0x 560 */
56,192, 0, 50, 72, 0, 0, 8, 56,192, 0, 18,129, 27, 0, 4, /* 0x 570 */
127,227,251,120,127,132,227,120,126,167,171,120,125, 30, 64, 80, /* 0x 580 */
75,255,251,193,127,159, 24, 0, 64,158, 0,104, 65,174, 0, 24, /* 0x 590 */
126,227,187,120, 56,129, 0, 16,126,101,155,120,126,134,163,120, /* 0x 5a0 */
75,255,252, 89, 87, 64,255,254, 46, 0, 0, 0, 65,178, 0, 16, /* 0x 5b0 */
127,196,243,120,127,227,251,120, 75,255,253,157,124, 28, 0,208, /* 0x 5c0 */
84, 30, 5, 62, 65,178, 0, 16,124,127,226, 20,127,196,243,120, /* 0x 5d0 */
75,255,253,133, 65,174, 0, 36,127,227,251,120,127,132,227,120, /* 0x 5e0 */
127, 69,211,120, 75,255,251,145, 47,131, 0, 0, 65,190, 0, 12, /* 0x 5f0 */
56, 96, 0,127, 75,255,251, 97,124, 28,242, 20,127,255, 2, 20, /* 0x 600 */
127,159,232, 64, 64,188, 0, 40,124,159,232, 80,127, 69,211,120, /* 0x 610 */
127,227,251,120, 56,192, 0, 50, 56,224, 0, 0, 57, 0, 0, 0, /* 0x 620 */
75,255,251, 33,127,159, 24, 0, 64,190,255,200,160, 25, 0, 44, /* 0x 630 */
58,214, 0, 1, 59,123, 0, 32,127,150, 0, 0, 75,255,254,144, /* 0x 640 */
128,121, 0, 24,128, 1, 0,100,129,129, 0, 36,124, 99,194, 20, /* 0x 650 */
124, 8, 3,166,186, 65, 0, 40,125,129,129, 32, 56, 33, 0, 96, /* 0x 660 */
78,128, 0, 32,124, 8, 2,166,148, 33,255,192, 56,132,255,232, /* 0x 670 */
191, 97, 0, 44,144,129, 0, 8,124,191, 43,120,144, 1, 0, 68, /* 0x 680 */
56, 3, 0, 24,144, 1, 0, 12,124,229, 59,120,128, 3, 0, 24, /* 0x 690 */
56,192, 0, 0,200, 1, 0, 8, 56, 97, 0, 8, 56,129, 0, 16, /* 0x 6a0 */
59,223, 0, 52,125, 61, 75,120,124,251, 59,120,144, 1, 0, 16, /* 0x 6b0 */
125, 28, 67,120,216, 1, 0, 24,147,225, 0, 20, 75,255,251, 61, /* 0x 6c0 */
128,190, 0, 8,127,163,235,120, 56,128, 0, 3, 56,165, 0, 52, /* 0x 6d0 */
75,255,252,165,160,191, 0, 44,127,163,235,120, 56,128, 0, 5, /* 0x 6e0 */
75,255,252,149,128,191, 0, 24,127,163,235,120, 56,128, 0, 9, /* 0x 6f0 */
75,255,252,133,127,103,219,120,127,136,227,120,127,227,251,120, /* 0x 700 */
127,166,235,120, 56,129, 0, 24, 56,160, 0, 0, 59, 96, 0, 0, /* 0x 710 */
75,255,252,169,160, 31, 0, 44,124,124, 27,120,127,155, 0, 0, /* 0x 720 */
64,156, 0,124,128, 30, 0, 0, 59,123, 0, 1, 56,128, 0, 0, /* 0x 730 */
56,160, 0, 0, 47,128, 0, 3, 64,190, 0, 88,128,126, 0, 8, /* 0x 740 */
75,255,250, 37,127,228,251,120,124,125, 27,121, 56,160, 2, 0, /* 0x 750 */
65,128, 0, 40, 75,255,250, 9, 56,128, 0, 0, 47,131, 2, 0, /* 0x 760 */
127,165,235,120,127,227,251,120, 56,192, 0, 0, 56,224, 0, 0, /* 0x 770 */
57, 0, 0, 0, 65,190, 0, 12, 56, 96, 0,127, 75,255,249,217, /* 0x 780 */
75,255,252, 57,124,124, 27,120,127,163,235,120, 75,255,249,225, /* 0x 790 */
160, 31, 0, 44, 59,222, 0, 32, 75,255,255,132,128, 1, 0, 68, /* 0x 7a0 */
127,131,227,120,187, 97, 0, 44, 56, 33, 0, 64,124, 8, 3,166, /* 0x 7b0 */
78,128, 0, 32, 0, 46,115,104,115,116,114,116, 97, 98, 0, 46, /* 0x 7c0 */
116,101,120,116, 0, 46, 98,115,115, 0, 46,115,100, 97,116, 97, /* 0x 7d0 */
0, 46,115,100, 97,116, 97, 50, 0, 46,110,111,116,101, 46, 71, /* 0x 7e0 */
78, 85, 45,115,116, 97, 99,107, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x 7f0 */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x 800 */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x 810 */
0, 0, 0, 0, 0, 0, 0, 11, 0, 0, 0, 1, 0, 0, 0, 6, /* 0x 820 */
0, 16, 0,128, 0, 0, 0,128, 0, 0, 7, 68, 0, 0, 0, 0, /* 0x 830 */
0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 17, /* 0x 840 */
0, 0, 0, 8, 0, 0, 0, 3, 0, 16, 7,196, 0, 0, 7,196, /* 0x 850 */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, /* 0x 860 */
0, 0, 0, 0, 0, 0, 0, 22, 0, 0, 0, 1, 0, 0, 0, 3, /* 0x 870 */
0, 16, 7,196, 0, 0, 7,196, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x 880 */
0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 29, /* 0x 890 */
0, 0, 0, 1, 0, 0, 0, 2, 0, 16, 7,196, 0, 0, 7,196, /* 0x 8a0 */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, /* 0x 8b0 */
0, 0, 0, 0, 0, 0, 0, 37, 0, 0, 0, 7, 0, 0, 0, 0, /* 0x 8c0 */
0, 0, 0, 0, 0, 0, 7,196, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x 8d0 */
0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, /* 0x 8e0 */
0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7,196, /* 0x 8f0 */
0, 0, 0, 53, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, /* 0x 900 */
0, 0, 0, 0 /* 0x 910 */
78,128, 0, 32, 44, 3, 0, 0, 77,130, 0, 32, 48, 4,255,255, /* 0x 360 */
125, 96, 33, 16,128, 3, 0, 0,127,128, 32, 0,104, 9, 0, 1, /* 0x 370 */
33, 73, 0, 0,125, 42, 73, 20,125, 42, 88, 57, 65,158, 0, 8, /* 0x 380 */
65,162, 0, 16,144,163, 0, 4,144,131, 0, 0, 78,128, 0, 32, /* 0x 390 */
56, 99, 0, 8, 75,255,255,208,124, 8, 2,166,148, 33,255,160, /* 0x 3a0 */
125,128, 0, 38,190, 65, 0, 40,124,121, 27,120,124,151, 35,120, /* 0x 3b0 */
144, 1, 0,100,124,178, 43,120,161, 67, 0, 44,124,211, 51,120, /* 0x 3c0 */
160, 3, 0, 16,124,244, 59,120, 53, 74,255,255,129, 35, 0, 28, /* 0x 3d0 */
104, 0, 0, 3,145,129, 0, 36,124, 0, 0,208,127,163, 74, 20, /* 0x 3e0 */
84, 3, 46,246,125, 21, 67,120, 56, 99, 8, 34,127,171,235,120, /* 0x 3f0 */
59,224,255,255, 59,192, 0, 0, 65,128, 0, 68, 57, 74, 0, 1, /* 0x 400 */
125, 73, 3,166,128, 11, 0, 0, 47,128, 0, 1, 64,190, 0, 40, /* 0x 410 */
129, 43, 0, 8,127,137,248, 64, 64,156, 0, 8,125, 63, 75,120, /* 0x 420 */
128, 11, 0, 20,124, 0, 74, 20,127,158, 0, 64, 64,156, 0, 8, /* 0x 430 */
124, 30, 3,120, 57,107, 0, 32, 66, 0,255,204, 87,255, 0, 38, /* 0x 440 */
124,102, 27,120,125, 63,240, 80,127,227,251,120, 57, 41, 15,255, /* 0x 450 */
56,160, 0, 0, 85, 62, 0, 38, 56,224,255,255,127,196,243,120, /* 0x 460 */
57, 0, 0, 0, 75,255,252,221,160, 25, 0, 44, 58,192, 0, 0, /* 0x 470 */
127, 31, 24, 80,127,150, 0, 0,124, 3,242, 20,144, 1, 0, 8, /* 0x 480 */
64,156, 1,128, 46, 23, 0, 0, 65,146, 0, 40,128, 29, 0, 0, /* 0x 490 */
47,128, 0, 6, 64,190, 0, 28,128,189, 0, 8,126, 99,155,120, /* 0x 4a0 */
56,128, 0, 3,124,165,194, 20, 75,255,254,173, 72, 0, 1, 64, /* 0x 4b0 */
128, 29, 0, 0, 47,128, 0, 1, 64,190, 1, 52,128, 29, 0, 24, /* 0x 4c0 */
61, 32,115, 81,129, 93, 0, 8, 97, 41, 98, 64, 84, 0, 22,250, /* 0x 4d0 */
129,125, 0, 20,125, 41, 4, 48, 85, 94, 5, 62, 48, 23,255,255, /* 0x 4e0 */
124,160,185, 16,128, 29, 0, 16, 85, 58, 7,126,127,106, 90, 20, /* 0x 4f0 */
84,165, 8, 60,127,254, 80, 80,144, 1, 0, 16,127,128,242, 20, /* 0x 500 */
145, 65, 0, 20,127,255,194, 20,127,123,194, 20,124,165,211,120, /* 0x 510 */
65,146, 0, 12, 56,192, 0, 50, 72, 0, 0, 8, 56,192, 0, 18, /* 0x 520 */
64,146, 0, 12,126, 71,147,120, 72, 0, 0, 8, 56,224,255,255, /* 0x 530 */
129, 29, 0, 4,127,227,251,120,127,132,227,120,125, 30, 64, 80, /* 0x 540 */
75,255,252, 1,127,159, 24, 0, 64,158, 0,104, 65,178, 0, 24, /* 0x 550 */
126,227,187,120, 56,129, 0, 16,126,133,163,120,126,166,171,120, /* 0x 560 */
75,255,252,153,115, 64, 0, 2,124, 28, 0,208, 84, 30, 5, 62, /* 0x 570 */
65,130, 0, 36, 47,158, 0, 0,125, 63,226, 20, 65,158, 0, 24, /* 0x 580 */
127,201, 3,166, 56, 0, 0, 0,152, 9, 0, 0, 57, 41, 0, 1, /* 0x 590 */
66, 0,255,248, 65,178, 0, 36,127,227,251,120,127,132,227,120, /* 0x 5a0 */
127, 69,211,120, 75,255,251,209, 47,131, 0, 0, 65,190, 0, 12, /* 0x 5b0 */
56, 96, 0,127, 75,255,251,161,124, 28,242, 20,127,255, 2, 20, /* 0x 5c0 */
127,159,216, 64, 64,188, 0, 40,124,159,216, 80,127, 69,211,120, /* 0x 5d0 */
127,227,251,120, 56,192, 0, 50, 56,224,255,255, 57, 0, 0, 0, /* 0x 5e0 */
75,255,251, 97,127,159, 24, 0, 64,190,255,200,160, 25, 0, 44, /* 0x 5f0 */
58,214, 0, 1, 59,189, 0, 32,127,150, 0, 0, 75,255,254,132, /* 0x 600 */
128,121, 0, 24,128, 1, 0,100,129,129, 0, 36,124, 99,194, 20, /* 0x 610 */
124, 8, 3,166,186, 65, 0, 40,125,128,129, 32, 56, 33, 0, 96, /* 0x 620 */
78,128, 0, 32,124, 8, 2,166,148, 33,255,192, 56,132,255,232, /* 0x 630 */
191, 97, 0, 44,144,129, 0, 8,124,191, 43,120,144, 1, 0, 68, /* 0x 640 */
56, 3, 0, 24,144, 1, 0, 12,124,229, 59,120,128, 3, 0, 24, /* 0x 650 */
56,192, 0, 0,200, 1, 0, 8, 56, 97, 0, 8, 56,129, 0, 16, /* 0x 660 */
59,223, 0, 52,125, 61, 75,120,124,251, 59,120,144, 1, 0, 16, /* 0x 670 */
125, 28, 67,120,216, 1, 0, 24,147,225, 0, 20, 75,255,251,125, /* 0x 680 */
128,190, 0, 8,127,163,235,120, 56,128, 0, 3, 56,165, 0, 52, /* 0x 690 */
75,255,252,197,160,191, 0, 44,127,163,235,120, 56,128, 0, 5, /* 0x 6a0 */
75,255,252,181,128,191, 0, 24,127,163,235,120, 56,128, 0, 9, /* 0x 6b0 */
75,255,252,165,127,103,219,120,127,136,227,120,127,227,251,120, /* 0x 6c0 */
127,166,235,120, 56,129, 0, 24, 56,160, 0, 0, 59, 96, 0, 0, /* 0x 6d0 */
75,255,252,201,160, 31, 0, 44,124,124, 27,120,127,155, 0, 0, /* 0x 6e0 */
64,156, 0,124,128, 30, 0, 0, 59,123, 0, 1, 56,128, 0, 0, /* 0x 6f0 */
56,160, 0, 0, 47,128, 0, 3, 64,190, 0, 88,128,126, 0, 8, /* 0x 700 */
75,255,250,101,127,228,251,120,124,125, 27,121, 56,160, 2, 0, /* 0x 710 */
65,128, 0, 40, 75,255,250, 73, 56,128, 0, 0, 47,131, 2, 0, /* 0x 720 */
127,165,235,120,127,227,251,120, 56,192, 0, 0, 56,224, 0, 0, /* 0x 730 */
57, 0, 0, 0, 65,190, 0, 12, 56, 96, 0,127, 75,255,250, 25, /* 0x 740 */
75,255,252, 89,124,124, 27,120,127,163,235,120, 75,255,250, 33, /* 0x 750 */
160, 31, 0, 44, 59,222, 0, 32, 75,255,255,132,128, 1, 0, 68, /* 0x 760 */
127,131,227,120,187, 97, 0, 44, 56, 33, 0, 64,124, 8, 3,166, /* 0x 770 */
78,128, 0, 32, 0, 46,115,104,115,116,114,116, 97, 98, 0, 46, /* 0x 780 */
116,101,120,116, 0, 46, 98,115,115, 0, 46,115,100, 97,116, 97, /* 0x 790 */
0, 46,115,100, 97,116, 97, 50, 0, 46,110,111,116,101, 46, 71, /* 0x 7a0 */
78, 85, 45,115,116, 97, 99,107, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x 7b0 */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x 7c0 */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x 7d0 */
0, 0, 0, 0, 0, 0, 0, 11, 0, 0, 0, 1, 0, 0, 0, 6, /* 0x 7e0 */
0, 16, 0,128, 0, 0, 0,128, 0, 0, 7, 4, 0, 0, 0, 0, /* 0x 7f0 */
0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 17, /* 0x 800 */
0, 0, 0, 8, 0, 0, 0, 3, 0, 16, 7,132, 0, 0, 7,132, /* 0x 810 */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, /* 0x 820 */
0, 0, 0, 0, 0, 0, 0, 22, 0, 0, 0, 1, 0, 0, 0, 3, /* 0x 830 */
0, 16, 7,132, 0, 0, 7,132, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x 840 */
0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 29, /* 0x 850 */
0, 0, 0, 1, 0, 0, 0, 2, 0, 16, 7,132, 0, 0, 7,132, /* 0x 860 */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, /* 0x 870 */
0, 0, 0, 0, 0, 0, 0, 37, 0, 0, 0, 7, 0, 0, 0, 0, /* 0x 880 */
0, 0, 0, 0, 0, 0, 7,132, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x 890 */
0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, /* 0x 8a0 */
0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7,132, /* 0x 8b0 */
0, 0, 0, 53, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, /* 0x 8c0 */
0, 0, 0, 0 /* 0x 8d0 */
};

View File

@ -49,27 +49,44 @@ MAP_PRIVATE= 2
MAP_FIXED= 0x10
MAP_ANONYMOUS= 0x20
SYS_mmap= 90
__NR_mmap= 90
PAGE_SHIFT= 12
PAGE_SIZE = -(~0<<PAGE_SHIFT)
/* /usr/include/asm-ppc/unistd.h */
__NR_write = 4
__NR_exit = 1
msg_SELinux:
call L71
L70:
.asciz "SELinux denied execmem.\n"
.align 2 # (1<<2)
L71:
li a2,L71 - L70 # length
mflr a1 # message text
li a0,2 # fd stderr
li 0,__NR_write; sc
die:
li a0,127
li 0,__NR_exit; sc
/* Decompress the rest of this loader, and jump to it. */
unfold:
mflr r30 # &{ b_info={sz_unc, sz_cpr, {4 char}}, folded_loader...}
li a5,0 # off_t
li a4,0 # fd; ignored, but must be in range?
li a4,-1 # fd; cater to *BSD for MAP_ANON
lwz a0,sz_cpr(r30)
li a3,MAP_PRIVATE | MAP_FIXED | MAP_ANONYMOUS
li a2,PROT_READ | PROT_WRITE | PROT_EXEC
li a1,PAGE_SIZE
add a0,a0,r30
li 0,SYS_mmap
li 0,__NR_mmap
addi a0,a0,sz_b_info+PAGE_SIZE-1
rlwinm a0,a0,0,0,31-PAGE_SHIFT # next page boundary after fold
sc
bns+ 0f; trap # Branch if NoSummary[Overflow] (no failure)
sc; bso- msg_SELinux # Branch if SummaryOverflow (failure)
0:
mtctr r31
lbz meth,b_method(r30)

View File

@ -1,4 +1,4 @@
/* l_lx_elfppc32.h -- created from l_lx_elfppc32.bin, 460 (0x1cc) bytes
/* l_lx_elfppc32.h -- created from l_lx_elfppc32.bin, 520 (0x208) bytes
This file is part of the UPX executable compressor.
@ -27,12 +27,12 @@
*/
#define LINUX_ELFPPC32_LOADER_SIZE 460
#define LINUX_ELFPPC32_LOADER_ADLER32 0xd58495f3
#define LINUX_ELFPPC32_LOADER_CRC32 0x5b115466
#define LINUX_ELFPPC32_LOADER_SIZE 520
#define LINUX_ELFPPC32_LOADER_ADLER32 0xf7e3a67a
#define LINUX_ELFPPC32_LOADER_CRC32 0x6504240e
unsigned char linux_elfppc32_loader[460] = {
72, 0, 1,189,124, 0, 41,236,144,166, 0, 0,124,132, 26, 20, /* 0x 0 */
unsigned char linux_elfppc32_loader[520] = {
72, 0, 1,249,124, 0, 41,236,144,166, 0, 0,124,132, 26, 20, /* 0x 0 */
60, 0,128, 0, 61, 32,128, 0, 56, 99,255,255, 56,165,255,255, /* 0x 10 */
57, 64,255,255,125,168, 2,166, 72, 0, 1, 12, 57, 32, 0, 1, /* 0x 20 */
125, 41, 28, 44, 56, 99, 0, 4,124, 9, 0, 64,125, 41, 72, 20, /* 0x 30 */
@ -54,11 +54,15 @@ unsigned char linux_elfppc32_loader[460] = {
66, 0,255,248, 56,224, 1, 0,124, 7, 41,236,124, 7, 26, 44, /* 0x 130 */
75,255,255, 16,128, 6, 0, 0,125,168, 3,166, 56,165, 0, 1, /* 0x 140 */
56, 99, 0, 1,124,160, 40, 80,124,100, 24, 80,144,166, 0, 0, /* 0x 150 */
78,128, 0, 32,127,200, 2,166, 57, 0, 0, 0, 56,224, 0, 0, /* 0x 160 */
128,126, 0, 4, 56,192, 0, 50, 56,160, 0, 7, 56,128, 16, 0, /* 0x 170 */
124, 99,242, 20, 56, 0, 0, 90, 56, 99, 16, 11, 84, 99, 0, 38, /* 0x 180 */
68, 0, 0, 2, 64,163, 0, 8,127,224, 0, 8,127,233, 3,166, /* 0x 190 */
136,254, 0, 8, 56,193, 0,124,124,101, 27,120,124,104, 3,166, /* 0x 1a0 */
128,158, 0, 4, 56,126, 0, 12, 78,128, 4, 32,148, 33,255,128, /* 0x 1b0 */
188, 65, 0, 4,127,232, 2,166, 75,255,255,157 /* 0x 1c0 */
78,128, 0, 32, 72, 0, 0, 33, 83, 69, 76,105,110,117,120, 32, /* 0x 160 */
100,101,110,105,101,100, 32,101,120,101, 99,109,101,109, 46, 10, /* 0x 170 */
0, 0, 0, 0, 56,160, 0, 28,124,136, 2,166, 56, 96, 0, 2, /* 0x 180 */
56, 0, 0, 4, 68, 0, 0, 2, 56, 96, 0,127, 56, 0, 0, 1, /* 0x 190 */
68, 0, 0, 2,127,200, 2,166, 57, 0, 0, 0, 56,224,255,255, /* 0x 1a0 */
128,126, 0, 4, 56,192, 0, 50, 56,160, 0, 7, 56,128, 16, 0, /* 0x 1b0 */
124, 99,242, 20, 56, 0, 0, 90, 56, 99, 16, 11, 84, 99, 0, 38, /* 0x 1c0 */
68, 0, 0, 2, 65,163,255,144,127,233, 3,166,136,254, 0, 8, /* 0x 1d0 */
56,193, 0,124,124,101, 27,120,124,104, 3,166,128,158, 0, 4, /* 0x 1e0 */
56,126, 0, 12, 78,128, 4, 32,148, 33,255,128,188, 65, 0, 4, /* 0x 1f0 */
127,232, 2,166, 75,255,255,161 /* 0x 200 */
};

View File

@ -197,7 +197,7 @@ auxv_up(Elf32_auxv_t *av, unsigned type, unsigned const value)
// 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 long // returns relocation constant
xfind_pages(unsigned mflags, Elf32_Phdr const *phdr, int phnum, int fdi,
xfind_pages(unsigned mflags, Elf32_Phdr const *phdr, int phnum,
char **const p_brk
)
{
@ -217,9 +217,9 @@ xfind_pages(unsigned mflags, Elf32_Phdr const *phdr, int phnum, int fdi,
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_READ|PROT_WRITE|PROT_EXEC, mflags, fdi, 0);
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); // but keep the frames!
//mprotect(szlo + addr, hi - szlo, PROT_NONE); // but keep the frames!
return (unsigned long)addr - lo;
}
@ -237,7 +237,7 @@ do_xmap(
(char const *)ehdr);
char *v_brk;
unsigned long const reloc = xfind_pages(
((ET_DYN!=ehdr->e_type) ? MAP_FIXED : 0), phdr, ehdr->e_phnum, fdi, &v_brk);
((ET_DYN!=ehdr->e_type) ? MAP_FIXED : 0), phdr, ehdr->e_phnum, &v_brk);
int j;
for (j=0; j < ehdr->e_phnum; ++phdr, ++j)
if (xi && PT_PHDR==phdr->p_type) {
@ -257,15 +257,16 @@ do_xmap(
if (addr != mmap(addr, mlen, prot | (xi ? PROT_WRITE : 0),
MAP_FIXED | MAP_PRIVATE | (xi ? MAP_ANONYMOUS : 0),
fdi, phdr->p_offset - frag) ) {
(xi ? -1 : fdi), phdr->p_offset - frag) ) {
err_exit(8);
}
if (xi) {
unpackExtent(xi, &xo, f_decompress, f_unf);
}
if (PROT_WRITE & prot) {
bzero(addr, frag); // fragment at lo end
}
// Linux does not fixup the low end, so neither do we.
//if (PROT_WRITE & prot) {
// bzero(addr, frag); // fragment at lo end
//}
frag = (-mlen) &~ PAGE_MASK; // distance to next page boundary
if (PROT_WRITE & prot) {
bzero(mlen+addr, frag); // fragment at hi end
@ -279,7 +280,7 @@ ERR_LAB
addr += mlen + frag; /* page boundary on hi end */
if (addr < haddr) { // need pages for .bss
if (addr != mmap(addr, haddr - addr, prot,
MAP_FIXED | MAP_PRIVATE | MAP_ANONYMOUS, 0, 0 ) ) {
MAP_FIXED | MAP_PRIVATE | MAP_ANONYMOUS, -1, 0 ) ) {
err_exit(9);
}
}