From patchwork Fri Aug 18 17:12:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 714662 Delivered-To: patch@linaro.org Received: by 2002:a5d:484e:0:b0:317:ecd7:513f with SMTP id n14csp629570wrs; Fri, 18 Aug 2023 10:15:56 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH9wxlBXFpp50b5aG1unTQ76MLx8z+fC5aSDtEP8Xx4aB3BkMqkGSdzwzTveO0pEc/n/1/l X-Received: by 2002:ac8:5c07:0:b0:400:9f2c:1211 with SMTP id i7-20020ac85c07000000b004009f2c1211mr4430235qti.29.1692378956402; Fri, 18 Aug 2023 10:15:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692378956; cv=none; d=google.com; s=arc-20160816; b=FnrOis9ZS2taXQX4ou4ttfCf8hkGuXP/uTTMzE2AuW0Bn1A1eymoDMyqTpzIthnIqJ /0NZOIi50QlLifE6gLhXvZQpKA3BFtx8UgrYtFm0m7M+esDzGURFr+IE9cH6V959v2DX hKgHcbIVEMDcB75K8lpkmjRiLAjtaN3aKnuC1/ODw2quQm+LJlF5DLFuF0PPrPhcDi8/ kE6CGm3Cqs1rDzMwSpweQVzEWNkFubUHvnMroJO4rVZv2CKwGcPVV8XRS7UzWkKh+8wu 2b3aQxctd4rV1Q1QmmDx7KNVT8IRZlGCHsIekirQyaO1cQ9GtERqhzNw9+KhHLDw5Mzz VpWA== 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:to:from :dkim-signature; bh=sLGhrncusZ++ow/925hmU4zhHqvG6lKeFI4gVIL5/yk=; fh=oYAd+8Lj9FKlReeF9hgENQXa3P4LhBP5C4njRBbobDA=; b=bqoKsjlT+5hCyOsd26R1vFr3UJIhgG4Hkb4R3iqVw1HdGR1BygBfYwemsJU1yv6FeX Q4OBkvsVP2GXdziUb8WfmFhukQ9tZCgtgLCw3y90t32KrLSBx1DhAxYy1qvyPTB7ZiAT Nn+gj90Ee2129FSFh1NDvypPxsDzL0hS0pFFTX6JBdxg3l8K1N2f5iDTc+wE+FZwLwH3 Sivvc7QbIt0HzaYqx6E5OTvZq0/13sY8BeuotImVgP4CVt7vln2Jti4xp+gmywXagZdK /BcPrL/c2y8preA6lwkSVNuswSjDGFJbL99Q0/66v8QiVclqZArp+pnpdpSu3wurRDYX Y6ag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Uu32AVqG; 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 h6-20020ac85846000000b0040fd23153e3si1484004qth.68.2023.08.18.10.15.56 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 18 Aug 2023 10:15:56 -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=Uu32AVqG; 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 1qX32M-0000CK-OG; Fri, 18 Aug 2023 13:13:27 -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 1qX323-0008NN-E8 for qemu-devel@nongnu.org; Fri, 18 Aug 2023 13:13:07 -0400 Received: from mail-pl1-x62b.google.com ([2607:f8b0:4864:20::62b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qX321-00087t-WD for qemu-devel@nongnu.org; Fri, 18 Aug 2023 13:13:07 -0400 Received: by mail-pl1-x62b.google.com with SMTP id d9443c01a7336-1bf1935f6c2so8162975ad.1 for ; Fri, 18 Aug 2023 10:13:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1692378785; x=1692983585; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=sLGhrncusZ++ow/925hmU4zhHqvG6lKeFI4gVIL5/yk=; b=Uu32AVqGVSodcZ4gTPPNa+hoE936Q2BEYSSS1WOrB/yyKLTN5a0Bsp8sBCHj8h6Xze PWpfhGA75s9NlaOr3elP8PfD03chJYT20z/yA1tEYUpXO6G0nlkD4rkcr5w5PdBA/bmh ZXUcuqd1l+9g69imzYQrwd80Q4WmHSW8IlcK5Hj/kLwnRfQEJsi2YyLf8Q4dgtsxzBWz NpmdgSmzeK3uvqARdBMraA8Ds7LtXbHlRoLln90yt3qKgjza+MTYZFGUT3YzJ8WzTXcf Mowu57GqTpbA/ofF8RfrT2OLRmWJH9AhOToZJ4oaQd4TZ0HnUa9wk8USVSxsI/QgbW0U oxNg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692378785; x=1692983585; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=sLGhrncusZ++ow/925hmU4zhHqvG6lKeFI4gVIL5/yk=; b=BuZ7Stpf0awMb9LxHiIpeByl6lUt7b3A3xZrPuxPm6aucRbLL59JpvrZCdJPGvc4qO LmCUJ1RLlvj3xCEz1CmU3GJ9cxiXp3pl/o3IbOU6nNO02hr570hGf5j0bF/mkxajucHi yJFHtgEea9mChivJu8WYtfMYwWXtJDs+V2X9mnqEDi33vxf5VF5PFYqbhjQOfpahsdje XWnV6pzIF0K2wpTCXuI3tMaN4lv7YJDziZ1UPhu3YVRwGEn4iVj0PRjSWbfEDNuswZJN 7S4b6Tsib2loils/OPh5Nrxt6B6UYXT68mULBoKu9bNg2huP9unD2Ln2WKB/fFVmhLMj 5P2Q== X-Gm-Message-State: AOJu0YwR3QKR/RftCn2gYnzY/LQq8t9dazCTnvEQdw3ASc65wHvz0nEE I5r06LJrbyyy6cLjJYd35cbVhjX98/I6wME0nRk= X-Received: by 2002:a17:902:cecf:b0:1b8:8702:1e7c with SMTP id d15-20020a170902cecf00b001b887021e7cmr8096048plg.33.1692378784723; Fri, 18 Aug 2023 10:13:04 -0700 (PDT) Received: from stoup.. ([2602:47:d483:7301:cf24:6daf:2b9e:7972]) by smtp.gmail.com with ESMTPSA id jw24-20020a170903279800b001adf6b21c77sm2020025plb.107.2023.08.18.10.13.03 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Aug 2023 10:13:04 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 31/33] linux-user: Bound mmap_min_addr by host page size Date: Fri, 18 Aug 2023 10:12:25 -0700 Message-Id: <20230818171227.141728-32-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230818171227.141728-1-richard.henderson@linaro.org> References: <20230818171227.141728-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62b; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62b.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 Bizzarely, it is possible to set /proc/sys/vm/mmap_min_addr to a value below the host page size. Fix that. Signed-off-by: Richard Henderson --- linux-user/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/linux-user/main.c b/linux-user/main.c index 2334d7cc67..1925c275ed 100644 --- a/linux-user/main.c +++ b/linux-user/main.c @@ -904,7 +904,7 @@ int main(int argc, char **argv, char **envp) if ((fp = fopen("/proc/sys/vm/mmap_min_addr", "r")) != NULL) { unsigned long tmp; if (fscanf(fp, "%lu", &tmp) == 1 && tmp != 0) { - mmap_min_addr = tmp; + mmap_min_addr = MAX(tmp, host_page_size); qemu_log_mask(CPU_LOG_PAGE, "host mmap_min_addr=0x%lx\n", mmap_min_addr); }