From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=59193 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PiC3u-0003BS-0m for qemu-devel@nongnu.org; Wed, 26 Jan 2011 15:33:54 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PiC3s-0002vz-RV for qemu-devel@nongnu.org; Wed, 26 Jan 2011 15:33:53 -0500 Received: from mail-wy0-f173.google.com ([74.125.82.173]:36567) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PiC3s-0002vp-MC for qemu-devel@nongnu.org; Wed, 26 Jan 2011 15:33:52 -0500 Received: by wyg36 with SMTP id 36so1359512wyg.4 for ; Wed, 26 Jan 2011 12:33:51 -0800 (PST) Message-ID: <4D408530.4020100@gmail.com> Date: Wed, 26 Jan 2011 21:33:52 +0100 From: Stefano Bonifazi MIME-Version: 1.0 Subject: Re: [Qemu-devel] qemu-user: relocating target code weakness References: <4D3D63B3.1030402@gmail.com> <4D3DD713.10405@twiddle.net> <4D3DF2A9.3080609@gmail.com> <4D3E292E.9090001@twiddle.net> <4D400080.7080501@gmail.com> <4D404002.1030601@twiddle.net> <87k4hrju7v.fsf@ginnungagap.bsc.es> <4D4081B5.3090909@twiddle.net> In-Reply-To: <4D4081B5.3090909@twiddle.net> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Richard Henderson Cc: QEMU Developers On 01/26/2011 09:19 PM, Richard Henderson wrote: > On 01/26/2011 12:17 PM, LluĂ­s wrote: >> Richard Henderson writes: >> >>> On 01/26/2011 03:07 AM, Stefano Bonifazi wrote: >>>> P.S. Please just answer that last question, whether it is possible to >>>> have a variable showing the upper bound of heap (some brk_end) for a >>>> target process >>> No, the heap grows until it reaches some other memory mapped entity. >> > From man brk(2) : >> >> "sbrk() increments the program's data space by increment bytes. >> Calling sbrk() with an increment of 0 can be used to find the >> current location of the program break." >> >> I already sent this to the list in a previous mail, but it seems you >> overlooked it as you were not an explicit recipient. > That's the current top of the heap. I answered the question as if > it was asking for the maximum top of the heap. > > > r~ Yup! I am concerned what can be the highest address used as heap by a target binary, because I am creating multiple instances of qemu-user, and I wanna prevent the target process images and heaps to overlap.. Good enough to know the mmu will stop giving memory when meeting another memory mapped region.. Moreover I think I'd have to call sbrk from within the target binary for resizing its heap, whereas I wanna control it from qemu-user that is loading, then translating and executing it.. @Luis: Yup sorry for not answering the previous post of yours, I thought I'd receive emails always when somebody answered a post I created at the beginning! Thank you! Regards, Stefano B.