From: Anshuman Khandual <anshuman.khandual@arm.com>
To: linux-arm-kernel@lists.infradead.org, catalin.marinas@arm.com,
will@kernel.org
Cc: Anshuman Khandual <anshuman.khandual@arm.com>,
Mark Rutland <mark.rutland@arm.com>,
Ryan Roberts <ryan.roberts@arm.com>,
Andrew Morton <akpm@linux-foundation.org>,
Daniel Cashman <dcashman@google.com>,
linux-kernel@vger.kernel.org
Subject: [PATCH V2] arm64/mm: Limit ARCH_MMAP_RND_BITS_MAX to 23 for 42-bit VA
Date: Tue, 1 Dec 2026 09:18:34 +0530 [thread overview]
Message-ID: <20261201034834.700673-1-anshuman.khandual@arm.com> (raw)
The existing ARCH_MMAP_RND_BITS_MAX value of 27 for 42-bit VA (64K) pgtable
configuration allows mmap() randomization range which exceeds the available
user space address space constraints.
This can cause mmap() allocations to fail when the maximum randomization is
enabled. Although it still requires CONFIG_EXPERT for ARCH_MMAP_RND_BITS to
accept values up to ARCH_MMAP_RND_BITS_MAX.
8>------------------------------------------------------------------------
[ 2.269084] Failed to execute /init (error -12)
[ 2.269114] Run /sbin/init as init process
[ 2.269137] with arguments:
[ 2.269153] /sbin/init
[ 2.269175] with environment:
[ 2.269192] HOME=/
[ 2.269213] TERM=linux
[ 2.270517] Starting init: /sbin/init exists but couldn't execute it (error -12)
[ 2.270550] Run /etc/init as init process
[ 2.270573] with arguments:
[ 2.270589] /etc/init
[ 2.270611] with environment:
[ 2.270628] HOME=/
[ 2.270649] TERM=linux
[ 2.270703] Run /bin/init as init process
[ 2.270726] with arguments:
[ 2.270742] /bin/init
[ 2.270764] with environment:
[ 2.270781] HOME=/
[ 2.270802] TERM=linux
[ 2.270856] Run /bin/sh as init process
[ 2.270878] with arguments:
[ 2.270895] /bin/sh
[ 2.270916] with environment:
[ 2.270933] HOME=/
[ 2.270954] TERM=linux
[ 2.272254] Starting init: /bin/sh exists but couldn't execute it (error -12)
[ 2.272294] Kernel panic - not syncing: No working init found.
Try passing init= option to kernel. See Linux Documentation/admin-guide/init.rst for guidance.
[ 2.273501] CPU: 0 UID: 0 PID: 1 Comm: sh Not tainted 7.4.0-rc2-00002-g8c7973a9cac1 #1 PREEMPT(full)
[ 2.273656] Hardware name: Foundation-v8A (DT)
[ 2.273734] Call trace:
[ 2.273793] show_stack+0x18/0x24 (C)
[ 2.273919] dump_stack_lvl+0x60/0x80
[ 2.274056] dump_stack+0x18/0x24
[ 2.274189] vpanic+0x168/0x354
[ 2.274318] do_panic_on_target_cpu+0x0/0x1c
[ 2.274458] kernel_init+0x120/0x150
[ 2.274611] ret_from_fork+0x10/0x20
[ 2.274755] SMP: stopping secondary CPUs
[ 2.274835] Kernel Offset: disabled
[ 2.274897] CPU features: 0x0,00000000,0030002e,fbb88b43,2edce72f
[ 2.274998] Memory Limit: none
[ 2.275065] ---[ end Kernel panic - not syncing: No working init found.
Try passing init= option to kernel. See Linux Documentation/admin-guide/init.rst for guidance. ]---
8<------------------------------------------------------------------------
Reduce ARCH_MMAP_RND_BITS_MAX from 27 to 23 for 42-bit VA configuration on
64K base page size, which ensures randomization range remains within total
available user space.
It follows (ARCH_MMAP_RND_BITS_MAX = VA_BITS - PAGE_SHIFT - 3), established
via the commit 8f0d3aa9de57 ("arm64: mm: support ARCH_MMAP_RND_BITS") which
got changed later in commit 51ecb29f7a65 ("arm64/mm: Define PTDESC_ORDER"),
rather erroneously. Revert back to that earlier comment but using the macro
PTDESC_ORDER instead.
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Ryan Roberts <ryan.roberts@arm.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Daniel Cashman <dcashman@google.com>
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
Fixes: 8f0d3aa9de57 ("arm64: mm: support ARCH_MMAP_RND_BITS")
Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
---
This patch is based on 7.4-rc5
Changes in V2:
- Changed ARCH_MMAP_RND_BITS_MAX from 24 to 23 for 42-bit VA
- Changed the in code comment for ARCH_MMAP_RND_BITS_MAX's formula
- Changed the commit message
Changes in V1:
https://lore.kernel.org/all/20261111042027.1541604-1-anshuman.khandual@arm.com/
arch/arm64/Kconfig | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index 9b08b2457a55..1c3599c9b26e 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -296,11 +296,11 @@ config ARCH_MMAP_RND_BITS_MIN
default 18
# max bits determined by the following formula:
-# VA_BITS - PTDESC_TABLE_SHIFT
+# VA_BITS - PAGE_SHIFT - PTDESC_ORDER
config ARCH_MMAP_RND_BITS_MAX
default 19 if ARM64_VA_BITS=36
default 24 if ARM64_VA_BITS=39
- default 27 if ARM64_VA_BITS=42
+ default 23 if ARM64_VA_BITS=42
default 30 if ARM64_VA_BITS=47
default 29 if (ARM64_VA_BITS=48 || ARM64_VA_BITS=52) && ARM64_64K_PAGES
default 31 if (ARM64_VA_BITS=48 || ARM64_VA_BITS=52) && ARM64_16K_PAGES
--
2.43.0
reply other threads:[~2026-12-01 3:48 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261201034834.700673-1-anshuman.khandual@arm.com \
--to=anshuman.khandual@arm.com \
--cc=akpm@linux-foundation.org \
--cc=catalin.marinas@arm.com \
--cc=dcashman@google.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=ryan.roberts@arm.com \
--cc=will@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®