From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 17515C433EF for ; Tue, 7 Sep 2021 21:56:06 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C1E1160238 for ; Tue, 7 Sep 2021 21:56:05 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org C1E1160238 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=bsdimp.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:59668 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mNj4W-0000bB-Rj for qemu-devel@archiver.kernel.org; Tue, 07 Sep 2021 17:56:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34970) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mNj2L-0005iT-8u for qemu-devel@nongnu.org; Tue, 07 Sep 2021 17:53:49 -0400 Received: from mail-il1-x12c.google.com ([2607:f8b0:4864:20::12c]:43617) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mNj2J-0000lr-NZ for qemu-devel@nongnu.org; Tue, 07 Sep 2021 17:53:49 -0400 Received: by mail-il1-x12c.google.com with SMTP id v16so150492ilo.10 for ; Tue, 07 Sep 2021 14:53:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=GiaQIIYvzMX3kBsTWafB+XsF4D6nhHn7w46Aapsrz8s=; b=cBEe+ihCDlFBfUGAmrSyLq40+gG5F2opVrXyU8kqo0AxxTTpzRhEDBRzu0RZOrpyTJ Kcx8ZeG07Ey6aaN9/yNTBK6nffQwaXuEjkAm2bgLpUvZiY5j+9wvBs3iN8lBvzF/nSPb gnFhu9MyVspPtKMim4BiQTYsTB63EtyjA+2Q0PFXqU2fYuxvrTWWtaSMgqfMfHQOksgn JFU1p37wIyjGH8PLdVhU0O/67NIr0VSquNnCHlIdRmpa0+ZCo23zkCav9/TQh9XWF/Bo 9Ccdluea2whzdEm4p2So+r/i2VkA3PZ26xyqeOwOuvdKyNOlXCKo9HU5PR6cuoooP312 K7Og== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=GiaQIIYvzMX3kBsTWafB+XsF4D6nhHn7w46Aapsrz8s=; b=gIZcU80JjL+94nFc6+3yo7Vhqblz7z3C4HbAeHtz3vzZJIUajnVGkeP2erlevtgETO J81xsF/zimp1xFrK1dkOFq0djUB0b7YQ4ilYVDc3pErukYKsibhzayRpf3lrragh/34R GnEUy+VqcIEHDmCxm4fQHTEq7Vg7xyxvXc5sbEuuOp0EgtM9mZh7wITXjG2KdrVCezBa AcL3s7XjO3y2fO+19opSIcyZ5Ao62ZjjMCRoTEWPL09G0FsL1+9kyKBgjdjJ8WY7z2yu yy/MOpxAWb7+9lZCuMwT8CE0Ac3TMgjlSOUNIkAnHnXOgB0huDqCbCc5ssSqA28Uw1a5 RU5w== X-Gm-Message-State: AOAM530CZUa24S/DaH7MfEHCk7cDjMTSo7zZ6JGrNY3zYdqYFLMnZeEU SEzc1YJWeiJWKhNRs+a2+Arp9ksPRNDvyESMors= X-Google-Smtp-Source: ABdhPJynLcqyGFc3ugFjcwsnM1ZQkxTDEzZwy8MmySqYO4T3rzAWvTyMVX9uriL7nda+PEEAsvRHjw== X-Received: by 2002:a05:6e02:12c2:: with SMTP id i2mr287565ilm.261.1631051626474; Tue, 07 Sep 2021 14:53:46 -0700 (PDT) Received: from dune.bsdimp.com (50-253-99-174-static.hfc.comcastbusiness.net. [50.253.99.174]) by smtp.gmail.com with ESMTPSA id t17sm192477iln.24.2021.09.07.14.53.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Sep 2021 14:53:45 -0700 (PDT) From: imp@bsdimp.com To: qemu-devel@nongnu.org Subject: [PULL 09/42] bsd-user: Fix calculation of size to allocate Date: Tue, 7 Sep 2021 15:52:59 -0600 Message-Id: <20210907215332.30737-10-imp@bsdimp.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210907215332.30737-1-imp@bsdimp.com> References: <20210907215332.30737-1-imp@bsdimp.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Received-SPF: none client-ip=2607:f8b0:4864:20::12c; envelope-from=imp@bsdimp.com; helo=mail-il1-x12c.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kevans@freebsd.org, Richard Henderson , Warner Losh Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Warner Losh It was incorrect to subtract off the size of an unsigned int here. In bsd-user fork, this change was made when moving the arch specific items to specific files. The size in BSD that's available for the arguments does not need a return address subtracted from it. Signed-off-by: Warner Losh Reviewed-by: Richard Henderson --- bsd-user/bsdload.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/bsd-user/bsdload.c b/bsd-user/bsdload.c index 5282a7c4f2..379015c744 100644 --- a/bsd-user/bsdload.c +++ b/bsd-user/bsdload.c @@ -143,10 +143,9 @@ int loader_exec(const char *filename, char **argv, char **envp, struct target_pt_regs *regs, struct image_info *infop, struct bsd_binprm *bprm) { - int retval; - int i; + int retval, i; - bprm->p = TARGET_PAGE_SIZE * MAX_ARG_PAGES - sizeof(unsigned int); + bprm->p = TARGET_PAGE_SIZE * MAX_ARG_PAGES; for (i = 0; i < MAX_ARG_PAGES; i++) { /* clear page-table */ bprm->page[i] = NULL; } -- 2.32.0