From patchwork Thu Feb 15 06:20:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 772857 Delivered-To: patch@linaro.org Received: by 2002:adf:9dc2:0:b0:33b:4db1:f5b3 with SMTP id q2csp681382wre; Wed, 14 Feb 2024 22:25:14 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCUhsEz7ZGR1RTsBP2VtNzDquDVU21pZ4MDLAlP7IHHaK8oVRxNb6c515/M4/pWK1TQT99J/vyGNL7LeKbiish2Y X-Google-Smtp-Source: AGHT+IHjpkRJqDR5PH8AoqwNopj0YjeJ6YNiOyjDn7kQPPll+uLzVezw+LhElQf5hccBowDqjVc0 X-Received: by 2002:a0c:cb8b:0:b0:68e:eb0e:fd18 with SMTP id p11-20020a0ccb8b000000b0068eeb0efd18mr691399qvk.40.1707978313966; Wed, 14 Feb 2024 22:25:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1707978313; cv=none; d=google.com; s=arc-20160816; b=mS6x1CY4HvWrl+XhKD/1fA8vNFynC+qIVvl/kES2DwN9OYGQBm2taqSztx7gKEc7rd IYl0ZCKgn3qxi564u+6ov1EL8czMC2YIYdfTsAYUAZbUjT3F0NF1k+PMuLovreNCl0Bu WbPZJDVeP6vbfrFP3stGXvSJVXX7Wt/eSvOkOxDMIytSEJcgLYK0tbirk/DKZ4u6BKb3 +dbTEqLHItuTJ6K5IqaecED1GfzJZpkmdpEL1KG2/Epv29YsAubsDiPSynWBVIdL+5A7 thBMQxnhHlIs66kiCd70X6Qt/iv0rJdHkbp5qoHDNAzg1y8BM1LHx0vbhhwyMAfVOo3l sT0Q== 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=e+A2qkcrgjaI9rrkh97Ktn6PEwqN2bQkXlFCXE4NZ3E=; fh=H/IsS+LNYM6dBDHt5BZPsM5V9tnyjdUlJ92VVuTs62g=; b=tsU+tD2f4s+ZmiI7ZrGxq/2XvVPI10AW5kTAbLpR3DRT+qBE8wqCHD7sc0Mvn5e5Kj PLYfE0CLn+M5aya+JKyh/UZ7o+n14rRbhaK/IzhQkN8AV2HiwTlytb6olYzH0N2S6faf SI5YyAWpgI6BI2OgUlhZJzCuCE8Su61ENNKViUetQGuFFwX8SX+/pu8rgc+TTI8pzYAS xvYBZ0QloCB4tP/SJImb7tW0OcIy/5S3bsaw2HlC/YvKQ0YdKXNG7XPsLDZ1RA1KT5Ph dBrQG7Mk5gpSWpI9x1Th6DgU56UKBw6tkM+KJjOTLFj+WTNQ1UySsrQwFmmL3Hd3uvR3 NFXg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ZKKbMeDr; 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 gu10-20020a056214260a00b0068d034d08b1si780741qvb.305.2024.02.14.22.25.13 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 14 Feb 2024 22:25:13 -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=pass header.i=@linaro.org header.s=google header.b=ZKKbMeDr; 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 1raV7U-0003Es-O9; Thu, 15 Feb 2024 01:21:16 -0500 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 1raV7Q-0002zh-Hv for qemu-devel@nongnu.org; Thu, 15 Feb 2024 01:21:12 -0500 Received: from mail-pj1-x1030.google.com ([2607:f8b0:4864:20::1030]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1raV7O-0005bp-Sv for qemu-devel@nongnu.org; Thu, 15 Feb 2024 01:21:12 -0500 Received: by mail-pj1-x1030.google.com with SMTP id 98e67ed59e1d1-290da27f597so413910a91.2 for ; Wed, 14 Feb 2024 22:21:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1707978069; x=1708582869; 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=e+A2qkcrgjaI9rrkh97Ktn6PEwqN2bQkXlFCXE4NZ3E=; b=ZKKbMeDrMzEYzqVTYfXnb0dqw4ImR5L3YY2JHrGAmKx6W+nEcEDxLmRWrEKQEIKpdA WvF/ZUB0PcVoYx/q6VCzs1ClGfmIXIzkzclcvckkPRVYLfKvMk2TgqJJWfTudywh8w5o Ag+O4O+4ENtY8GEdlvoSrb7vyFSj/J+zzApJawOPrFoRLHc7vsYitfllLzFeRZivAI57 lMrvBcW7mqBLElvrQBPgF9OV+xUO+WhOhZFb/ezrRhLegjsW4yA2bXchu+gr6yZluNki zk6ZD8rBQOrBLE9sfHSDsovmL6iXzJaRRQFvlFZ5owSWagPgiBkNE5OGL7lzP4W7YH2l yD7w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707978069; x=1708582869; 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=e+A2qkcrgjaI9rrkh97Ktn6PEwqN2bQkXlFCXE4NZ3E=; b=Z9WWISlzwyEQWJyuZUUTotT5WIOVJnkbAhV1Zm3P2xxHjE9WMxVnS1EDHBH6zJMTUN dLX4zmmXSFaQiU+pGk8SJ/usRpgW4kHCC61Q6tsGhksJjxCU+Rbj+4kZ551L0uSQLwyu UZouW4OfvUDxrWWNJ/1vfjTAoNRKhIPyqD7EmN9JA8ulUnyTcWjcoyLpYjpdnRvut+Zd 57c0KhB0NXFCj5JllNXaqhMr6tcj9rBvf2RZrV1AqsJjSA+lxOm0mp3UbR+NlkelyhlA MuYX/YwkaT1wJB1cNe5j8KGJJT5Fbc1SMfDuCqZ+aya3iPXXHT2/XnXPr9mscbVS6jLQ efsg== X-Gm-Message-State: AOJu0YxRQyR0Mxs1kesv8mPt1CD7G04c/qd//7UDsiJLAVORpUt2Bh/I 0feW1eCnrFjbsQAK3515tep2Q4J9vG+7JFJeCnH2z5590UDmBmPhomuiRr7URwOkAYLlpQX3jvY 8 X-Received: by 2002:a17:90b:2308:b0:298:d43b:812e with SMTP id mt8-20020a17090b230800b00298d43b812emr882435pjb.7.1707978069512; Wed, 14 Feb 2024 22:21:09 -0800 (PST) Received: from stoup.. (173-197-098-125.biz.spectrum.com. [173.197.98.125]) by smtp.gmail.com with ESMTPSA id d5-20020a170902b70500b001d6f29c12f7sm464418pls.135.2024.02.14.22.21.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Feb 2024 22:21:09 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Ilya Leoshkevich , Helge Deller Subject: [PATCH v4 33/36] linux-user: Bound mmap_min_addr by host page size Date: Wed, 14 Feb 2024 20:20:15 -1000 Message-Id: <20240215062018.795056-34-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240215062018.795056-1-richard.henderson@linaro.org> References: <20240215062018.795056-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1030; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1030.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, T_SCC_BODY_TEXT_LINE=-0.01 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 Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Ilya Leoshkevich Acked-by: Helge Deller Message-Id: <20240102015808.132373-32-richard.henderson@linaro.org> --- 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 12bb839982..551acf1661 100644 --- a/linux-user/main.c +++ b/linux-user/main.c @@ -901,7 +901,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); }