From patchwork Fri Sep 1 02:23:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 719497 Delivered-To: patch@linaro.org Received: by 2002:ab3:1981:0:b0:23f:8cfb:5ad7 with SMTP id 1csp18092lti; Thu, 31 Aug 2023 19:28:34 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEkDF3ooHoGc2RyhdgBoehphlIEmgA52FNyxNhU3GJ9GoG2vzsEiNKM1ew+Ef9HsK7Z/BQ8 X-Received: by 2002:a0c:f3c3:0:b0:64f:3ac9:4bb9 with SMTP id f3-20020a0cf3c3000000b0064f3ac94bb9mr1007464qvm.5.1693535314389; Thu, 31 Aug 2023 19:28:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1693535314; cv=none; d=google.com; s=arc-20160816; b=QWLmpoTliuV/+Fk9V7LrQ6LceshWkyJ1kkA9INN1IQ/OJwHyslC9rcurA0MLEsXUuE yYoKqj77ReGQEVIhveOIimP+0onJHsa2t+MbrHRUH2OfN443WM29+K2bBvU2p5ZGh/Tz 9j3yj4U6RwYFKHojwerrSKbJNVPJjlKyhsPCjmHdf9cOBSAqVD4AmtKFchXtAa72k9tH F2WvkYTujHyMLlCwSLYpc9O7AxRlICzFzuCDHFIxwpjKcb7GX3AjKD5NPIVBBq96ex9r KXRliMfnNdeQ6oUr+snjOtEXAiEet6qlu0e3nzzduPvOPQ8l/M9CheylxHr24GHR33tB BUtw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Ig/BU1p5rBUclrU24B2APEaCZb1m4+3FwcOcSczB0lA=; fh=r1cPj2GlTGSV4V8jQu3jfCKsZwpJ5ktYEUy+P7GD/+s=; b=QYiJsxxQ8waqzvYxJvpugeHfcjKg9McsyWL9RJfsvlS8yMWPiev4c6/seX+MSPJVOR Rzu2sB41b1ZrzdLdY/CHz1IyKKTvocmO6y2ZsAF3Mt1jsicGksqw/kMmUY0c7UUo3410 hoUZx0lJKxdk/g0UZvYNxQw+n+EXFZjI9z58LBFqko92WiAqn0+5734XsC4VRTcksetw 4hc+wvU+XNS1GTuC5T6lKyGHWDA1dC9sWCjxe1wEoCQEAI4Bh+qOyoX+wSKErdt2iXzm Wh2JYLDzIDytshc/ze6AtQkHaZX8gVh/HYa2hRrzwPxxOXhntKap8phJm8nEv6hQJC65 my9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FVqRnsBd; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id p17-20020a0cf551000000b006300516b58dsi1739775qvm.185.2023.08.31.19.28.34 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 31 Aug 2023 19:28:34 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FVqRnsBd; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qbtox-0006SN-0D; Thu, 31 Aug 2023 22:23:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qbtov-0006Rx-PN for qemu-devel@nongnu.org; Thu, 31 Aug 2023 22:23:37 -0400 Received: from mail-pg1-x52d.google.com ([2607:f8b0:4864:20::52d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qbtot-0001Nr-Hk for qemu-devel@nongnu.org; Thu, 31 Aug 2023 22:23:37 -0400 Received: by mail-pg1-x52d.google.com with SMTP id 41be03b00d2f7-53fa455cd94so1137382a12.2 for ; Thu, 31 Aug 2023 19:23:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1693535014; x=1694139814; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Ig/BU1p5rBUclrU24B2APEaCZb1m4+3FwcOcSczB0lA=; b=FVqRnsBdrlE+cAAcEvzLGzyK4LxUVuWmMOdMYtbN93MN/G4Tsa/PI6vD9gH4RN1sUR l9e4PKEvaZUxer8jup9ESG4+5zX1lvEXqoAzKmiCz5+TUPeF31uQaA44aVK0ZaFSTo6k CjFJo1RDYTbHiqHbhpeJxe5YlmXNbnkxMujq/OgWwOJBJMvA8y4tSz6UBc4WdZZlHkmq iCozjbD8j2Ti5Wvz2d7ez7neYcIk9vLALYbFRGcvssKGoaLiptE7dlSst+dIvpAcdlLU FrgRkcwuc8M+qxMgu9I4jjYupzf0jPcVkq4vFOEKtiqXkKH0+4Ct0GXqqfuUe7JC2U/H e0NA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693535014; x=1694139814; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Ig/BU1p5rBUclrU24B2APEaCZb1m4+3FwcOcSczB0lA=; b=WVb4DWX9dRPgxmLBoYpeFvcRpcVGUHvKtm2CBdh1gQRMszUEzLl4q4JUSg2MCzN389 B2MQ4sCqSZ5un85bk8WAHU7+bIsBDa9TKsrk+po8d0Z8qFXqH4hzQN42zp521iy46Rxm rZA+Kl/Ijy+nT9fM+zCo5uZ3hukZrNSMz3Zg1MRzmTM47jXd175WT9fqm4d7XnRqiTH7 Xx5ky2Yl8SM20rzWkdczDs8QeHh5jR1GmclSIPWzmqxuB9JQkYx+cBBF/9t/GvnzoZ+m UYThwXj7OuPyLtsuPh8Y55FbtUer73H2PROJE+CDbv99d/nRrlp/EMq6vyxldOncd1W/ Kx7g== X-Gm-Message-State: AOJu0YwDQ1mERFPm/vRd98gAw+3Z7sdNtgYEm0yraMpYL0ih8HbsujwO LuFA9pDLhtbtwAFzRwq5m3+7ZsUYsFyPXxaorxM= X-Received: by 2002:a05:6a20:440f:b0:132:79da:385a with SMTP id ce15-20020a056a20440f00b0013279da385amr1995020pzb.23.1693535014208; Thu, 31 Aug 2023 19:23:34 -0700 (PDT) Received: from stoup.. ([71.212.131.115]) by smtp.gmail.com with ESMTPSA id c25-20020aa781d9000000b0068a54866ca8sm1906977pfn.134.2023.08.31.19.23.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 31 Aug 2023 19:23:33 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: laurent@vivier.eu, alex.bennee@linaro.org Subject: [PATCH v2 02/33] linux-user: Adjust SVr4 NULL page mapping Date: Thu, 31 Aug 2023 19:23:00 -0700 Message-Id: <20230901022331.115247-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230901022331.115247-1-richard.henderson@linaro.org> References: <20230901022331.115247-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::52d; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x52d.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 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 Use TARGET_PAGE_SIZE and MAP_FIXED_NOREPLACE. We really should be attending to this earlier during probe_guest_base, as well as better detection and emulation of various Linux personalities. Signed-off-by: Richard Henderson --- linux-user/elfload.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/linux-user/elfload.c b/linux-user/elfload.c index 19503d8469..803281a53a 100644 --- a/linux-user/elfload.c +++ b/linux-user/elfload.c @@ -3730,8 +3730,9 @@ int load_elf_binary(struct linux_binprm *bprm, struct image_info *info) and some applications "depend" upon this behavior. Since we do not have the power to recompile these, we emulate the SVr4 behavior. Sigh. */ - target_mmap(0, qemu_host_page_size, PROT_READ | PROT_EXEC, - MAP_FIXED | MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); + target_mmap(0, TARGET_PAGE_SIZE, PROT_READ | PROT_EXEC, + MAP_FIXED_NOREPLACE | MAP_PRIVATE | MAP_ANONYMOUS, + -1, 0); } #ifdef TARGET_MIPS info->interp_fp_abi = interp_info.fp_abi;