Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compressed mipsel binaries hang with upx 3.96 #339

Closed
lancethepants opened this issue Jan 30, 2020 · 2 comments
Closed

Compressed mipsel binaries hang with upx 3.96 #339

lancethepants opened this issue Jan 30, 2020 · 2 comments
Milestone

Comments

@lancethepants
Copy link

What's the problem (or question)?

Mipsel binaries compress with upx 3.96 don't execute, and just hang. I've tried both the upx release binaries, and my self compiled binaries, and both give the same behavior. Here is a strace when a program will hang.

root@RT-C0C1C0F68DE0:~# strace ./upx
execve("./upx", ["./upx"], 0x7f899ce0 /* 22 vars */) = 0
open("/proc/self/exe", O_RDONLY)        = 3
mmap(NULL, 423856, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x2aaa8000
mmap(0x2aaa8000, 422838, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3, 0) = 0x2aaa8000
cacheflush(0x2ab0ed78, 0xa38, 0x3)      = 0
mprotect(0x2ab0d000, 10160, PROT_READ|PROT_EXEC) = 0
readlink("/proc/self/exe", "/mmc/upx", 4095) = 8
cacheflush(0x7fdadae0, 0xd4, 0x3)       = 0
mmap(0x400000, 2310144, PROT_NONE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x400000
mmap(0x400000, 2180028, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x400000
cacheflush(0x400000, 0xd4, 0x3)         = 0
cacheflush(0x4000d4, 0x2142e8, 0x3)     = 0
mprotect(0x400000, 2180028, PROT_READ|PROT_EXEC) = 0

What should have happened?

Expect regular binary execution

Do you have an idea for a solution?

No

How can we reproduce the issue?

Try running a release upx mipsel binary (which itself is compressed with upx) on a mipsel target, and execution should hang with no output. If you decompress it then it will operate. But any other binary you compress with it will also hang.

Please tell us details about your environment.

  • UPX version used (upx --version):
upx 3.96
UCL data compression library 1.03
zlib data compression library 1.2.11
LZMA SDK version 4.43
Copyright (C) 1996-2020 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1996-2020 Laszlo Molnar
Copyright (C) 2000-2020 John F. Reiser
Copyright (C) 2002-2020 Jens Medoch
Copyright (C) 1995-2005 Jean-loup Gailly and Mark Adler
Copyright (C) 1999-2006 Igor Pavlov
UPX comes with ABSOLUTELY NO WARRANTY; for details type 'upx -L'.
  • Host Operating System and version:

Tomato Firmware running on Linksys E1550 router

root@RT-C0C1C0F68DE0:~# uname -a
Linux RT-C0C1C0F68DE0 2.6.22.19 #2 Wed Dec 31 11:25:40 MST 2014 mips GNU/Linux
  • Host CPU architecture:
root@RT-C0C1C0F68DE0:~# cat /proc/cpuinfo
system type             : Broadcom BCM5357 chip rev 1 pkg 8
processor               : 0
cpu model               : MIPS 74K V4.9
BogoMIPS                : 149.91
cpu MHz                 : 300
wait instruction        : no
microsecond timers      : yes
tlb_entries             : 64
extra interrupt vector  : no
hardware watchpoint     : yes
ASEs implemented        : mips16 dsp
shadow register sets    : 1
VCED exceptions         : not available
VCEI exceptions         : not available

unaligned_instructions  : 0
  • Target Operating System and version: Same as host
  • Target CPU architecture: Same as host
@lancethepants lancethepants changed the title Compressed mipsel Binaries hang with upx 3.96 Compressed mipsel binaries hang with upx 3.96 Jan 30, 2020
jreiser added a commit that referenced this issue Feb 9, 2020
#342
#339
	modified:   src/stub/src/include/linux.h
   consequences:
	modified:   .github/travis_testsuite_1-expected_sha256sums.sh
	modified:   src/stub/mips.r3000-linux.elf-fold.h
	modified:   src/stub/mipsel.r3000-linux.elf-fold.h
	modified:   src/stub/tmp/mips.r3000-linux.elf-fold.map
	modified:   src/stub/tmp/mipsel.r3000-linux.elf-fold.map
@jreiser
Copy link
Collaborator

jreiser commented Feb 9, 2020

Please try the tip of devel branch. Commit 4fb1d41 fixes the problem for big-endian (see #342), and should fix it for little-endian, too. If not, then please upload ("Attach files by ...") a specific executable which does not work. Compress the upload using zip, gzip, or .tgz in order to save space on Github.

@lancethepants
Copy link
Author

lancethepants commented Feb 10, 2020

I compiled from the devel branch, and that seems to have fixed it.
thanks!

@markus-oberhumer markus-oberhumer added this to the v4.0.0 milestone Feb 11, 2020
markus-oberhumer pushed a commit that referenced this issue Aug 17, 2022
#342
#339
	modified:   src/stub/src/include/linux.h
   consequences:
	modified:   .github/travis_testsuite_1-expected_sha256sums.sh
	modified:   src/stub/mips.r3000-linux.elf-fold.h
	modified:   src/stub/mipsel.r3000-linux.elf-fold.h
	modified:   src/stub/tmp/mips.r3000-linux.elf-fold.map
	modified:   src/stub/tmp/mipsel.r3000-linux.elf-fold.map
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants