From nobody Tue Nov 26 12:50:57 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1708634913; cv=none; d=zohomail.com; s=zohoarc; b=GSUMD+q4q+oRqQuubqixrIyJQOH05zlX16YoxebT+36+sXm4Knq6s/K3dAh87lBN2HkjDdTJN4Wr59nvmbHows8ZSfnAyV8Jt1m7aYrIxRe6I5BM5JVHl3dsJxfdM2TnBWhk9WHsiMeijz00cbiMhFMhrr1QLUxAfZUIqySmpi0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1708634913; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=e+A2qkcrgjaI9rrkh97Ktn6PEwqN2bQkXlFCXE4NZ3E=; b=cZbzCap0kW/FtjYz5vHH2HOLArOJwx9Yn2rIRtvdK4xyACRwo4nyNeIO19CnsFsp1+t6pmDIvzqqGvRYq1PS4ZFNVvqj0DGbRmgBSeiXftpiPVu/Z741/b1acEuOTIkdKoMmN1pIkJtlo4JnyytAG3wnZevz9YsBHfdBmyXALpE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1708634913688628.6877611034187; Thu, 22 Feb 2024 12:48:33 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rdFvd-0008I4-Ku; Thu, 22 Feb 2024 15:44:25 -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 1rdFvc-0008CS-1u for qemu-devel@nongnu.org; Thu, 22 Feb 2024 15:44:24 -0500 Received: from mail-pl1-x631.google.com ([2607:f8b0:4864:20::631]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rdFva-0002pe-LL for qemu-devel@nongnu.org; Thu, 22 Feb 2024 15:44:23 -0500 Received: by mail-pl1-x631.google.com with SMTP id d9443c01a7336-1dc139ed11fso10255355ad.0 for ; Thu, 22 Feb 2024 12:44:22 -0800 (PST) Received: from stoup.. (173-197-098-125.biz.spectrum.com. [173.197.98.125]) by smtp.gmail.com with ESMTPSA id l12-20020a170902d34c00b001d8f81ecebesm10275500plk.192.2024.02.22.12.44.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Feb 2024 12:44:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1708634661; x=1709239461; 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=RrxczqX+DJ4rzVYxr7cCaSq6WYI4RSotzi5F4ezjurSAHy/rOrlKz/QZ+Ms3gWACOM 5gdI5crYQrQC8xBYi1dRR6N2NXU69uDGr9MqwNifraFl6rFXj+FFSCpA2Tq6aKPEJLdx sFDbZfOGzJtWFUC+8Nru1fAc4bPIgKnoo4jix9fcyDbXu9dO7miVUWegZMvQivG3bWaw nqlxT9WK/XJVoHV+/4L4kQY5e+ZpetnR0bQiduiYgxoBGq7InfIm5YX8S+5YjBYOiFCW hE5JfIJvVb7aVyea50WzeqQeMBrzma2G1fhZM8YyhCt7cMVQHKYgBiZaP+9Q4ko3aQmP YDAw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708634661; x=1709239461; 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=JukUD7LxSbbu0sOsp8+kQTMWd+YUvn6ckBQvgrOhYqJyNmkI2jcZ88GyW3Pc53BjaS mLY1lwsdGOyQ/LRk8XlQruAq3golS6hN+eO5gSLBSrWNa6R5RtaMjYIOHQvBuwEYf/4L wRsJAD6Ul9csef615dxnVqVy6VIbXDkq4y5tCpuCsuDCecLd2H47ymqgKc1jnJt4CJMo fy31gLqJjbQCLbOcx4nUcPi1fRgWgvPDLgj8/+3W4VhUnzJTqYj9uT/A4/yMJT9bTYie DHlcHvp86UjDzgX7+CzSaMtVbNNO5JNWtJrbQ16U2CcqZQ5HZfwHjo/ph+9mmdAXZsK8 pe0Q== X-Gm-Message-State: AOJu0YymqH3UIzp2VIfsr5oAoyn0ydsz3aC6kJrl2xj6QaXYjShbFolK goUhbkNu/Pr1WhS7rab3bBklKX/swjUxqHEhXfllHqJ4hsZMkbf4qiyqfCd0f16HS/i1dsRh7fc B X-Google-Smtp-Source: AGHT+IHj4x4KoLMrZPuSmly4HIFtIoXiJHEcY/4fxE7YzC+IG65DzjnX8lBKkrLmgEMYNB7kM/k/mw== X-Received: by 2002:a17:902:c942:b0:1db:b96f:4a50 with SMTP id i2-20020a170902c94200b001dbb96f4a50mr206635pla.14.1708634661426; Thu, 22 Feb 2024 12:44:21 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Ilya Leoshkevich , Helge Deller Subject: [PULL 36/39] linux-user: Bound mmap_min_addr by host page size Date: Thu, 22 Feb 2024 10:43:20 -1000 Message-Id: <20240222204323.268539-37-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240222204323.268539-1-richard.henderson@linaro.org> References: <20240222204323.268539-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::631; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x631.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1708634914319100001 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=C3=A9 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 =3D fopen("/proc/sys/vm/mmap_min_addr", "r")) !=3D NULL) { unsigned long tmp; if (fscanf(fp, "%lu", &tmp) =3D=3D 1 && tmp !=3D 0) { - mmap_min_addr =3D tmp; + mmap_min_addr =3D MAX(tmp, host_page_size); qemu_log_mask(CPU_LOG_PAGE, "host mmap_min_addr=3D0x%lx\n", mmap_min_addr); } --=20 2.34.1