1
0
mirror of https://github.com/upx/upx synced 2025-10-19 23:42:44 +08:00
Commit Graph

185 Commits

Author SHA1 Message Date
John Reiser
7b68aa7bdc Fix de-comression of shared libraries
modified:   p_elf_enum.h
	modified:   p_lx_elf.cpp
	modified:   p_lx_elf.h
2023-03-26 07:23:08 -07:00
John Reiser
5d15e57294 De-compression for 32-bit shared libraries on i686, ARM
https://github.com/upx/upx/issues/609
	modified:   p_lx_elf.cpp
	modified:   p_lx_elf.h
2023-03-23 16:29:25 -07:00
John Reiser
06fae05910 32-bit ARM Android shlib: DT_INIT_ARRAY without DT_INIT
De-compressor needs to catch up.
	modified:   p_elf_enum.h
	modified:   p_lx_elf.cpp
	modified:   p_lx_elf.h
	modified:   stub/src/i386-linux.elf-so_main.c
2023-03-22 10:44:17 -07:00
John Reiser
1320e3efdb PackLinuxElf32::canPackOSABI() isolates canPack() from OSABI weirdness
modified:   p_lx_elf.cpp
	modified:   p_lx_elf.h
2023-03-16 08:30:06 -07:00
John Reiser
ff7939c1c0 invert_pt_dynamic, sort_DTxx_offsets, elf_find_table_size
https://github.com/upx/upx/issues/655
        modified:   p_lx_elf.cpp
        modified:   p_lx_elf.h
2023-03-09 09:24:35 -08:00
John Reiser
adb0ca8250 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
2023-03-04 17:37:25 -08:00
Markus F.X.J. Oberhumer
f584c91386 all: canonicalize win32 and win64 file names 2023-02-10 09:49:29 +01:00
John Reiser
26d8e9c4c5 amd64-linux revamp for compressing shared libraries
Major changes: p_lx_elf.cpp and stub/src/amd64-linux.elf-so*.
(Includes run-time infrastructure for multiple de-compressors.)
	modified:   linker.cpp
	modified:   p_lx_elf.cpp
	modified:   p_lx_elf.h
	modified:   p_unix.cpp
	modified:   p_unix.h
	modified:   stub/Makefile
	modified:   stub/src/amd64-darwin.dylib-entry.S
	modified:   stub/src/amd64-darwin.macho-entry.S
	new file:   stub/src/amd64-expand.S
	modified:   stub/src/amd64-linux.elf-entry.S
	new file:   stub/src/amd64-linux.elf-so_entry.S
	new file:   stub/src/amd64-linux.elf-so_fold.S
	new file:   stub/src/amd64-linux.elf-so_fold.lds
	new file:   stub/src/amd64-linux.elf-so_main.c
	modified:   stub/src/amd64-linux.shlib-init.S
	modified:   stub/src/amd64-win64.pep.S
	modified:   stub/src/arch/amd64/nrv2b_d.S
	modified:   stub/src/arch/amd64/nrv2d_d.S
	modified:   stub/src/arch/amd64/nrv2e_d.S
           plus many generated stub/*.h and stub/tmp/*.bin.dump
2023-01-09 09:39:25 -08:00
John Reiser
64aa7540e2 Sync copyright year 2023
modified:   p_lx_elf.cpp
	modified:   p_lx_elf.h
	modified:   p_unix.cpp
	modified:   p_unix.h
2023-01-02 08:28:41 -08:00
Markus F.X.J. Oberhumer
dd1d5a92d2 all: welcome 2023 2023-01-01 19:49:30 +01:00
John Reiser
f9f28ff176 More work on "upx -d" de-compression
https://github.com/upx/upx/issues/629
https://github.com/upx/upx/issues/635
	modified:   p_elf_enum.h
	modified:   p_lx_elf.cpp
	modified:   p_lx_elf.h
	modified:   p_unix.cpp
2022-12-19 13:49:43 -08:00
John Reiser
d89813e911 Implement de-compress of --android-shlib
64-bit (arm64, aarch64) only for now.  NYI: 32-bit (armv7).
(Also: implied catch-up with all changes by Markus in the meantime.)
https://github.com/upx/upx/issues/599

	modified:   src/p_lx_elf.cpp
	modified:   src/p_lx_elf.h
2022-12-11 13:46:44 -08:00
Markus F.X.J. Oberhumer
16de3e78a5 src: try to fix canUnpack() confusion - see packer.h 2022-11-10 06:00:53 +01:00
John Reiser
d3ad6d25d8 PackLinuxElf64::asl_pack2_Shdrs() for better fit in logical flow
modified:   p_lx_elf.cpp
	modified:   p_lx_elf.h
2022-10-24 12:56:49 +02:00
John Reiser
5d9f71bb13 asl_pack1_Shdrs()
modified:   p_lx_elf.cpp
	modified:   p_lx_elf.h
2022-10-24 12:56:49 +02:00
John Reiser
82ed25bb44 Major fix 64-bit un_shlib_1() and unpack(), but not --android-shlib
Also canUnpack() is really a 'bool' which sets overlay_offset
when 'true'; confusing!
        https://github.com/upx/upx/issues/599 (partial)
	modified:   p_lx_elf.cpp
	modified:   p_lx_elf.h
	modified:   p_unix.h
2022-10-24 12:56:49 +02:00
John Reiser
ec33109b22 clang-10 requires the use of 'override'
Discovered during gitlab auto-build for https://github.com/upx/upx/issues/595
	modified:   Makefile
	modified:   p_armpe.h
	modified:   p_djgpp2.h
	modified:   p_lx_elf.h
	modified:   p_lx_exc.h
	modified:   p_lx_interp.h
	modified:   p_lx_sh.h
	modified:   p_mach.h
	modified:   p_ps1.h
	modified:   p_tmt.h
	modified:   p_unix.h
	modified:   p_vmlinx.h
	modified:   p_vmlinz.h
	modified:   p_w32pe.h
	modified:   p_w64pep.h
	modified:   pefile.h
2022-09-27 18:15:48 +02:00
John Reiser
a13b4d10d9 After upx-3.96, the de-compressing stub for ELF moved
... so unpack() of newly-compressed ELF by upx-3.96 now says
"CantUnpackException: need a newer version of UPX"
        https://github.com/upx/upx/issues/595
	modified:   p_lx_elf.h
	modified:   packer.h
2022-09-27 18:09:20 +02:00
Markus F.X.J. Oberhumer
d001a63bce Welcome 2022. 2022-09-04 04:24:39 +02:00
John Reiser
03436d2415 Bug in handling DT_GNU_HASH table.
Fix includes a more-general and stronger heuristic to find the end of
GNU_HASH table when there is no ElfXX_Shdr for it.  64-bit only for now.
(This is needed to help prevent SIGSEGV when processing tampered .exe.)

https://github.com/upx/upx/issues/577
	modified:   p_elf_enum.h
	modified:   p_lx_elf.cpp
	modified:   p_lx_elf.h
2022-05-30 14:24:21 -07:00
John Reiser
076aaf829a WIP: Elf64 shlib compress+decompress seems to work
modified:   p_lx_elf.cpp
	modified:   p_lx_elf.h
	modified:   p_unix.cpp
2021-07-05 13:47:19 -07:00
John Reiser
85f0c5a445 WIP: Elf64 shlib cleanup
modified:   file.cpp
	modified:   file.h
	modified:   p_elf_enum.h
	modified:   p_lx_elf.cpp
	modified:   p_lx_elf.h
2021-07-02 18:33:38 -07:00
John Reiser
181c752488 WIP: un_shlib_1
modified:   p_lx_elf.cpp
	modified:   p_lx_elf.h
2021-05-08 11:14:31 -07:00
John Reiser
0a69e7803b Fix errors detected by "make run-testsuite".
total_out does not matter when option -t writes no output file.
Subtle error in generateElfHdr() [noted by address sanitizer].
New member function is_LOAD32() to avoid confusion with (1+ LO_PROC).
	modified:   p_lx_elf.cpp
	modified:   p_lx_elf.h
2021-03-06 15:31:56 -08:00
John Reiser
35555bfb8a WIP: PackLinuxElf64::unpack working for shared libraries (non-Android)
modified:   p_lx_elf.cpp
	modified:   p_lx_elf.h
	modified:   p_unix.cpp
2021-03-05 16:20:36 -08:00
John Reiser
2be03028f4 WIP: un_shlib_1
modified:   p_lx_elf.cpp
	modified:   p_lx_elf.h
2021-02-27 19:27:12 -08:00
John Reiser
fb844a8ed1 total_in, total_out move to PackUnix
modified:   p_lx_elf.cpp
	modified:   p_lx_elf.h
	modified:   p_lx_interp.cpp
	modified:   p_mach.cpp
	modified:   p_unix.cpp
	modified:   p_unix.h
2021-02-22 16:13:40 -08:00
John Reiser
23f63e4196 WIP unpacking ELF shared library
modified:   Makefile
	modified:   lzma-sdk
	modified:   p_lx_elf.cpp
	modified:   p_lx_elf.h
	modified:   p_mach.cpp
	modified:   p_unix.cpp
	modified:   p_unix.h
	modified:   packer.cpp
	modified:   packer.h
	modified:   stub/arm64-linux.elf-fold.h
	modified:   stub/src/arm64-linux.elf-fold.S
	modified:   stub/tmp/arm64-linux.elf-fold.map
2021-01-15 14:11:09 -08:00
Markus F.X.J. Oberhumer
9131d5216f Welcome 2021. 2021-01-01 20:39:22 +01:00
John Reiser
7841e15583 Prefer MemBuffer instead of New()+delete
https://github.com/upx/upx/issues/428
	modified:   p_lx_elf.cpp
	modified:   p_lx_elf.h
2020-12-05 10:31:55 -08:00
John Reiser
4e2fdb464a Defend against bad PT_DYNAMIC
https://github.com/upx/upx/issues/391
	modified:   p_lx_elf.cpp
	modified:   p_lx_elf.h
2020-07-23 05:09:52 -07:00
Markus F.X.J. Oberhumer
92f072cf70 Silence some compiler warnings. 2020-01-08 04:49:27 +01:00
Markus F.X.J. Oberhumer
d1174385ef Welcome 2020. 2020-01-08 04:13:28 +01:00
John Reiser
49766388bc Fix compression and de-compression of Android shared libraries
Handle relocation (and DT_INIT_ARRAY[0]==NULL) when !DT_INIT.
Warn about missing --android-shlib if (ET_DYN && !DF_1_PIE && Arm*).
	modified:   p_lx_elf.cpp
	modified:   p_lx_elf.h
https://github.com/upx/upx/issues/265
https://github.com/upx/upx/issues/262
https://github.com/upx/upx/issues/259
https://github.com/upx/upx/issues/243
https://github.com/upx/upx/issues/229
https://github.com/upx/upx/issues/220
2019-04-14 19:59:08 -07:00
Markus F.X.J. Oberhumer
3667fa4e44 Welcome 2019. 2019-02-15 11:04:09 +01:00
John Reiser
d60fef753f check_pt_load(); u32_t, u64_t; (off_t) is not unsigned!
https://github.com/upx/upx/issues/247
	modified:   p_lx_elf.cpp
	modified:   p_lx_elf.h
2019-02-01 19:31:57 -08:00
John Reiser
0509edf08d ElfXX_Sym.st_name is always 32 bits
modified:   p_lx_elf.cpp
	modified:   p_lx_elf.h
2018-12-16 11:32:58 -08:00
John Reiser
780a4347b8 Check DT_HASH and DT_GNU_HASH.
https://github.com/upx/upx/issues/235  POC2,POC4
Also cleanup checking of symbol number and .st_name
in POC1,POC3,POC5,POC7,POC9,POC11
	modified:   p_lx_elf.cpp
	modified:   p_lx_elf.h
2018-12-15 19:16:14 -08:00
John Reiser
606ad08dd1 Check symbol number and .st_name
https://github.com/upx/upx/issues/235  POC1,POC3,POC7,POC9
	modified:   p_elf_enum.h
	modified:   p_lx_elf.h
	modified:   p_lx_elf.cpp
2018-12-14 21:32:49 -08:00
John Reiser
0051dfc84f --android-shlib: Relocate ABS _edata etc.
https://github.com/upx/upx/issues/220
	modified:   p_lx_elf.cpp
	modified:   p_lx_elf.h
2018-09-16 15:10:40 -07:00
John Reiser
8a793d5942 ELF shlib when no DT_INIT (especially --android-shlib)
https://github.com/upx/upx/issues/191
	modified:   p_lx_elf.cpp
	modified:   p_lx_elf.h
2018-04-04 09:15:18 -07:00
John Reiser
5e9b6bd69d more ELF shlib when no DT_INIT (especially Android): hook DT_INIT_ARRAY[0]
https://github.com/upx/upx/issues/191  [partial, not finished]
	modified:   p_lx_elf.cpp
	modified:   p_lx_elf.h
	modified:   stub/src/arm.v4a-linux.shlib-init.S
	modified:   stub/src/arm.v4t-linux.shlib-init.S
2018-03-26 16:30:52 -07:00
John Reiser
7a625a449a ELF shlib without DT_INIT: steal a DT_NULL from PT_DYNAMIC
https://github.com/upx/upx/issues/191  [partial, not finished]
	modified:   p_lx_elf.cpp
	modified:   p_lx_elf.h
2018-03-24 09:41:58 -07:00
John Reiser
6722e8972e cleanup dead variables: is_big, all_pages
modified:   p_lx_elf.cpp
	modified:   p_lx_elf.h
2018-03-23 08:06:31 -07:00
John Reiser
95cedb6640 upgrade ::unpack for --android-shlib
modified:   p_elf_enum.h
    	modified:   p_lx_elf.cpp
    	modified:   p_lx_elf.h
    	modified:   stub/src/arm64-linux.shlib-init.S
    	modified:   stub/src/arm.v4t-linux.shlib-init.S
2018-02-02 14:50:56 -08:00
John Reiser
be83788666 --android-shlib for 32-bit ARM
Includes better handling of asl_delta in execution stub.

    	modified:   p_lx_elf.cpp
    	modified:   p_lx_elf.h
    	modified:   stub/src/arm.v4t-linux.shlib-init.S
    	modified:   stub/src/arm64-linux.shlib-init.S
2018-01-27 22:00:16 -08:00
John Reiser
85f53b210d de-compression of arm64 --android-shlib
modified:   src/p_lx_elf.cpp
	modified:   src/p_lx_elf.h
	modified:   src/stub/src/arm64-linux.shlib-init.S
2018-01-24 15:39:46 -08:00
John Reiser
7d2913709c MemBuffer lowmem; for shlib, especially android
modified:   p_lx_elf.cpp
	modified:   p_lx_elf.h
2018-01-21 14:03:52 -08:00
John Reiser
3623199e8d Merge branch 'devel' into jreiser-android 2018-01-21 10:55:56 -08:00
John Reiser
a34deee4f5 work in progress for --android-shlib
modified:   p_lx_elf.cpp
	modified:   p_lx_elf.h
2018-01-20 16:34:52 -08:00