From owner-freebsd-emulation@FreeBSD.ORG Mon Jun 4 09:06:52 2007 Return-Path: X-Original-To: freebsd-emulation@freebsd.org Delivered-To: freebsd-emulation@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 1D63B16A41F; Mon, 4 Jun 2007 09:06:52 +0000 (UTC) (envelope-from bsam@ipt.ru) Received: from mail.ipt.ru (mail.ipt.ru [80.253.10.82]) by mx1.freebsd.org (Postfix) with ESMTP id BF42B13C480; Mon, 4 Jun 2007 09:06:51 +0000 (UTC) (envelope-from bsam@ipt.ru) Received: from admin.sem.ipt.ru ([192.168.12.1] helo=ipt.ru) by mail.ipt.ru with esmtp (Exim 4.62 (FreeBSD)) (envelope-from ) id 1Hv8WU-000Exg-4X; Mon, 04 Jun 2007 13:06:46 +0400 Received: from bsam by ipt.ru with local (Exim 4.63 (FreeBSD)) (envelope-from ) id 1Hv8Vz-0002dn-DZ; Mon, 04 Jun 2007 13:06:15 +0400 To: Roman Divacky References: <32640.217.221.237.206.1180701628.squirrel@krisma.oltrelinux.com> <20070601131741.GA55533@freebsd.org> <34078888@srv.sem.ipt.ru> <20070602111412.GA2515@freebsd.org> <18017.38384.749310.450410@gromit.timing.com> <20070602212549.GA17133@freebsd.org> From: Boris Samorodov Date: Mon, 04 Jun 2007 13:06:15 +0400 In-Reply-To: <20070602212549.GA17133@freebsd.org> (Roman Divacky's message of "Sat\, 2 Jun 2007 23\:25\:49 +0200") Message-ID: <67969672_-_@srv.sem.ipt.ru> User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.99 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: freebsd-emulation@freebsd.org, Paolo Pisati Subject: [Seems to be solved] Re: Linux_base-fc4/6, FreeBSD 6/7 and some Linux binaries X-BeenThere: freebsd-emulation@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Development of Emulators of other operating systems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Jun 2007 09:06:52 -0000 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@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@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 [-] 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