From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46625) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xmdsy-0004QM-14 for qemu-devel@nongnu.org; Fri, 07 Nov 2014 02:23:09 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Xmdsx-0000zq-0r for qemu-devel@nongnu.org; Fri, 07 Nov 2014 02:23:07 -0500 Received: from [2001:4b98:dc0:45:216:3eff:fe3d:166f] (port=37942 helo=afflict.kos.to) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xmdsw-0000zd-R8 for qemu-devel@nongnu.org; Fri, 07 Nov 2014 02:23:06 -0500 Date: Fri, 7 Nov 2014 09:23:04 +0200 From: Riku Voipio Message-ID: <20141107072304.GA10002@afflict.kos.to> References: <1415302993-26599-1-git-send-email-tommusta@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1415302993-26599-1-git-send-email-tommusta@gmail.com> Subject: Re: [Qemu-devel] [PATCH] linux-user: Do not subtract offset from end address List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Tom Musta Cc: riku.voipio@iki.fi, qemu-ppc@nongnu.org, qemu-devel@nongnu.org, jonas.maebe@elis.ugent.be On Thu, Nov 06, 2014 at 01:43:13PM -0600, Tom Musta wrote: > When computing the upper address of a program segment, do not subtract the > offset from the virtual address; instead compute the sum of the virtual address > and the memory size. Thanks, I'll test this and try to get it applied ASAP. Jonas, can you have a look and provide your Acked-by/Tested-by ? Riku > Signed-off-by: Tom Musta > --- > > Please include this patch in QEMU 2.2. > > Commit a93934fecd4dffc9d4b452b670c9506be5dea30d injected a regression of Linux > User Mode that I was able to detect on PowerPC 64 (but not x86). I suspect that > large page size on the host has something to do with it. In any case, that commit > adjusted the lower address of a program segment by the program header's offset > field. However, it also inadvertantly adjusted the upper address by the offset also. > > linux-user/elfload.c | 2 +- > 1 files changed, 1 insertions(+), 1 deletions(-) > > diff --git a/linux-user/elfload.c b/linux-user/elfload.c > index 84123ba..e2596a4 100644 > --- a/linux-user/elfload.c > +++ b/linux-user/elfload.c > @@ -1824,7 +1824,7 @@ static void load_elf_image(const char *image_name, int image_fd, > if (a < loaddr) { > loaddr = a; > } > - a += phdr[i].p_memsz; > + a = phdr[i].p_vaddr + phdr[i].p_memsz; > if (a > hiaddr) { > hiaddr = a; > } > -- > 1.7.1