qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Andreas Färber" <afaerber@suse.de>
To: Tom Musta <tommusta@gmail.com>,
	qemu-devel@nongnu.org, qemu-ppc@nongnu.org
Cc: riku.voipio@iki.fi
Subject: Re: [Qemu-devel] [PATCH] linux-user: Do not subtract offset from end address
Date: Sun, 09 Nov 2014 01:22:25 +0100	[thread overview]
Message-ID: <545EB3C1.2090603@suse.de> (raw)
In-Reply-To: <1415302993-26599-1-git-send-email-tommusta@gmail.com>

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

> 
> Signed-off-by: Tom Musta <tommusta@gmail.com>
> ---
> 
> 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;
>              }
> 


-- 
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 21284 AG Nürnberg

  parent reply	other threads:[~2014-11-09  0:22 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-06 19:43 [Qemu-devel] [PATCH] linux-user: Do not subtract offset from end address Tom Musta
2014-11-07  7:23 ` Riku Voipio
2014-11-07 12:55   ` Jonas Maebe
2014-11-09  0:22 ` Andreas Färber [this message]
2014-11-10 17:53   ` Tom Musta

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=545EB3C1.2090603@suse.de \
    --to=afaerber@suse.de \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    --cc=riku.voipio@iki.fi \
    --cc=tommusta@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).