From patchwork Fri Sep 29 21:11:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sami Tolvanen X-Patchwork-Id: 13404841 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 26A3FE71D58 for ; Fri, 29 Sep 2023 21:12:02 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5844B8D00E8; Fri, 29 Sep 2023 17:12:01 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 534018D00DE; Fri, 29 Sep 2023 17:12:01 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3FCA68D00E8; Fri, 29 Sep 2023 17:12:01 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 33DAA8D00DE for ; Fri, 29 Sep 2023 17:12:01 -0400 (EDT) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 09AF31605D8 for ; Fri, 29 Sep 2023 21:12:01 +0000 (UTC) X-FDA: 81290882442.25.8C0F1BC Received: from mail-yb1-f202.google.com (mail-yb1-f202.google.com [209.85.219.202]) by imf07.hostedemail.com (Postfix) with ESMTP id 5437840010 for ; Fri, 29 Sep 2023 21:11:59 +0000 (UTC) Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=rv4nTCsg; spf=pass (imf07.hostedemail.com: domain of 3nj0XZQwKCKUXFRNYTQaFSJSLTTLQJ.HTRQNSZc-RRPaFHP.TWL@flex--samitolvanen.bounces.google.com designates 209.85.219.202 as permitted sender) smtp.mailfrom=3nj0XZQwKCKUXFRNYTQaFSJSLTTLQJ.HTRQNSZc-RRPaFHP.TWL@flex--samitolvanen.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1696021919; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding:in-reply-to: references:dkim-signature; bh=qI6+evphp8TRNLDsXrgWEBj/E5cavHWN+P8xd8/8MDM=; b=LySm+LIhnYTmS3+xwOyxTnGp451Kc5GctnF+TjUGyQReS2HMiG5diGj6Ch5RCaAo5OUmuM mZ1tZpKC0InRwmh7ej7ZBTon8MJ38Rn03p/n1dK1gZu3HndONXgPFeLzQjhL0zJMZtviF9 GMmUJjJvDKDF+17ulhc0oE7j14EHc4o= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1696021919; a=rsa-sha256; cv=none; b=tZFOV9F5H2mDG2y1FzaLfyJN1sgf89Wb9z0h73twedq0ppc8hFvcqtXe8VjZeEp8lsIFeY VsLchj5NpYYI1C7U9XYmxTkxLc4Z4Xe1tDPHOX2MHmlFRF+nDaKk134UKpmj/Bhpn+XSDt JncExXvtc8NuxwfczYBmNJkUdwjz5AY= ARC-Authentication-Results: i=1; imf07.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=rv4nTCsg; spf=pass (imf07.hostedemail.com: domain of 3nj0XZQwKCKUXFRNYTQaFSJSLTTLQJ.HTRQNSZc-RRPaFHP.TWL@flex--samitolvanen.bounces.google.com designates 209.85.219.202 as permitted sender) smtp.mailfrom=3nj0XZQwKCKUXFRNYTQaFSJSLTTLQJ.HTRQNSZc-RRPaFHP.TWL@flex--samitolvanen.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com Received: by mail-yb1-f202.google.com with SMTP id 3f1490d57ef6-d8671837a86so18528800276.3 for ; Fri, 29 Sep 2023 14:11:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1696021918; x=1696626718; darn=kvack.org; h=cc:to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=qI6+evphp8TRNLDsXrgWEBj/E5cavHWN+P8xd8/8MDM=; b=rv4nTCsgMZk6J3mHIwaPjd68lH5snGd/MBTT9Rkwv3zPRFKPa7l2xOaAtmjOHB1K+x R/+AXTFbl/t4XUYfiMLrr5cYjiy/VyTORYoJlnXM5ky3dK7WIILhdwPOv+ZAIJ2Ztfzy MzfoieJHLHGIg7ShSATclmMpI/SW+1QAmypg43z0sBTFJw4YO+QhKDqJSGFWv1+VVpY1 mTm+k4i5jVNST0TGNYT/NosQtjyyAJx6xL9YXPpQSsalPzwCbE+s9P0Bl7wMzfFp6ffx d9hp3Iqe/RxTKNIf0nKlBUCe/nUCgrGY8mIVhlveP2EZpFMGnapjOtGnSF+MRsFAk+64 iN0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696021918; x=1696626718; h=cc:to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=qI6+evphp8TRNLDsXrgWEBj/E5cavHWN+P8xd8/8MDM=; b=cEcjKVMwvDNNtUf/Y0QLrCZl052RwdYt3PmmcipoBwoNjkBbSP6RdGbxQgEODyOWSi n9cjOjjdBsDYU8PHX5JKktaT1cyuXiL4OyMrDatMeVMLKqY3IKw1GszSkjz07s4dzflO WPkNVoid2MEiwaFYCzAhfoie6hYnlC3WB3FWmmSsreIJ2D5oa5I1oI3sRzmv+0WAMjCy CdzA8JH1rnW2c4I7a0nnS1IyZH7nTUqYKr6ZdI09HVuIxaUpT/KuY7gMxl4xH6Gl8WsE hF+Bt9pk+gqhLDhMPCwMgBeTAov2sGoUPomUgVH7IzuOyMp8TSJzm8hsJ1hU300+Tx7U bHaQ== X-Gm-Message-State: AOJu0YxR04LowqOE4poD6gJNS1YTagLHdh0Vk1asrspCXfr1B/Km78SU NcBRQytCQXQMjnn/Jml4ol5svxW27JoA/DAvsPc= X-Google-Smtp-Source: AGHT+IGjD5ILJnbbyCB0lpaKNSDkrgUS5mwaokgtSD8CjgjpWZhKS+xQi/ZyvDLcSGZs4gGR5Nixr3sWaAppp9HPVPc= X-Received: from samitolvanen.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:4f92]) (user=samitolvanen job=sendgmr) by 2002:a25:ad0a:0:b0:d7b:8d0c:43f0 with SMTP id y10-20020a25ad0a000000b00d7b8d0c43f0mr85777ybi.11.1696021918263; Fri, 29 Sep 2023 14:11:58 -0700 (PDT) Date: Fri, 29 Sep 2023 21:11:56 +0000 Mime-Version: 1.0 X-Developer-Key: i=samitolvanen@google.com; a=openpgp; fpr=35CCFB63B283D6D3AEB783944CB5F6848BBC56EE X-Developer-Signature: v=1; a=openpgp-sha256; l=727; i=samitolvanen@google.com; h=from:subject; bh=Ko6nN36PGlYW1laUEIPPBze9YPFWfBooBOFzOjRaBRQ=; b=owEB7QES/pANAwAKAUy19oSLvFbuAcsmYgBlFz2b825e14pVS6UiwTyLbmjRM7MleUeCEvyhI HQ9Yi7cABWJAbMEAAEKAB0WIQQ1zPtjsoPW0663g5RMtfaEi7xW7gUCZRc9mwAKCRBMtfaEi7xW 7p9uC/9v8/6JNqB5Fbep/hRFQKiCO/kScjQBMmlHvInQfP3gwUfbFCkkKYSVRSOR4Pxeo+/um1b AFvQRu8TawGoy7GtfAlC2T/3RZQcj6xNwU/+K5WHsVdfqZNa6xsNhtBstdrsW91ELm7X4wBhnPs 9dYkZsrMXL8JtJvTDL1VQ3EjQ/tTab3SiJiqIF2J694+4vXbP83KGUAsC8z11QRsfCkb9V0cHNb qMaWfvoF2E3/MtrWUF/VlddoLs+4VfwsIz2eTQZm1X5Ll3CAeOMw8TmTQqQ3OT2OM1kJ1GKFGjs kpo/58zC+ziTSyL0rCbs4jrdHHMyEYwJ50108kvKlUuWGKE1joh0omULdtzfezNnIwzMPwuVnD+ 4eCKnZSAXhZxbKFAC20jcgErpJusDmn0lx2CNHUYsVuPL58GkYaK49lTYq09WuoCRWjrP+iv4BO 5JlmAMEmM6FrNg93Mj3ALgwQi7uUk7LHPkg8Rs7a3cO1p1MoInq21V6B5zk6DfXYcBSdA= X-Mailer: git-send-email 2.42.0.582.g8ccd20d70d-goog Message-ID: <20230929211155.3910949-4-samitolvanen@google.com> Subject: [PATCH 0/2] riscv: Increase mmap_rnd_bits_max on Sv48/57 From: Sami Tolvanen To: Paul Walmsley , Palmer Dabbelt , Albert Ou , Andrew Morton , Kees Cook Cc: linux-mm@kvack.org, linux-riscv@lists.infradead.org, llvm@lists.linux.dev, linux-kernel@vger.kernel.org, Sami Tolvanen X-Stat-Signature: 4okny1beuumcf449tyrnjp4qf8pew55q X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: 5437840010 X-Rspam-User: X-HE-Tag: 1696021919-649464 X-HE-Meta: U2FsdGVkX1/bdZFBXWr8pgmnKsXc/Y1coFXz3ddfWOf0HqVuCbGVQqZYsJt8KR7xYfqm1K+fx66FyXkC+yk+TVtVcb0/Plx4S5jJ3NoN/1ObeLSt3KZh+C5pilYddhkQ9PV/abPKrJKygIyrK+bikYwnO6/2Oh0On6bxfzxWhKd2+ivlR/WQ+lS47P7ax5hIDRcdLRTORscLZAKUki8N7pTKTqE+wd7D5UIT64tpnFLHjfyEHamAUYVnlm4m0IZPUqLfp8YBBXDr3FaWGm54BjZAbx4x8Ec4bofs/JLp7bTS0VO6kA001kwOQ9/cO6ubm7ZyxTDFuoPtKli54aL+ySRGU6xfdDgbAL0EEjOtmXOBT5oV/k4BmQu5CviFwhrImWCOu/20s/AVoJTUknjFVVIs6D6/1lK5xoFWt+sJLYEAenvYvgeaCkwC49FsNn9U1JhJfHgN6DThKBjFFrb6epO3rb+qUg1MCfjJaqxpEHABAb3w1XZLffdPyNNlB+BcYz3DyPcSIX0mwkg/Nj1RLpjr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-Bogosity: Ham, tests=bogofilter, spamicity=0.000063, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Hi all, We noticed that 64-bit RISC-V kernels limit mmap_rnd_bits to 24 even if the hardware supports a larger virtual address space size [1]. These two patches allow mmap_rnd_bits_max to be changed during init, and bumps up the maximum randomness if we end up setting up 4/5-level paging at boot. Sami [1] https://github.com/google/android-riscv64/issues/1 Sami Tolvanen (2): mm: Change mmap_rnd_bits_max to __ro_after_init riscv: mm: Update mmap_rnd_bits_max arch/riscv/mm/init.c | 6 ++++++ include/linux/mm.h | 2 +- mm/mmap.c | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) base-commit: 6465e260f48790807eef06b583b38ca9789b6072 Reviewed-by: Palmer Dabbelt Acked-by: Palmer Dabbelt