From patchwork Fri May 2 19:15:37 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Riku Voipio X-Patchwork-Id: 29578 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ig0-f200.google.com (mail-ig0-f200.google.com [209.85.213.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 167CC203F3 for ; Fri, 2 May 2014 19:20:12 +0000 (UTC) Received: by mail-ig0-f200.google.com with SMTP id uy17sf1822157igb.7 for ; Fri, 02 May 2014 12:20:12 -0700 (PDT) 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=Upgx2AAo7IME/WtiZAh1h8mO/cg5LZ8TWfBQ+w+rPUY=; b=Veh78zOx0IgP1dHAIm2h7wmn4GdXpG0Nu8vYRCNAc5HnNLebYniG2w2+iZrNMeOur6 yGUTlTsYse29dlHFbLnAGUQu9Q09sMm+Etahmkekos8Y67wrRDYsRNiqzUz2504lQVpA b5XBvSejCVMVTaCeqsJ4+Jn5K48yL2t5PYdbCjK7wK/JvEogu8V/nnN5ngxJvPR/rz7u wJL2/eNODmXkiaCwLsjwzQSHy79fD1GCJv6XoB4h1vWSaC9veu1fook0d6hOm5p370Ie 6/3XV4Lh2f0Y9lPpBTSoEVLIxhgdUvVKNJ6qa9tmxG4c8goxBOubBfVFtOP58OljrZv7 bi6A== X-Gm-Message-State: ALoCoQlQ58A7OtykSCW/rh3PX4q3JxDki/DTTlTpaSd+DFGPs4CahctE9XSkKzBhlvDbBnBPvs4X X-Received: by 10.182.241.9 with SMTP id we9mr10042882obc.22.1399058412556; Fri, 02 May 2014 12:20:12 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.97.200 with SMTP id m66ls1567194qge.83.gmail; Fri, 02 May 2014 12:20:12 -0700 (PDT) X-Received: by 10.58.207.74 with SMTP id lu10mr14307912vec.15.1399058412403; Fri, 02 May 2014 12:20:12 -0700 (PDT) Received: from mail-ve0-f177.google.com (mail-ve0-f177.google.com [209.85.128.177]) by mx.google.com with ESMTPS id vd8si6906049vdc.160.2014.05.02.12.20.12 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 02 May 2014 12:20:12 -0700 (PDT) Received-SPF: none (google.com: patch+caf_=patchwork-forward=linaro.org@linaro.org does not designate permitted sender hosts) client-ip=209.85.128.177; Received: by mail-ve0-f177.google.com with SMTP id db11so1170858veb.36 for ; Fri, 02 May 2014 12:20:12 -0700 (PDT) X-Received: by 10.52.237.228 with SMTP id vf4mr846370vdc.47.1399058412344; Fri, 02 May 2014 12:20:12 -0700 (PDT) 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.220.221.72 with SMTP id ib8csp125976vcb; Fri, 2 May 2014 12:20:12 -0700 (PDT) X-Received: by 10.229.28.2 with SMTP id k2mr25055398qcc.16.1399058411862; Fri, 02 May 2014 12:20:11 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id l5si14497358qai.192.2014.05.02.12.20.11 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 02 May 2014 12:20:11 -0700 (PDT) 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]:45960 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WgIyU-0003Lv-77 for patch@linaro.org; Fri, 02 May 2014 15:18:22 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33472) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WgIwD-000824-HQ for qemu-devel@nongnu.org; Fri, 02 May 2014 15:16:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WgIw4-000090-M0 for qemu-devel@nongnu.org; Fri, 02 May 2014 15:16:01 -0400 Received: from afflict.kos.to ([92.243.29.197]:48058) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WgIw4-00005F-CW for qemu-devel@nongnu.org; Fri, 02 May 2014 15:15:52 -0400 Received: from localhost.localdomain (afflict [92.243.29.197]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by afflict.kos.to (Postfix) with ESMTPSA id 9F02A264C8; Fri, 2 May 2014 21:15:50 +0200 (CEST) From: riku.voipio@linaro.org To: qemu-devel@nongnu.org Date: Fri, 2 May 2014 22:15:37 +0300 Message-Id: <8c0f0a60d48a6f62c20f4ce77dceb82047d3d57f.1399057853.git.riku.voipio@linaro.org> X-Mailer: git-send-email 1.7.2.5 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@linaro.org, Riku Voipio , James Hogan Subject: [Qemu-devel] [PULL 02/14] linux-user: Assert stack used for auxvec, envp, argv 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=neutral (google.com: patch+caf_=patchwork-forward=linaro.org@linaro.org does not designate permitted sender hosts) 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: James Hogan Assert that the amount of stack space used for auxvec, envp & argv exactly matches the amount allocated. This catches if DLINFO_ITEMS isn't updated when another NEW_AUX_ENT is added. Signed-off-by: James Hogan Cc: Riku Voipio Cc: Peter Maydell Signed-off-by: Riku Voipio --- linux-user/elfload.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/linux-user/elfload.c b/linux-user/elfload.c index d2380b6..ecf6f35 100644 --- a/linux-user/elfload.c +++ b/linux-user/elfload.c @@ -1455,6 +1455,8 @@ static abi_ulong create_elf_tables(abi_ulong p, int argc, int envc, info->auxv_len = sp_auxv - sp; sp = loader_build_argptr(envc, argc, sp, p, 0); + /* Check the right amount of stack was allocated for auxvec, envp & argv. */ + assert(sp_auxv - sp == size); return sp; }