Many changes for ELF shared libraries on Linux and Android

Handling more than 2 PT_LOAD (and thus more than 1 executable PT_LOAD)
required extensive changes.  But the bonus is the infrastructure
to support a different (de-)compression algorithm for each PT_LOAD.

https://github.com/upx/upx/issues/341   i386 .so decompression
https://github.com/upx/upx/issues/609   armv7 .so on Android
https://github.com/upx/upx/issues/625   amd64 .so execution
https://github.com/upx/upx/issues/654   armv7 .exe
Not yet: .so on MIPS, PowerPC, PowerPC64
This commit is contained in:
John Reiser
2023-03-04 17:37:25 -08:00
committed by Markus F.X.J. Oberhumer
parent fa56a1d9cd
commit adb0ca8250
121 changed files with 15796 additions and 6036 deletions
+117
View File
@@ -0,0 +1,117 @@
/* i386-linux.elf-so_entry.h
created from i386-linux.elf-so_entry.bin, 1246 (0x4de) bytes
This file is part of the UPX executable compressor.
Copyright (C) 1996-2023 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1996-2023 Laszlo Molnar
Copyright (C) 2000-2023 John F. Reiser
All Rights Reserved.
UPX and the UCL library are free software; you can redistribute them
and/or modify them under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of
the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; see the file COPYING.
If not, write to the Free Software Foundation, Inc.,
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
Markus F.X.J. Oberhumer Laszlo Molnar
<markus@oberhumer.com> <ezerotven+github@gmail.com>
John F. Reiser
<jreiser@users.sourceforge.net>
*/
#define STUB_I386_LINUX_ELF_SO_ENTRY_SIZE 1246
#define STUB_I386_LINUX_ELF_SO_ENTRY_ADLER32 0xc298fde4
#define STUB_I386_LINUX_ELF_SO_ENTRY_CRC32 0x5c27ebfe
unsigned char stub_i386_linux_elf_so_entry[1246] = {
/* 0x0000 */ 127, 69, 76, 70, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
/* 0x0010 */ 1, 0, 3, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
/* 0x0020 */ 48, 1, 0, 0, 0, 0, 0, 0, 52, 0, 0, 0, 0, 0, 40, 0,
/* 0x0030 */ 8, 0, 5, 0,144, 96,232,252,255,255,255, 1,219,116, 2,243,
/* 0x0040 */ 195,139, 30,131,238,252, 17,219,195, 91,102,131,123, 8, 2,116,
/* 0x0050 */ 1,244,141, 74,233, 81, 83,106, 0,106,255,106, 34,106, 3,255,
/* 0x0060 */ 51,106, 0,232,121, 0, 0, 0, 91,255, 51, 80,137,199,139, 75,
/* 0x0070 */ 4,141,115, 12, 1,241, 81, 49,219, 49,201,131,205,255,252,168,
/* 0x0080 */ 164,255,210,114,251,141, 65, 1,255,210, 17,192,255,210,115,248,
/* 0x0090 */ 131,232, 3,114, 11,193,224, 8,172,131,240,255,116, 45,137,197,
/* 0x00a0 */ 141, 65, 1,255,210, 17,201,255,210, 17,201,117, 13,137,193,131,
/* 0x00b0 */ 192, 2,255,210, 17,201,255,210,115,248,129,253, 0,243,255,255,
/* 0x00c0 */ 17,193, 86,141, 52, 47,243,164, 94,235,182, 89, 57,206,116, 1,
/* 0x00d0 */ 244, 91, 89, 81, 83,106, 5, 90,106,125, 88,205,128, 88, 80,255,
/* 0x00e0 */ 224,141, 92, 36, 4,106, 90, 88,205,128, 61, 0,240,255,255,114,
/* 0x00f0 */ 1,244,194, 24, 0, 90,232, 17, 0, 0, 0, 0, 46,115,121,109,
/* 0x0100 */ 116, 97, 98, 0, 46,115,116,114,116, 97, 98, 0, 46,115,104,115,
/* 0x0110 */ 116,114,116, 97, 98, 0, 46,114,101,108, 69, 76, 70, 77, 65, 73,
/* 0x0120 */ 78, 88, 0, 46,114,101,108, 69, 76, 70, 77, 65, 73, 78, 90, 0,
/* 0x0130 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
/* 0x0140 */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, 0, 0,176, 2, 0, 0, 8, 0, 0, 0,
/* 0x0260 */ 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0,
/* 0x0270 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
/* 0x0280 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 1, 0,
/* 0x0290 */ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
/* 0x02a0 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 3, 0,
/* 0x02b0 */ 0, 95,115,116, 97,114,116, 0, 3, 0, 0, 0, 2, 3, 0, 0,
/* 0x02c0 */ 2, 0, 0, 0, 2, 1, 0, 0,102,105,108,101, 32,102,111,114,
/* 0x02d0 */ 109, 97,116, 32,101,108,102, 51, 50, 45,105, 51, 56, 54, 10, 10,
/* 0x02e0 */ 83,101, 99,116,105,111,110,115, 58, 10, 73,100,120, 32, 78, 97,
/* 0x02f0 */ 109,101, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 83,105,122,101,
/* 0x0300 */ 32, 32, 32, 32, 32, 32, 86, 77, 65, 32, 32, 32, 32, 32, 32, 32,
/* 0x0310 */ 76, 77, 65, 32, 32, 32, 32, 32, 32, 32, 70,105,108,101, 32,111,
/* 0x0320 */ 102,102, 32, 32, 65,108,103,110, 32, 32, 70,108, 97,103,115, 10,
/* 0x0330 */ 32, 32, 48, 32, 69, 76, 70, 77, 65, 73, 78, 88, 32, 32, 32, 32,
/* 0x0340 */ 32, 32, 48, 99, 49, 32, 32, 48, 32, 32, 48, 32, 32, 48, 51, 52,
/* 0x0350 */ 32, 32, 50, 42, 42, 48, 32, 32, 67, 79, 78, 84, 69, 78, 84, 83,
/* 0x0360 */ 10, 32, 32, 49, 32, 69, 76, 70, 77, 65, 73, 78, 90, 32, 32, 32,
/* 0x0370 */ 32, 32, 32, 48, 54, 32, 32, 48, 32, 32, 48, 32, 32, 48,102, 53,
/* 0x0380 */ 32, 32, 50, 42, 42, 48, 32, 32, 67, 79, 78, 84, 69, 78, 84, 83,
/* 0x0390 */ 10, 83, 89, 77, 66, 79, 76, 32, 84, 65, 66, 76, 69, 58, 10, 48,
/* 0x03a0 */ 48, 48, 48, 48, 48, 48, 48, 32,108, 32, 32, 32, 32,100, 32, 32,
/* 0x03b0 */ 69, 76, 70, 77, 65, 73, 78, 88, 32, 48, 32, 69, 76, 70, 77, 65,
/* 0x03c0 */ 73, 78, 88, 10, 48, 48, 48, 48, 48, 48, 48, 48, 32,108, 32, 32,
/* 0x03d0 */ 32, 32, 32, 32, 32, 69, 76, 70, 77, 65, 73, 78, 88, 32, 48, 32,
/* 0x03e0 */ 95,115,116, 97,114,116, 10, 48, 48, 48, 48, 48, 48, 48, 48, 32,
/* 0x03f0 */ 108, 32, 32, 32, 32,100, 32, 32, 69, 76, 70, 77, 65, 73, 78, 90,
/* 0x0400 */ 32, 48, 32, 69, 76, 70, 77, 65, 73, 78, 90, 10, 10, 82, 69, 76,
/* 0x0410 */ 79, 67, 65, 84, 73, 79, 78, 32, 82, 69, 67, 79, 82, 68, 83, 32,
/* 0x0420 */ 70, 79, 82, 32, 91, 69, 76, 70, 77, 65, 73, 78, 88, 93, 58, 10,
/* 0x0430 */ 79, 70, 70, 83, 69, 84, 32, 32, 32, 84, 89, 80, 69, 32, 32, 32,
/* 0x0440 */ 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 86, 65, 76, 85, 69,
/* 0x0450 */ 10, 48, 48, 48, 48, 48, 48, 48, 51, 32, 82, 95, 51, 56, 54, 95,
/* 0x0460 */ 80, 67, 51, 50, 32, 32, 32, 32, 32, 32, 32, 32, 69, 76, 70, 77,
/* 0x0470 */ 65, 73, 78, 90, 10, 10, 82, 69, 76, 79, 67, 65, 84, 73, 79, 78,
/* 0x0480 */ 32, 82, 69, 67, 79, 82, 68, 83, 32, 70, 79, 82, 32, 91, 69, 76,
/* 0x0490 */ 70, 77, 65, 73, 78, 90, 93, 58, 10, 79, 70, 70, 83, 69, 84, 32,
/* 0x04a0 */ 32, 32, 84, 89, 80, 69, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
/* 0x04b0 */ 32, 32, 32, 32, 86, 65, 76, 85, 69, 10, 48, 48, 48, 48, 48, 48,
/* 0x04c0 */ 48, 50, 32, 82, 95, 51, 56, 54, 95, 80, 67, 51, 50, 32, 32, 32,
/* 0x04d0 */ 32, 32, 32, 32, 32, 69, 76, 70, 77, 65, 73, 78, 88, 10
};