1
0
mirror of https://github.com/upx/upx synced 2025-10-26 23:36:41 +08:00
Commit Graph

533 Commits

Author SHA1 Message Date
John Reiser
e2f60adc95 Detect 0==DT_SYMTAB in invert_pt_dynamic()
https://github.com/upx/upx/issues/333
	modified:   p_lx_elf.cpp
2020-01-14 18:45:52 -08:00
John Reiser
1bb93d4fce Detect bad e_shstrtab better.
https://github.com/upx/upx/issues/332
	modified:   p_lx_elf.cpp
2020-01-13 17:26:31 -08:00
John Reiser
eb90eab632 Detect bogus DT_SYMENT.
https://github.com/upx/upx/issues/331
	modified:   p_lx_elf.cpp
2020-01-13 17:10:02 -08: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
cb5f590e10 More hacking Android shlib.
https://github.com/upx/upx/issues/318
	modified:   p_elf_enum.h
	modified:   p_lx_elf.cpp
2019-12-12 20:23:33 -08:00
John Reiser
5ed9c66ed9 Hack Android shared libraries on arm64.
https://github.com/upx/upx/issues/318
	modified:   p_lx_elf.cpp
2019-12-12 17:05:50 -08:00
John Reiser
b8f52d14f4 user_init_va on AARCH64
https://github.com/upx/upx/issues/318  (work-in-progress)
	modified:   p_elf_enum.h
	modified:   p_lx_elf.cpp
2019-12-04 14:26:46 -08:00
John Reiser
5d295c24f0 DT_NEEDED can be duplicated
modified:   p_lx_elf.cpp
2019-11-26 19:33:27 -08:00
John Reiser
8be9da8280 Avoid bogus values in PT_DYNAMIC segment.
Detect duplicate DT_*.
Detect out-of-bounds hashtab and gashtab.
Detect missing DT_REL, DT_RELA.
Detect out-of-bounds d_val.
https://github.com/upx/upx/issues/317
	modified:   p_lx_elf.cpp
2019-11-23 20:06:14 -08:00
John Reiser
23570097cf MSVC barfs on {unsigned == long int) [because sizeof() is the same!]
https://github.com/upx/upx/issues/283
	modified:   p_lx_elf.cpp
2019-07-14 13:39:09 -07:00
John Reiser
593a69ce25 PT_LOAD[0] with ElfXX.Ehdr only
https://github.com/upx/upx/issues/283
	modified:   p_lx_elf.cpp
2019-07-14 13:08:56 -07: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
John Reiser
f23267bddd Fix rotate+lop of PT_INTERP in shared library
Found while working on https://github.com/upx/upx/issues/262
but probably does not help that bug.
	modified:   p_lx_elf.cpp
2019-04-01 21:35:53 -07:00
John Reiser
d4e2d7e8a8 arm64 (aarch64) and PAGE_SIZE > 4KiB
Future: use prctl(PR_SET_MM, PR_SET_MM_START_BRK, addr)
https://github.com/upx/upx/issues/254
	modified:   p_lx_elf.cpp
	modified:   stub/src/amd64-linux.elf-main.c
2019-03-01 20:31:41 -08:00
Markus F.X.J. Oberhumer
3667fa4e44 Welcome 2019. 2019-02-15 11:04:09 +01:00
John Reiser
d1c80154f6 SHT_NOTE with ~SHF_ALLOC; as for 'gold' linker version
https://github.com/upx/upx/issues/243
	modified:   p_lx_elf.cpp
2019-02-12 21:13:24 -08:00
John Reiser
3c2bfc742e g++ -Wsign-compare is not as picky as MSVC warning C4018: '<': signed/unsigned mismatch
https://github.com/upx/upx/issues/247
	modified:   p_lx_elf.cpp
2019-02-09 08:04:58 -08: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
9719a7dd56 MSVC pettiness
https://github.com/upx/upx/issues/238
	modified:   p_lx_elf.cpp
2018-12-26 18:38:30 -08:00
John Reiser
c097233bf3 Stronger checks for DT_HASH, DT_GNU_HASH
https://github.com/upx/upx/issues/238
	modified:   p_lx_elf.cpp
2018-12-26 13:00:20 -08:00
John Reiser
69a583281f MemBuffer::subref() for 64-bit offsets; better diagnosis for bad .e_shoff
https://github.com/upx/upx/issues/235 (POC14)
	modified:   mem.cpp
	modified:   mem.h
	modified:   p_lx_elf.cpp
2018-12-16 16:00:15 -08:00
John Reiser
8e90c9af2b Corner cases for e_shnum vs e_shstrndx
modified:   p_lx_elf.cpp
2018-12-16 15:36:51 -08:00
John Reiser
a784284b7f Check user_init_off. Also remove '\n' from error messages.
https://github.com/upx/upx/issues/235  POC11
	modified:   p_lx_elf.cpp
2018-12-16 12:14:22 -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
7ca20f424f Typos
modified:   p_lx_elf.cpp
2018-12-15 21:17:26 -08:00
John Reiser
b74d51c2a8 More checking of e_shstrndx
https://github.com/upx/upx/issues/235  POC6
	modified:   p_lx_elf.cpp
2018-12-15 21:12:15 -08:00
John Reiser
58061cd121 Check .p_offset
https://github.com/upx/upx/issues/235  POC13
	modified:   p_lx_elf.cpp
2018-12-15 20:59:45 -08:00
John Reiser
b8f6be5389 More checking of DT_HASH and DT_GNU_HASH
https://github.com/upx/upx/issues/235  POC12
	modified:   p_lx_elf.cpp
2018-12-15 20:43:33 -08:00
John Reiser
7c766b3313 Check e_shstrndx and Shdr.st_name
https://github.com/upx/upx/issues/235  POC10
	modified:   p_lx_elf.cpp
2018-12-15 20:27:20 -08:00
John Reiser
91b81b587b Abandon when outrageous Elf64_Dyn.d_tag
https://github.com/upx/upx/issues/235  POC8
	modified:   p_lx_elf.cpp
2018-12-15 19:35:13 -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
f88b85e126 MSVC error C4146: unary minus operator applied to unsigned type, result still unsigned
modified:   p_lx_elf.cpp
2018-10-09 20:27:19 -07:00
John Reiser
cb8b1595a1 Pay more attention to 0==.e_shnum
modified:   p_lx_elf.cpp
2018-10-09 19:38:43 -07:00
John Reiser
37d6a34e58 MSVC is a nimrod. (All verions 10.0 through 14.1)
"(4074): error C4146: unary minus operator applied to unsigned type, result still unsigned"
So what?  Many programmers are much better than the typical Microsoft coder.
The C standard GUARANTEES that unsigned arithmetic uses two's complement,
ignores overflow, and the result is what the hardware adder produces.
	modified:   p_lx_elf.cpp
2018-09-23 20:45:07 -07: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
9f294e6ce5 Fix "upx -d" de-compression when input is compressed Android shlib.
https://github.com/upx/upx/issues/220
	modified:   p_lx_elf.cpp
2018-09-16 13:09:43 -07:00
John Reiser
6489ec9bba Fix PT_LOAD for ELF shared library.
modified:   p_lx_elf.cpp
2018-08-20 19:36:27 -07:00
John Reiser
8f9713ed53 Appease MSVC warning C4018: s/igned/unsigned mismatch
modified:   p_lx_elf.cpp
2018-08-13 18:47:42 -07:00
John Reiser
90eb68b3b9 Adapt to 4 PT_LOAD in binutils-2.31 and gcc-8.2.1 (Fedora 29)
0:        PF_R: .gnu.hash .dynsym .dynstr
1: PF_X | PF_R: .plt .plt.sec .text
2:        PF_R: .rodata .hash
3: PF_W | PF_R: .data.rel.ro .dynamic .got .got.plt .data .bss
	modified:   p_lx_elf.cpp

https://github.com/upx/upx/issues/212 (partial, Fedora 29)
2018-08-13 17:36:56 -07:00
John Reiser
95fcbcb4f2 ::PackLinuxElf64amd() sets lg2_page back to 12.
https://github.com/upx/upx/issues/212 (partial, Fedora 29)
	modified:   p_lx_elf.cpp
2018-08-10 20:28:40 -07:00
John Reiser
d9288213ec More checking of PT_DYNAMIC and its contents.
https://github.com/upx/upx/issues/206
	modified:   p_lx_elf.cpp
2018-05-17 21:48:26 -07:00
John Reiser
614c86fb7d --force-pie inhibits treating as shared library (for 'rust', etc.)
https://github.com/upx/upx/issues/200
	modified:   main.cpp
	modified:   options.h
	modified:   p_lx_elf.cpp
2018-04-26 13:44:17 -07:00
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
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
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
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
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
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
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
Markus F.X.J. Oberhumer
05e44b9644 Fix powerpc64 cross build. 2018-01-19 15:05:43 +01:00
Markus F.X.J. Oberhumer
021c8db58a Welcome 2018. 2018-01-19 10:55:32 +01: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
df94f4288a picky, picky
modified:   p_lx_elf.cpp
2018-01-11 12:09:43 -08:00
John Reiser
969efe687d MSVC pecadillos
modified:   p_lx_elf.cpp
	modified:   pefile.cpp
2018-01-11 12:01:00 -08:00
John Reiser
4854c03096 uint64_t ==> upx_uint64_t
MSVC error C2065: 'uint64_t' : undeclared identifier
	modified:   p_lx_elf.cpp
	modified:   p_lx_elf.h
	modified:   p_mach.cpp
2018-01-06 09:33:04 -08:00
John Reiser
e853119c77 canonicalize bool in OR
MSVC error C4805: '|' : unsafe mix of type 'bool' and type 'unsigned int' in operation
	modified:   p_lx_elf.cpp
2018-01-06 09:20:46 -08:00
John Reiser
507e19945e more checking of PT_DYNAMIC
https://github.com/upx/upx/issues/166
	modified:   p_lx_elf.cpp
	modified:   p_lx_elf.h
2017-12-30 22:31:50 -08:00
John Reiser
e04bf9e4bc more checking of PT_DYNAMIC
https://github.com/upx/upx/issues/164
	modified:   p_lx_elf.cpp
	modified:   p_lx_elf.h
2017-12-28 17:40:04 -08:00
John Reiser
990988f920 More checking of input Phdr and Shdr
https://github.com/upx/upx/issues/157
	modified:   p_lx_elf.cpp
2017-12-18 10:36:43 -08:00
John Reiser
7c21c4513e Android 64-bit ARM shared library stub: use 4Ki page size until more is known
https://github.com/upx/upx/issues/124
	modified:   p_lx_elf.cpp
	modified:   stub/arm64-linux.shlib-init.h
	modified:   stub/src/arm64-linux.shlib-init.S
	modified:   stub/tmp/arm64-linux.shlib-init.bin.dump
2017-12-08 20:05:21 -08:00
John Reiser
b413f3da26 ELF shared library: PT_NOTE can prevent packing
Android build environment post-processing is adding a PT_NOTE
("Android", 21, "r16-beta1") at the high end of PT_LOAD[0],
above the stub; the runtime linker looks there before de-compression.
https://github.com/upx/upx/issues/124
	modified:   p_lx_elf.cpp
2017-11-20 10:08:24 -08:00
John Reiser
19c2c1edcf Android 8.0 (Oreo) wants 0!=.e_shstrndx in a shared library
https://github.com/upx/upx/issues/142
It should not matter what the .sh_name is; only the .sh_type matters.
	modified:   p_lx_elf.cpp
2017-11-07 11:12:23 -08:00
John Reiser
0430e7931e PowerPC64 stub: on syscall, real Linux trashes r13 and below
(except r1, r2, and input args!) So, r12 .e_entry for musl
must copy from a saved register.  [qemu-ppc64 doesn't trash registers!]
	modified:   ../.github/travis_testsuite_1.sh
	modified:   p_lx_elf.cpp
	modified:   stub/src/amd64-linux.elf-main.c
	modified:   stub/src/powerpc64le-linux.elf-fold.S
	also .h  .fold.map
2017-10-27 20:07:32 -07:00
John Reiser
e61ada944d debug info for shared library on stderr under "-D"
modified:   p_lx_elf.cpp
2017-10-25 21:32:17 -07:00
John Reiser
38c8b84a26 Align hatch_off.
modified:   p_lx_elf.cpp
2017-10-20 17:23:55 -07:00
John Reiser
c652626a37 32-bit shared libs reduce Phdr[1].p_align to 4096, like 64-bit.
This saves space when PAGE_SIZE is larger than 4096: MIPS, etc.
	modified:   p_lx_elf.cpp
2017-10-20 16:35:27 -07:00
John Reiser
06f6e47ebf Fix stub for MIPS shared libraries
https://github.com/upx/upx/issues/135
	modified:   p_lx_elf.cpp
	modified:   stub/src/mipsel.r3000-linux.shlib-init.S
	also .h .bin.dump
2017-10-20 16:16:35 -07:00
John Reiser
403b180b1d Compress shared libraries for mips and mipsel in ELF on Linux
modified:   p_lx_elf.cpp
	modified:   stub/Makefile
	new file:   stub/mips.r3000-linux.shlib-init.h
	new file:   stub/mipsel.r3000-linux.shlib-init.h
	new file:   stub/src/mips.r3000-linux.shlib-init.S
	new file:   stub/src/mipsel.r3000-linux.shlib-init.S
	new file:   stub/tmp/mips.r3000-linux.shlib-init.bin.dump
	new file:   stub/tmp/mipsel.r3000-linux.shlib-init.bin.dump
2017-10-19 13:47:36 -07:00
John Reiser
ee008acfbd amd64 implements --is_ptinterp
https://github.com/upx/upx/issues/121
	modified:   ../.github/travis_testsuite_1.sh
	modified:   p_lx_elf.cpp
	modified:   stub/src/amd64-linux.elf-entry.S
	modified:   stub/src/amd64-linux.elf-fold.S
	modified:   stub/src/amd64-linux.elf-main.c
	also .h, .map, .bin.dump
2017-10-18 13:10:49 -07:00
John Reiser
eafa136c69 Appease error C4146 unary minus operator applied to unsigned type, result still unsigned
Microsoft Optimizing Compiler 16.00.40219.01, 19.00.24215.1, 19.11.25507.1; others
	modified:   p_lx_elf.cpp
2017-10-17 08:44:08 -07:00
John Reiser
402c885987 Merge branch 'jreiser-elfstub' into devel
New stub strategy on Linux:  Linux adds too many other segments
to the address space: [vdso], [sigpage], ...; and qemu might
arrange them differently.  Thus the only reliable mappings
are the PT_LOAD of the compressed file itself; all other
address space is unknown!  First, the compressed file uses
.bss to occupy all unused pages up to the original brk(0).
Then at run time, the stub gets another mapping of /proc/self/exe,
and uncompresses the user program on top of the original pages.
[*BSD unchanged for now?]

	modified:   stub/src/powerpc64le-linux.elf-fold.S
	modified:   stub/src/powerpc64le-linux.elf-entry.S
	modified:   stub/src/powerpc64le-darwin.macho-entry.S
	modified:   stub/src/powerpc64le-darwin.dylib-entry.S
	modified:   stub/src/powerpc-linux.elf-fold.S
	modified:   stub/src/powerpc-linux.elf-entry.S
	modified:   stub/src/mipsel.r3000-linux.elf-fold.S
	modified:   stub/src/mipsel.r3000-linux.elf-entry.S
	modified:   stub/src/i386-linux.elf-main.c
	modified:   stub/src/i386-linux.elf-fold.S
	modified:   stub/src/i386-linux.elf-entry.S
	modified:   stub/src/arm64-linux.elf-main.c
	modified:   stub/src/arm64-linux.elf-fold.S
	modified:   stub/src/arm64-linux.elf-entry.S
	modified:   stub/src/arm.v4a-linux.elf-fold.S
	modified:   stub/src/arm.v4a-linux.elf-entry.S
	modified:   stub/src/amd64-linux.elf-main.c
	modified:   stub/src/amd64-linux.elf-fold.S
	modified:   stub/src/amd64-linux.elf-entry.S
	modified:   p_unix.cpp
	modified:   p_mach.cpp
	modified:   p_lx_sh.cpp
	modified:   p_lx_interp.cpp
	modified:   p_lx_elf.cpp
	modified:   p_lx_elf.h
	modified:   p_lx_interp.h
	modified:   p_lx_sh.h
	modified:   p_mach.h
	modified:   p_unix.h
	modified:   stub/src/arch/mips/r3000/macros.ash
	modified:   stub/src/arch/powerpc/32/ppc_regs.h
	modified:   stub/src/arch/powerpc/64le/ppc_regs.h
	modified:   stub/src/include/linux.h
	modified:   stub/Makefile
	modified:   ../.github/travis_testsuite_1.sh
	also .h .map .bin.dump
2017-10-14 14:26:11 -07:00
John Reiser
e0bc040b0a mips stub uses new strategy
modified:   p_lx_elf.cpp
	modified:   stub/src/arch/mips/r3000/macros.ash
	modified:   stub/src/arm64-linux.elf-entry.S
	modified:   stub/src/i386-linux.elf-main.c
	modified:   stub/src/mipsel.r3000-linux.elf-entry.S
	modified:   stub/src/mipsel.r3000-linux.elf-fold.S
	also .h, .bin.dump, .map
2017-10-12 21:04:10 -07:00
John Reiser
1522293be0 arm64: stub uses new strategy
modified:   p_lx_elf.cpp
	modified:   stub/src/powerpc64le-linux.elf-entry.S
	modified:   stub/src/amd64-linux.elf-main.c
	modified:   stub/src/arm64-linux.elf-entry.S
	modified:   stub/src/arm64-linux.elf-fold.S
	modified:   stub/src/arm64-linux.elf-main.c
	also .h, .map, .bin.dump
2017-10-10 14:51:03 -07:00
John Reiser
b37bc99330 PowerPC64: stub uses new strategy
Needed: expert on TOC for big-endian.  glibc, musl, gcc disagree
on layout (is the .func first?) and usage for .e_entry.
	modified:   p_lx_elf.cpp
	modified:   stub/src/amd64-linux.elf-main.c
	modified:   stub/src/amd64-linux.elf-fold.S
	modified:   stub/src/arch/powerpc/64le/ppc_regs.h
	modified:   stub/src/i386-linux.elf-main.c
	modified:   stub/src/powerpc-linux.elf-entry.S
	modified:   stub/src/powerpc-linux.elf-fold.S
	modified:   stub/src/powerpc64le-darwin.dylib-entry.S
	modified:   stub/src/powerpc64le-darwin.macho-entry.S
	modified:   stub/src/powerpc64le-linux.elf-entry.S
	modified:   stub/src/powerpc64le-linux.elf-fold.S
	modified:   stub/Makefile
	also .h, .bin.dump, .map
2017-10-07 13:43:12 -07:00
John Reiser
7f905724b1 amd64: stub uses new strategy
modified:   stub/src/amd64-linux.elf-entry.S
	modified:   stub/src/amd64-linux.elf-fold.S
	modified:   p_lx_elf.cpp
	also .h, .bin.dump, .map
2017-10-06 11:15:34 -07:00
John Reiser
2bf5bb1625 arm: stub uses new strategy
modified:   stub/src/arm.v4a-linux.elf-entry.S
	modified:   stub/src/arm.v4a-linux.elf-fold.S
	modified:   p_lx_elf.cpp
	plus .h, .bin.dump, .map
2017-10-05 17:07:30 -07:00
John Reiser
7bace76176 Protect against bad crafted input.
https://github.com/upx/upx/issues/129
	modified:   p_lx_elf.cpp
2017-10-03 09:55:34 -07:00
John Reiser
ef336dbcc6 Protect against bad crafted input.
https://github.com/upx/upx/issues/128
	modified:   p_lx_elf.cpp
2017-10-02 21:47:40 -07: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
6470c748db Flush ACC_UNUSED(adrc); and its predecessors from stub for MIPS.
modified:   p_lx_elf.cpp
2017-09-24 20:07:31 -07:00
John Reiser
f4947cc2ae Work-around Ubuntu runtime bug loading shlib on ARM.
Use --android-shlib to activate the work-around.
https://bugs.launchpad.net/bugs/1712938
https://github.com/upx/upx/issues/116
	modified:   p_elf_enum.h
	modified:   p_lx_elf.cpp
2017-08-24 19:52:30 -07:00
Markus F.X.J. Oberhumer
ef8a7f330d Silence some compiler warnings. 2017-07-23 02:59:51 +02:00
Markus F.X.J. Oberhumer
b72e0f3060 Disable debugging section. 2017-07-23 02:59:51 +02:00
John Reiser
6de021d8d8 Fix MIPS, at least ET_EXEC.
ET_DYN not tested.  Also /proc/self/exe is not proected [use getenv("   ")]
	modified:   p_lx_elf.cpp
	modified:   stub/src/i386-linux.elf-main.c
	modified:   stub/src/mipsel.r3000-linux.elf-fold.S
	modified:   ../.github/travis_testsuite_1.sh

	also .h .dump .map for mips
2017-06-27 20:53:44 -07:00
John Reiser
9be86621bf PowerPC64 unifies into amd64-linux.elf-main.c
Also reconcile ppc32 and ppc64, especially *.S
	modified:   p_lx_elf.cpp
	modified:   stub/src/amd64-linux.elf-main.c
	modified:   stub/src/i386-linux.elf-main.c
	modified:   stub/src/powerpc-linux.elf-entry.S
	modified:   stub/src/powerpc64le-linux.elf-entry.S
	modified:   stub/src/powerpc64le-linux.elf-fold.S
	modified:   stub/src/powerpc64le-linux.elf-main.c
	modified:   ../.github/travis_testsuite_1.sh

	also corresponding *.h *.map *.dump
2017-06-27 14:58:13 -07:00
John Reiser
8f572e5fe6 Rewrite stubs for 32-bit arm and i386 for -pie (Position-Independent Executable)
Coming next: MIPS and PowerPC.
	modified:   p_lx_elf.cpp
	modified:   stub/src/i386-linux.elf-main.c
	modified:   stub/src/arm.v4a-linux.elf-entry.S
	modified:   stub/src/arm.v4a-linux.elf-fold.S
	modified:   stub/src/i386-linux.elf-entry.S
	modified:   stub/src/i386-linux.elf-fold.S
	modified:   ../.github/travis_testsuite_1.sh

	also associated *.h *.map *.dump files
2017-06-14 09:57:19 -07:00