Commit Graph

67 Commits

Author SHA1 Message Date
Markus F.X.J. Oberhumer 5dc54c7adc Merge branch 'devel' into devel4 2023-04-18 17:15:57 +02:00
Markus F.X.J. Oberhumer 320e5b850f all: yet more cleanups
Changes include:
  - use standard names for PE constants
  - add some more "noexcept"
  - improve upx_is_integral type-trait
  - introduce is_same_all and is_same_any type-traits
  - prepare TE-size checks in packer.h
  - CI updates
2023-04-18 17:02:13 +02: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
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
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 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
Markus F.X.J. Oberhumer d001a63bce Welcome 2022. 2022-09-04 04:24:39 +02:00
John Reiser d5263a56ce WIP: handling shared library
modified:   p_lx_elf.cpp
	modified:   p_unix.cpp
	modified:   p_unix.h
2021-05-22 16:03:53 -07: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 a8fa3ca5cf Use correct native types with "alignas(1)". 2021-01-04 21:13:49 +01:00
Markus F.X.J. Oberhumer 9131d5216f Welcome 2021. 2021-01-01 20:39:22 +01:00
Markus F.X.J. Oberhumer f7e2266c3f Start using some C++ 14 features. 2020-12-08 05:40:17 +01:00
John Reiser 4ae1576726 Mach-o LC_SEGMENTs not monotonic in file (__DWARF for 'go')
https://github.com/upx/upx/issues/222  go-1.14 (but not go-1.14.3 ?)
	modified:   ../p_mach.cpp
	modified:   ../p_mach.h
	modified:   ../p_unix.cpp
	modified:   ../p_unix.h
	modified:   ../stub/src/amd64-darwin.macho-main.c

	modified:   ../stub/amd64-darwin.macho-fold.h
	modified:   ../stub/arm.v5a-darwin.macho-fold.h
	modified:   ../stub/arm64-darwin.macho-fold.h
	modified:   ../stub/tmp/amd64-darwin.macho-fold.map
	modified:   ../stub/tmp/arm.v5a-darwin.macho-fold.map
	modified:   ../stub/tmp/arm64-darwin.macho-fold.map
2020-05-30 02:54:09 -07:00
Markus F.X.J. Oberhumer d1174385ef Welcome 2020. 2020-01-08 04:13:28 +01:00
Markus F.X.J. Oberhumer 3667fa4e44 Welcome 2019. 2019-02-15 11:04:09 +01:00
Markus F.X.J. Oberhumer 021c8db58a Welcome 2018. 2018-01-19 10:55:32 +01:00
John Reiser 9e8de4abe5 i386: new stub strategy to avoid problems with early mmap layout
The stub occupies the same region that execve() would create
for the original progam.  The stub copies everything to a new area,
erases the original region, replaces it with the de-compressed
program, and erases the copy of itself via the escape hatch.
The copy is inexpensive via mmap() of /proc/self/exe.

	modified:   stub/src/i386-linux.elf-entry.S
	modified:   stub/src/i386-linux.elf-fold.S
	modified:   stub/src/i386-linux.elf-main.c

	modified:   p_lx_elf.cpp
	modified:   p_lx_elf.h
	modified:   p_lx_interp.cpp
	modified:   p_lx_interp.h
	modified:   p_lx_sh.cpp
	modified:   p_lx_sh.h
	modified:   p_mach.cpp
	modified:   p_mach.h
	modified:   p_unix.cpp
	modified:   p_unix.h
	modified:   p_vmlinx.cpp

	plus .h, .map, .dump
2017-10-01 15:56:34 -07:00
John Reiser 8232aedf78 unpackExtent() segregates rewrite() from write()
Fix the reported output file size when un-compressing.
Part of https://github.com/upx/upx/issues/60
	modified:   p_lx_elf.cpp
	modified:   p_unix.cpp
	modified:   p_unix.h
2017-02-11 15:26:27 -08:00
Markus F.X.J. Oberhumer c4da5e81fa Welcome 2017. 2017-01-03 12:02:07 +01:00
Markus F.X.J. Oberhumer 61652a2989 Remove unused PackSolarisSparc. 2016-12-19 23:23:25 +01:00
Markus F.X.J. Oberhumer f7554374ab Update email address. 2016-09-28 12:25:01 +02:00
Markus F.X.J. Oberhumer 83828aa8a3 Update vim modelines. 2016-09-22 17:29:43 +02:00
Markus F.X.J. Oberhumer 96d9968db5 Welcome 2016. 2016-09-22 14:07:14 +02:00
Markus F.X.J. Oberhumer fb611a98f9 Welcome 2015. 2015-01-03 00:24:07 +01:00
Markus F.X.J. Oberhumer a26c982e93 Welcome 2014. 2014-01-07 23:05:10 +01:00
Markus F.X.J. Oberhumer 87a368a857 Welcome 2013. 2013-02-12 10:14:03 +01:00
John Reiser 8a5d352733 Portability: fix "EOFException: premature end of file" doing ELF on Windows.
OutputFile::read() was bad news; fsync() should work, but was missing.
2012-07-12 14:25:28 -07:00
Markus F.X.J. Oberhumer 43ce34d547 Welcome 2012. 2012-01-01 22:35:11 +01:00
Markus F.X.J. Oberhumer 9bf2b79d9e Enter 2011. 2011-01-03 08:49:23 +01:00
Markus F.X.J. Oberhumer 0aff9d8df4 Use consistent syntax for boolean preprocessor expressions. 2010-08-08 16:20:16 +02:00
Markus F.X.J. Oberhumer 6bc3197721 Enter 2010. 2010-02-06 17:15:49 +01:00
Markus F.X.J. Oberhumer 9adef80d6b Replace all __attribute_packed by new __packed_struct macros. 2009-02-12 05:20:23 +01:00
Markus F.X.J. Oberhumer 5ed689ceb0 Enter 2009. 2008-12-31 17:07:18 +01:00
Markus F.X.J. Oberhumer 7f9c47176a Introduce target endianness accessors get_teXX() and set_teXX() in packer.h to
replace all [gs]et_nativeXX() member functions.
2008-01-09 13:57:47 +01:00
Markus F.X.J. Oberhumer 6ff1bd5917 Update my email address. 2008-01-02 10:12:42 +01:00
Markus F.X.J. Oberhumer fa49dbe2cb Enter 2008. 2008-01-02 09:42:31 +01:00
John Reiser af1d059fff PackUnix::getLoader() result is not 'const' 2007-02-16 08:05:10 -08:00
Markus F.X.J. Oberhumer 5e83596a1b Enter 2007. 2007-01-14 13:08:58 +01:00
Markus F.X.J. Oberhumer 05d03f97fc Introduce Packer::bele. 2006-11-20 12:01:59 +01:00
John Reiser 0359e9c5c7 members of struct l_info loader header must be little endian 2006-11-18 11:42:08 -08:00
Markus F.X.J. Oberhumer db43910288 Enter 2006. 2006-06-16 15:17:29 +02:00
John Reiser 268e322e1c Extra parameter for compressWithFilters and packExtent,
to fix 2-pass problem with --brute on linux/elf386.
Only one decompression method is allowed, chosen by
smallest output for .text; but Elf headers come first.
	packer.cpp packer.h p_unix.cpp p_unix.h p_lx_elf.cpp

committer: jreiser <jreiser> 1140241030 +0000
2006-02-18 05:37:10 +00:00
John Reiser 09559bee8c Elf64
p_unix.h p_elf.h

committer: jreiser <jreiser> 1131570530 +0000
2005-11-09 21:08:50 +00:00
John Reiser 664a82e7c9 Start re-organizing the packing of Elf, by making Elf32 come first,
with Big endian and Little endian derived from it.
I386 still uses the old way, but PowerPC (both Linux and Darwin [Mac])
use the new way.
	p_elf.h p_lx_elf.cpp p_lx_elf.h p_lx_exc.cpp p_lx_exc.h
	p_unix.cpp p_unix.h p_vmlinx.cpp p_vmlinx.h p_vmlinz.cpp

committer: jreiser <jreiser> 1108940224 +0000
2005-02-20 22:57:04 +00:00
Markus F.X.J. Oberhumer 5f87e9891b Enter 2004.
committer: mfx <mfx> 1074623868 +0000
2004-01-20 18:37:48 +00:00
Markus F.X.J. Oberhumer 2162a01848 Enter 2003.
committer: mfx <mfx> 1042478199 +0000
2003-01-13 17:16:39 +00:00