From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55538) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XnGH7-0007Yl-74 for qemu-devel@nongnu.org; Sat, 08 Nov 2014 19:22:44 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XnGGz-0003tg-Nj for qemu-devel@nongnu.org; Sat, 08 Nov 2014 19:22:37 -0500 Message-ID: <545EB3C1.2090603@suse.de> Date: Sun, 09 Nov 2014 01:22:25 +0100 From: =?ISO-8859-15?Q?Andreas_F=E4rber?= MIME-Version: 1.0 References: <1415302993-26599-1-git-send-email-tommusta@gmail.com> In-Reply-To: <1415302993-26599-1-git-send-email-tommusta@gmail.com> Content-Type: text/plain; charset=iso-8859-15 Content-Transfer-Encoding: quoted-printable 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 , qemu-devel@nongnu.org, qemu-ppc@nongnu.org Cc: riku.voipio@iki.fi Am 06.11.2014 um 20:43 schrieb Tom Musta: > 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. Note that this reads a bit weird as both old and new code are adding, not subtracting. Regards, Andreas >=20 > Signed-off-by: Tom Musta > --- >=20 > Please include this patch in QEMU 2.2. =20 >=20 > Commit a93934fecd4dffc9d4b452b670c9506be5dea30d injected a regression o= f Linux > User Mode that I was able to detect on PowerPC 64 (but not x86). I sus= pect 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=20 > field. However, it also inadvertantly adjusted the upper address by th= e offset also. >=20 > linux-user/elfload.c | 2 +- > 1 files changed, 1 insertions(+), 1 deletions(-) >=20 > 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 =3D a; > } > - a +=3D phdr[i].p_memsz; > + a =3D phdr[i].p_vaddr + phdr[i].p_memsz; > if (a > hiaddr) { > hiaddr =3D a; > } >=20 --=20 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 N=FCrnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imend=F6rffer; HRB 21284 AG N=FCrnbe= rg