Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] arm64/mm: Limit ARCH_MMAP_RND_BITS_MAX to 24 for 42-bit VA
@ 2026-11-11  4:20 Anshuman Khandual
  2026-11-26 17:56 ` Catalin Marinas
  0 siblings, 1 reply; 2+ messages in thread
From: Anshuman Khandual @ 2026-11-11  4:20 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: Anshuman Khandual, Catalin Marinas, Will Deacon, Mark Rutland,
	Ryan Roberts, Andrew Morton, Daniel Cashman, linux-kernel

The existing ARCH_MMAP_RND_BITS_MAX value of 27 for 42-bit VA (64K) pgtable
configuration allows an mmap randomization range that exceeds the available
user space address space constraints.

This can cause mmap allocations to fail when the maximum randomization is
enabled. Although it does require CONFIG_EXPERT for ARCH_MMAP_RND_BITS to
take 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<------------------------------------------------------------------------

Although ARCH_MMAP_RND_BITS_MAX as 25 creates 2TB randomization range which
is well below total 4TB address range with VA_BITS = 42, it does not really
work and causes the following segmentation faults during boot.

8>------------------------------------------------------------------------
[    2.265866] Run /init as init process
Saving 256 bits of non-creditable seed for next boot
Starting syslogd: Segmentation fault
FAIL
Segmentation fault
Segmentation fault
Populating /dev using udev: Segmentation fault
FAIL
Segmentation fault
Starting crond: OK
crond[97]: crond (busybox 1.37.0) started, log level 8
8<------------------------------------------------------------------------

Reduce ARCH_MMAP_RND_BITS_MAX from 27 to 24 for 42-bit VA configuration on
64K base page size, which ensures randomization range remains within total
available user space.

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 applies on v7.4-rc2

 arch/arm64/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index 1075bc661833..8d8b1331178a 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -300,7 +300,7 @@ config ARCH_MMAP_RND_BITS_MIN
 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 24 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



^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-11-26 17:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-11  4:20 [PATCH] arm64/mm: Limit ARCH_MMAP_RND_BITS_MAX to 24 for 42-bit VA Anshuman Khandual
2026-11-26 17:56 ` Catalin Marinas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox