From patchwork Tue Nov 11 06:50:36 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Riku Voipio X-Patchwork-Id: 40558 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f70.google.com (mail-wg0-f70.google.com [74.125.82.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 1CED0241C9 for ; Tue, 11 Nov 2014 06:51:44 +0000 (UTC) Received: by mail-wg0-f70.google.com with SMTP id x13sf4912335wgg.5 for ; Mon, 10 Nov 2014 22:51:43 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:date :message-id:in-reply-to:references:cc:subject:precedence:list-id :list-unsubscribe:list-archive:list-post:list-help:list-subscribe :errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list; bh=NBeX9+2B5nq71HGgcvumjbXy5jhk4vRUzfYFXEDtNHk=; b=KHoqv6J1suLO93LDd7a3uU1xLz/xNJckKL1N7W2cVBKo1xglc1Pwf7/uiCPPT5rSjR fsk9FTKZs9O23PcJhU6/kp2cgZxdQBEbuKlu1RVeUvExVJvaFwRjJJk+oDuqbDE6Dqcv 19vJN6xwwfeQoBMPqNEbPXA/WXDj12OkVsDuc3ska27gcU88UkefvPHcRfPmVh/Dpo+u Jp0K5wh6UGRfGsh80zZ++OaU72NQIoIBxJUIrF9d52XPVgj+0hGZUXqxlLvm6D3F7rIS o5+1YBZxVZdE0UYkRg2j9zb3s8RQ3Xp8Vb6J6Nx0pXg6Cg+Ndkj2nmUJkqJY6z8AcyHu rDFw== X-Gm-Message-State: ALoCoQlmvEv+AwsdNouzULL4T7vOx+q4kKDM++Dr+6OSoxPUKuXT8YGtEkKaH/Wj15WkW5msePl5 X-Received: by 10.152.26.72 with SMTP id j8mr6271291lag.3.1415688703012; Mon, 10 Nov 2014 22:51:43 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.153.7.68 with SMTP id da4ls431344lad.87.gmail; Mon, 10 Nov 2014 22:51:42 -0800 (PST) X-Received: by 10.112.54.229 with SMTP id m5mr34404380lbp.11.1415688702633; Mon, 10 Nov 2014 22:51:42 -0800 (PST) Received: from mail-lb0-f177.google.com (mail-lb0-f177.google.com. [209.85.217.177]) by mx.google.com with ESMTPS id ol9si4492530lbb.2.2014.11.10.22.51.42 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 10 Nov 2014 22:51:42 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.177 as permitted sender) client-ip=209.85.217.177; Received: by mail-lb0-f177.google.com with SMTP id z12so369422lbi.22 for ; Mon, 10 Nov 2014 22:51:42 -0800 (PST) X-Received: by 10.112.62.166 with SMTP id z6mr7491996lbr.74.1415688702078; Mon, 10 Nov 2014 22:51:42 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.184.201 with SMTP id ew9csp212523lbc; Mon, 10 Nov 2014 22:51:41 -0800 (PST) X-Received: by 10.180.109.17 with SMTP id ho17mr30955314wib.4.1415688701102; Mon, 10 Nov 2014 22:51:41 -0800 (PST) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id ej1si21570620wib.72.2014.11.10.22.51.40 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 10 Nov 2014 22:51:41 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Received: from localhost ([::1]:47071 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xo5Ih-0000mB-8s for patch@linaro.org; Tue, 11 Nov 2014 01:51:39 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54180) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xo5Hq-00006R-0Z for qemu-devel@nongnu.org; Tue, 11 Nov 2014 01:50:51 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Xo5Hl-0002mY-6c for qemu-devel@nongnu.org; Tue, 11 Nov 2014 01:50:45 -0500 Received: from afflict.kos.to ([92.243.29.197]:35835) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xo5Hk-0002m0-Vw for qemu-devel@nongnu.org; Tue, 11 Nov 2014 01:50:41 -0500 Received: from afflict.kos.to (afflict [92.243.29.197]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by afflict.kos.to (Postfix) with ESMTPSA id 616C6264C7; Tue, 11 Nov 2014 07:50:38 +0100 (CET) From: riku.voipio@linaro.org To: qemu-devel@nongnu.org Date: Tue, 11 Nov 2014 08:50:36 +0200 Message-Id: X-Mailer: git-send-email 1.7.10.4 In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 92.243.29.197 Cc: Peter Maydell , Tom Musta Subject: [Qemu-devel] [PULL 1/2] linux-user: Do not subtract offset from end address X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: riku.voipio@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.177 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 From: 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. Signed-off-by: Tom Musta Signed-off-by: Riku Voipio --- linux-user/elfload.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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; }