Commit Graph

3146 Commits

Author SHA1 Message Date
John Reiser 9f651ee40f Ignore ElfXX_Shdr if not CMD_COMPRESS; beware unpack when PT_DYNAMIC in other PT_LOAD
https://github.com/upx/upx/issues/200
	modified:   p_lx_elf.cpp
2018-04-26 08:34:58 -07:00
John Reiser 774c8c3fd4 Fix forgotten get_teXX() in canPack() and invert_pt_dynamic()
https://github.com/upx/upx/issues/200
	modified:   p_lx_elf.cpp
2018-04-25 23:05:17 -07:00
John Reiser b711d2f750 TLS callbacks: one entry only
https://github.com/upx/upx/issues/186  [partial, incomplete]
(Laszlo hints there is more, but meanwhile this does fix some.)
	modified:   pefile.cpp
2018-04-06 13:44:24 -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 99f52c60ed Merge branch 'Mattiwatti-offset-to-rva-fix' into devel
https://github.com/upx/upx/pull/193
2018-04-02 09:08:57 -07:00
Mattiwatti 2c2e108301 PE: fix comparison against a constant value
... due to size always being assigned to right before this comparison,
and instead check against the RVA and size of the export directory
from the header. (note: this is still stricter than the Windows loader
which ignores all of these except the directory RVA, but if the name RVA
is invalid the PE was probably tampered with).
Change 'offset' to 'RVA' in exception message; this field is always an RVA

  Author:    Mattiwatti <mattiwatti@gmail.com>
	modified:   pefile.cpp
2018-04-02 09:07:29 -07:00
John Reiser 563165e6ae Defensive patches from hints by Sean Williams <rootkit@google.com>
modified:   pefile.cpp
2018-03-29 16:55:21 -07:00
John Reiser f1a31b4793 ELf32::unpack; Elf64 parity with Elf32 for shlib with no DT_INIT
https://github.com/upx/upx/issues/191  [partial, not finished]
	modified:   p_lx_elf.cpp
2018-03-27 19:15:47 -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 9b990c4eae clarity
modified:   p_lx_elf.cpp
2018-03-24 13:52:29 -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 c2b62359d5 arm32 stubs on linux: allow 0==user_DT_INIT as nop; somewhat expensive
modified:   stub/arm.v5a-linux.shlib-init.h
	modified:   stub/arm.v5t-linux.shlib-init.h
	modified:   stub/src/arm.v4a-linux.shlib-init.S
	modified:   stub/src/arm.v4t-linux.shlib-init.S
	modified:   stub/tmp/arm.v5a-linux.shlib-init.bin.dump
	modified:   stub/tmp/arm.v5t-linux.shlib-init.bin.dump
2018-03-24 08:55:04 -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 fefe7a3452 Fix segTEXT.vmsize and data for entry to shlib.
https://github.com/upx/upx/issues/57
	modified:   p_mach.cpp
2018-03-19 14:59:20 -07:00
John Reiser 90a1322929 Also check for wrap-around when checking oversize involving e_shoff and e_shnum.
raised by https://github.com/upx/upx/pull/190
	modified:   p_lx_elf.cpp
2018-03-15 21:25:20 -07:00
John Reiser d698eb69e2 Fix decompression stub for arm64 --lzma
https://github.com/upx/upx/issues/181
	modified:   stub/src/arch/arm64/v8/lzma_d.S
2018-02-24 13:04:15 -08:00
John Reiser 0ef00e9b82 Fix --lzma (and so --ultra-brute) for 32-bit ARM
https://github.com/upx/upx/issues/167  (comment #14)
	modified:   stub/src/arm.v4a-linux.elf-entry.S
	modified:   ../.github/travis_testsuite_1.sh
2018-02-03 15:44:00 -08: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 d736da4208 Elf32, not shared lib: leave alone the hole between .text and .data
In theory Linux might put pages there (and that would be a problem),
but postpone closing the gap until more experience.
	modified:   p_lx_elf.cpp
2018-01-28 13:30:10 -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 5a28a51abc android shlib: better handling of asl_delta in execution stub
modified:   p_lx_elf.cpp
    	modified:   stub/src/arm64-linux.shlib-init.S
2018-01-26 12:35:06 -08:00
John Reiser 8a84df752c Compiler nit: ptr->ENUM is not always considered a constant
modified:   p_lx_elf.cpp
2018-01-26 11:54:33 -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 5d13c6cd01 elfout is unset for shlib in PackLinuxElf64::updateLoader
modified:   p_lx_elf.cpp
2018-01-22 16:15:53 -08:00
John Reiser 98a0d381e9 Merge branch 'devel' into jreiser-android
modified:   p_lx_elf.cpp
2018-01-22 13:55:45 -08:00
John Reiser e1d20fd0b5 Fix wobble in PackLinuxElf64::pack2
modified:   p_lx_elf.cpp
2018-01-22 13:48:26 -08:00
John Reiser d1035ecd8f Fix PLT for --android-shlib
modified:   p_lx_elf.cpp
	modified:   p_lx_elf.h
2018-01-22 13:05:18 -08:00
John Reiser 0e651facdd Fix PLT for --android-shlib
NYI: unpack of PLT, DT_INIT etc.  Also e_entry.
	modified:   p_lx_elf.cpp
2018-01-22 13:01:20 -08:00
John Reiser 9fdddfc332 work in progress: de-compression of --android-shlib
OK except for asl_delta not removed from DT_INIT, DT_INIT_ARRAY,
DT_FINI_ARRAY, DT_PREINIT_ARRAY
	modified:   ../p_lx_elf.cpp
2018-01-21 18:59:21 -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 e4b23f7a47 Merge branch 'devel' of https://github.com/upx/upx into devel 2018-01-21 10:30:42 -08:00
John Reiser f056ecdcd5 pefile: Allow overlap of MZ header and PE header (h.nexepos==0x10)
https://github.com/upx/upx/issues/169
This means .codebase is aliased to .nexepos, with both equal to 0x10.
	modified:   pefile.cpp
2018-01-21 10:29:17 -08:00
John Reiser 857a03a074 fix sh_offset for new Shdr[e_shstrndx]
modified:   p_lx_elf.cpp
2018-01-20 16:41:32 -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
John Reiser fc9c8ae482 fix updating of DT_INIT
modified:   p_lx_elf.cpp
2018-01-20 09:48:28 -08:00
John Reiser 08c63f06eb p_lx_elf.h: phdro for --android-shlib
modified:   p_lx_elf.cpp
	modified:   p_lx_elf.h
2018-01-19 22:01:56 -08:00
John Reiser bbff510ef1 Merge branch 'devel' into jreiser-android
Conflicts:
	src/p_lx_elf.cpp
	src/p_lx_elf.h

	modified:   ../.github/travis_testsuite_1.sh
	modified:   p_exe.cpp
	modified:   p_lx_elf.cpp
	modified:   p_lx_elf.h
	modified:   pefile.cpp
2018-01-19 21:51:49 -08:00
Markus F.X.J. Oberhumer f747435952 For consistency, add missing "virtual". 2018-01-19 20:21:18 +01:00
Markus F.X.J. Oberhumer e6edad8f46 Clean up OptVar handling. 2018-01-19 19:50:28 +01:00
Markus F.X.J. Oberhumer 05e44b9644 Fix powerpc64 cross build. 2018-01-19 15:05:43 +01:00
Markus F.X.J. Oberhumer 16bb7ab841 clang-format files. 2018-01-19 14:18:47 +01:00
Markus F.X.J. Oberhumer 9248f02557 Silence some gcc-8-snapshot compiler warnings. 2018-01-19 14:13:58 +01:00
Markus F.X.J. Oberhumer 9485a56af1 Update Travis. 2018-01-19 11:30:34 +01:00
Markus F.X.J. Oberhumer 021c8db58a Welcome 2018. 2018-01-19 10:55:32 +01:00
John Reiser 8ab180edf8 MS-DOS .exe (not PE): default to file_size when ih.m512 and ih.p512 are zero
https://github.com/upx/upx/issues/169
	modified:   p_exe.cpp
2018-01-18 12:00:38 -08:00
John Reiser ab35b685d4 Fix pefile.cpp bad range checking for reloc type 3 and 10
modified:   pefile.cpp
2018-01-18 11:11:19 -08:00
John Reiser 86745721ee MSVC strikes again
modified:   p_lx_elf.cpp
	modified:   p_lx_elf.h
2018-01-15 16:27:00 -08:00
John Reiser c34fe09a79 Revamp --android-shlib
Android "Oreo" wants to deal with ElfXX_Shdr[].  So splice 4KiB into PT_LOAD[0]
with an "extra" copy of them.  This requires careful relocation processing.
It also costs a page at run time, and an average of a page in the file
(depending on fragmentation at the boundary between r-x and rw- .)

https://github.com/upx/upx/issues/124
https://github.com/upx/upx/issues/139
https://github.com/upx/upx/issues/142

	modified:   p_elf_enum.h
	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
	modified:   stub/src/arm64-linux.shlib-init.S

	modified:   stub/arm.v5a-linux.shlib-init.h
	modified:   stub/arm.v5t-linux.shlib-init.h
	modified:   stub/arm64-linux.shlib-init.h

	modified:   ../.github/travis_testsuite_1.sh
2018-01-15 16:08:34 -08:00
John Reiser 1fa9ff2c05 --android-shlib handles implicit relocation in PLT
modified:   p_lx_elf.cpp
	modified:   p_lx_elf.h
2018-01-15 15:45:37 -08:00