[Seems to be solved] Re: Linux_base-fc4/6,
FreeBSD 6/7 and some Linux binaries
Boris Samorodov
bsam at ipt.ru
Mon Jun 4 09:06:52 UTC 2007
On Sat, 2 Jun 2007 23:25:49 +0200 Roman Divacky wrote:
> On Sat, Jun 02, 2007 at 10:08:16AM -0600, John E Hein wrote:
> > Roman Divacky wrote at 13:14 +0200 on Jun 2, 2007:
> > > On Fri, Jun 01, 2007 at 07:38:47PM +0400, Boris Samorodov wrote:
> > > > On Fri, 1 Jun 2007 15:17:41 +0200 Roman Divacky wrote:
> > > >
> > > > > > [piso at piso ~/devkitARM]$ file ./bin/git
> > > > > > ./bin/git: ELF 32-bit LSB executable, Intel 80386, version 1, statically
> > > > > > linked, corrupted section header size
> > > >
> > > > > hard to say whats going on but "corrupted section header size" looks bad
> > > > > to me.
> > > >
> > > > Do we support linux binaries which are packed with UPX executable
> > > > packer? ;-)
> >
> > I tried a simple hello world program (with extra spaces to make it
> > compressable), compiled and upx'd under linux. It worked fine under
> > FreeBSD 6-stable (and file reported the same 'corrupted section header
> > size').
> >
> > That doesn't prove that it will work with all programs, of course.
> >
> >
> > > never heard about it... is there any way how to "unpack" it, thus making
> > > it normal linux elf?
> >
> > Yep. 'upx -d'
> ok.. problem solved ;) given that we support the upx program with the ports
> collection
I hope so. ;-)
I've just committed two new ports (archivers/linux-ucl and
archivers/linux-upx) which should help here. One should just install
the latter (archivers/linux-upx), the former should be installed as the
runtime dependency.
Cases in which those ports should help:
-----
srv% uname -a
FreeBSD srv.sem.ipt.ru 6.2-RELEASE FreeBSD 6.2-RELEASE #0: Mon Jan 15 17:30:44 MSK 2007 bsam at srv.sem.ipt.ru:/usr/obj/usr/src/sys/GENERIC amd64
srv% file b2fxec
b2fxec: ELF 32-bit LSB executable, Intel 80386, version 1, statically linked, corrupted section header size
srv% strings b2fxec | head -3
Linux
$Info: This file is packed with the UPX executable packer http://upx.sf.net $
$Id: UPX 1.25 Copyright (C) 1996-2004 the UPX Team. All Rights Reserved. $
srv% ./b2fxec
srv% ktrace -i ./b2fxec
srv% kdump
10127 ktrace RET ktrace 0
10127 ktrace CALL execve(0x7fffffffe84a,0x7fffffffe608,0x7fffffffe618)
10127 ktrace NAMI "./b2fxec"
10127 b2fxec RET execve 0
10127 b2fxec CALL getpid
10127 b2fxec RET getpid 10127/0x278f
10127 b2fxec CALL open(0xffffd68c,0,0)
10127 b2fxec NAMI "/compat/linux/proc/10127/exe"
10127 b2fxec NAMI "/proc/10127/exe"
10127 b2fxec RET open JUSTRETURN
10127 b2fxec CALL open(0xffffd68c,0,0)
10127 b2fxec NAMI "/compat/linux/proc/10127/file"
10127 b2fxec NAMI "/proc/10127/file"
10127 b2fxec RET open JUSTRETURN
10127 b2fxec CALL old.lseek(0xfffffffe,0x5d0,0)
10127 b2fxec RET old.lseek -1 errno -9 Unknown error: -9
10127 b2fxec CALL exit(0x7f)
-----
Install the port and:
-----
srv% /compat/linux/usr/bin/upx -d b2fxec
Ultimate Packer for eXecutables
Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
UPX 1.25 Markus F.X.J. Oberhumer & Laszlo Molnar Jun 29th 2004
File size Ratio Format Name
-------------------- ------ ----------- -----------
914192 <- 339145 37.10% linux/386 b2fxec
Unpacked 1 file.
srv% brandelf -t Linux b2fxec
srv% ./b2fxec
b2fxeC v0.6a-pre2 - (c) 2002-4 Jouni 'Mr.Spiv' Korhonen
Usage: ./b2fxec [-<options>] infile outfile
Options:
-t string Set game title (32 chars max, default=infile)
-a string Set game author info (32 chars max, default='')
-b file Use uncompressed .bmp file for icon (default=GPlogo)
-B file Use raw .bin file for icon (default=GPlogo)
-g Save outfile as GXB (default=FXE)
-A n Select algorithm (0=FXE0, 2=FXE2, 3=FXE3), default=3
-h Show help
-d Save file as raw data (no GXB or FXE headers)
-f Fast decompression (sets 132MHz clockspeed)
-F MHz Set decompression clockspeed (MHz=132,133,156,166,180)
-----
WBR
--
Boris Samorodov (bsam)
Research Engineer, http://www.ipt.ru Telephone & Internet SP
FreeBSD committer, http://www.FreeBSD.org The Power To Serve
More information about the freebsd-emulation
mailing list