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 8D11BC432BE for ; Thu, 26 Aug 2021 21:23:31 +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 407C460EAF for ; Thu, 26 Aug 2021 21:23:31 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 407C460EAF 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]:39864 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mJMqQ-0002S6-A0 for qemu-devel@archiver.kernel.org; Thu, 26 Aug 2021 17:23:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38866) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mJMfp-0005io-OU for qemu-devel@nongnu.org; Thu, 26 Aug 2021 17:12:33 -0400 Received: from mail-il1-x129.google.com ([2607:f8b0:4864:20::129]:34451) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mJMfo-0006n2-Ah for qemu-devel@nongnu.org; Thu, 26 Aug 2021 17:12:33 -0400 Received: by mail-il1-x129.google.com with SMTP id j15so4765943ila.1 for ; Thu, 26 Aug 2021 14:12:31 -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=LAs8+ToliEcKEEyZjdCYGge8+7qLiaCSgX+Hi0Qv0lax1Phnwyx7I15w/TUGoQcjxi psMe75OhLT9PimifkAEEZ+RzJGA1rsD4Pc04zU/TXgprcIM540FQBycywBDo/IuVjHHg by3yi8ydt7QpgAYqemIAhG+BMfz00RzX0i8LBSiK6cCDOef69nkoOJXouR3TlJtPR5Ju wZF9SYX4pYwZWrpqFBWVVKrsKXu7nFgwFMMNoNbORShEoNfIFDwiweL0PpGxSDoNjeEe sEXLaQsp2e8WDs2wY/JSoUAQRWUZnjbwqGrZ/tXMMsNizb9Fa7GLPGqnoJFtprTwYHYC gHBQ== 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=MOH03LjfiiY6fIxa5lUvb1pyxgQe2A3PDef3vq6KGVvXhW3kdmC0m32k1b+BPCmxrV AwXLyMxMd7k/kCrOx2zU6egCqBNL/WLvYI6fketGldqIq2w0/kKXk8Q7WbrjT6a+IquM d3fCvGf34SQmhRC92/T69mEQTj+UEWKuZCI880AXUZ5PP5AaSOV8Y6d6oPFzXVDHO7LL jGS19bdCytH4H+ppQK3pptpjUSIL23C7sY3rCJE/JMIbIh9LkufVNXA3ghWFdGeDQenb csMttdDfy+wLbA3FAoP5gQxKDA+3EpNC5Jn4C/MtUz1hwW6nzXHuf6HbmnemGofULicc eORA== X-Gm-Message-State: AOAM533D63Rltw6yqpdRy2IkMUkWw9Y8aFUpjPjwEbGbpfx2RhSDTrkp B1zlAewDPxmSY4PrrByTnWqI7SzZhczCf8x7 X-Google-Smtp-Source: ABdhPJwzwuWJu1oTzjvrW/C9RPghQwIZytYNS9miCoUQaTzif89Ia7GPGdt2VcwgPKaETZj0V6UYjw== X-Received: by 2002:a92:c808:: with SMTP id v8mr4090340iln.110.1630012350963; Thu, 26 Aug 2021 14:12:30 -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 a17sm2348633ilp.75.2021.08.26.14.12.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Aug 2021 14:12:30 -0700 (PDT) From: imp@bsdimp.com To: qemu-devel@nongnu.org Subject: [PATCH v2 09/43] bsd-user: Fix calculation of size to allocate Date: Thu, 26 Aug 2021 15:11:27 -0600 Message-Id: <20210826211201.98877-10-imp@bsdimp.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210826211201.98877-1-imp@bsdimp.com> References: <20210826211201.98877-1-imp@bsdimp.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Received-SPF: none client-ip=2607:f8b0:4864:20::129; envelope-from=imp@bsdimp.com; helo=mail-il1-x129.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: 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