From patchwork Thu Dec 16 14:44:42 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 524506 Delivered-To: patch@linaro.org Received: by 2002:a05:6e04:2287:0:0:0:0 with SMTP id bl7csp639202imb; Thu, 16 Dec 2021 06:46:00 -0800 (PST) X-Google-Smtp-Source: ABdhPJx6V79gj1svLOSX6odcfAMKu+2S6eBoDI4G49wPQTb/RXlyNXoJ4jN9XyjvICmLxDvSiMzH X-Received: by 2002:a05:6638:3808:: with SMTP id i8mr9467060jav.118.1639665960401; Thu, 16 Dec 2021 06:46:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1639665960; cv=none; d=google.com; s=arc-20160816; b=luPrakaHbD15CM4en5+tp/yZAYRy0IPubjiadE0wQu4RGdLBkhxqYXD7TEQOZSWSNc z4/KJj9NSVXwX0V1PELo0/mjLYMWO+3ekSxHBlCbrOP9tdw4XIBYv9lDRRKOK8NsLw66 zcQe0NQxS9+3PQYRfG/uutCXROZYy9luS2qsMuxr7modJGqkdidfjiN8VA3RWhsRZs/U iLf1zHNkc5gBrYXK+NoXyj79RhHazVQXa5fziVG6iU5RakO0NZhB50eG2GgHMpg2lA31 fgn+RevNjHrVuFGlJopsD74dWGMpoRp98VVgWqwEdiqIFznP4c0RFN62yUzh0g7qNcsS l1KA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:to:from:dkim-signature; bh=GI0eDOxeONgRKehsh4Py4sxaPx+kahWhRhPA9tBcCiU=; b=yn8bTTC3ZLyIP0nqlV6e39BFzeQPglXnrEE1kN8OHaONL2ivlMLIh/xLL6s8ct2u0k oQh8b6fzeaVRhZD03RP2QdPVjb/tCroYBodBXLNiK0dNYFmKXJ7u5H4vleJwmUxxXxKK IHWLiXEMrgUvq2UMMrd5oYSz6QZ0ZUj4rtaorwjqv9QpBOIed7poVaWmTzlNpptRBD/5 0sttlXv1u8YuUwUaQHbHxQQY1cWLgZk7ZQmV3XS2wx7waamrspUfz8Hr4nt7DGsmJDt0 Bn4DUBfJO/uBJznLsrcQCXwh7f0KWZ7Ci92tWuU8XxfKFsSNXC17gXiEiTPOhKZYWyCE HH7A== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=Aw9xhtdd; 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=fail (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 k36si3920577jav.148.2021.12.16.06.45.59 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 16 Dec 2021 06:45:59 -0800 (PST) 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=fail header.i=@linaro.org header.s=google header.b=Aw9xhtdd; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:52518 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mxs18-0008Jj-Qy for patch@linaro.org; Thu, 16 Dec 2021 09:45:58 -0500 Received: from eggs.gnu.org ([209.51.188.92]:60322) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxs07-0008JW-M6 for qemu-devel@nongnu.org; Thu, 16 Dec 2021 09:44:55 -0500 Received: from [2a00:1450:4864:20::433] (port=36427 helo=mail-wr1-x433.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mxs06-0007TK-4t for qemu-devel@nongnu.org; Thu, 16 Dec 2021 09:44:55 -0500 Received: by mail-wr1-x433.google.com with SMTP id u17so44661865wrt.3 for ; Thu, 16 Dec 2021 06:44:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=GI0eDOxeONgRKehsh4Py4sxaPx+kahWhRhPA9tBcCiU=; b=Aw9xhtddQgogFo9hRrZ3zn1+Sm8ZrhNSEpy0lQAAF6MpP/JmOB4aiNbnzmw1e03ACv lFKroUZBBvkA6AQ0uVq94hS2GjVtSu3NPEoSaZ361FtGo5/xWaCNi+IhNoW+t6Ch9ZOH WjBeETSqf95zGqiRZITfRAY0gjYmwMShqHGGbIUL0/CXgSPL7f8YcBhyVOhdmPvx4Z4J bHmbbgD3x3r00COFZGIoit9Skh+NauRyuu/wax63BKqCv93xZyuCyvO99nHe9bBz5YRt oChtAsHbaH1OhtjvSx60qBiXwnAknGcKn8yVNvT6jfIQrhsvSLkiDPRzlXYZ8cXCd5Ii uLVA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=GI0eDOxeONgRKehsh4Py4sxaPx+kahWhRhPA9tBcCiU=; b=y6APjkm1MjiA44I9e+8M1fHp05+4A6M6lNYHhYDY4EqGcjfiPkxtXkBKPWB90HqVDV KsScC4iY7u03HEeX+AzAy3A5m9dl2CO/kgrZ9GYed28HfJ+Mf7jH7DsoqCdPOHQOJyEM MbRizFHXQigjY6W5OoTj+/2ssS1Fb81gqBgvsBW95BT/8v/QUARaKKKTkRSO7wY4KdiG DT/x0uZnWYMsWHIkPuiBjG8z7dtxXmz3lk9t21fNuoDWN4hbx1tk833v8FoIMm8sG3gF 4TUC1ZSSpwmcBBXxz7ZI+JeqV6FFfLhxWr0Sb2i78J0J0kLvNzARyJJqaumAV/JB58jM 8udA== X-Gm-Message-State: AOAM532C3BiQxIegPwpS/vy3uBfOwbqbnu27e55odYzEgyqL2OYvWhOB 6Jn+m5g1G2yEqyvaGFBQu22tDg== X-Received: by 2002:adf:f587:: with SMTP id f7mr9331181wro.671.1639665892286; Thu, 16 Dec 2021 06:44:52 -0800 (PST) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id i17sm5635490wmq.48.2021.12.16.06.44.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Dec 2021 06:44:50 -0800 (PST) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 263D71FF96; Thu, 16 Dec 2021 14:44:50 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [RFC PATCH] linux-user: don't adjust base of found hole Date: Thu, 16 Dec 2021 14:44:42 +0000 Message-Id: <20211216144442.2270605-1-alex.bennee@linaro.org> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::433 (failed) Received-SPF: pass client-ip=2a00:1450:4864:20::433; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x433.google.com X-Spam_score_int: -12 X-Spam_score: -1.3 X-Spam_bar: - X-Spam_report: (-1.3 / 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, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no 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: , Cc: =?utf-8?q?Alex_Benn=C3=A9e?= , richard.henderson@linaro.org, Laurent Vivier Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" The pgb_find_hole function goes to the trouble of taking account of both mmap_min_addr and any offset we've applied to decide the starting address of a potential hole. This is especially important for emulating 32bit ARM in a 32bit build as we have applied the offset to ensure there will be space to map the ARM_COMMPAGE bellow the main guest map (using wrapped arithmetic). Signed-off-by: Alex Bennée Resolves: https://gitlab.com/qemu-project/qemu/-/issues/690 --- 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 238979b8b6..8d839b79fb 100644 --- a/linux-user/elfload.c +++ b/linux-user/elfload.c @@ -2334,7 +2334,7 @@ static uintptr_t pgb_find_hole(uintptr_t guest_loaddr, uintptr_t guest_size, /* Record the lowest successful match. */ if (ret < 0) { - ret = align_start - guest_loaddr; + ret = align_start; } /* If this hole contains the identity map, select it. */ if (align_start <= guest_loaddr &&