From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=44168 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PhSNL-0001NO-Cm for qemu-devel@nongnu.org; Mon, 24 Jan 2011 14:47:06 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PhSMz-0006XD-B7 for qemu-devel@nongnu.org; Mon, 24 Jan 2011 14:46:55 -0500 Received: from a.mail.sonic.net ([64.142.16.245]:46059) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PhSMz-0006WI-4F for qemu-devel@nongnu.org; Mon, 24 Jan 2011 14:46:33 -0500 Message-ID: <4D3DD713.10405@twiddle.net> Date: Mon, 24 Jan 2011 11:46:27 -0800 From: Richard Henderson MIME-Version: 1.0 Subject: Re: [Qemu-devel] qemu-user: relocating target code weakness References: <4D3D63B3.1030402@gmail.com> In-Reply-To: <4D3D63B3.1030402@gmail.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefano Bonifazi Cc: QEMU Developers On 01/24/2011 03:34 AM, Stefano Bonifazi wrote: > I am working on a project based on qemu-user. More exactly it is > qemu-ppc (version 0.13.0) with x86 host. All the project and > documentation about qemu will be open for everybody as it is a > project for my university that is a public one.. I have the need to > relocate the target code in the memory space to some other starting > address. So I went inside linux-user/elfload.c: load_elf_binary and > there I found many things that according to me are someway buggy or > just "weak" .. Yes. Have a look at http://lists.gnu.org/archive/html/qemu-devel/2010-07/msg01626.html where I tried to clean this up last year. The patch never got properly reviewed, however. All that said, unless you have an executable that's been properly prepared for relocation, e.g. an ET_DYN binary instead of a normal ET_EXEC binary, you will *not* have enough information to do what you're suggesting. r~