1 From 14d7c92f8df9c0964ae6f8b813c1b3ac38120825 Mon Sep 17 00:00:00 2001
2 From: Linus Torvalds <torvalds@linux-foundation.org>
3 Date: Mon, 17 Jun 2024 12:57:03 -0700
4 Subject: Revert "mm: mmap: allow for the maximum number of bits for randomizing mmap_base by default"
6 From: Linus Torvalds <torvalds@linux-foundation.org>
8 commit 14d7c92f8df9c0964ae6f8b813c1b3ac38120825 upstream.
10 This reverts commit 3afb76a66b5559a7b595155803ce23801558a7a9.
12 This was a wrongheaded workaround for an issue that had already been
13 fixed much better by commit 4ef9ad19e176 ("mm: huge_memory: don't force
14 huge page alignment on 32 bit").
16 Asking users questions at kernel compile time that they can't make sense
17 of is not a viable strategy. And the fact that even the kernel VM
18 maintainers apparently didn't catch that this "fix" is not a fix any
19 more pretty much proves the point that people can't be expected to
20 understand the implications of the question.
22 It may well be the case that we could improve things further, and that
23 __thp_get_unmapped_area() should take the mapping randomization into
24 account even for 64-bit kernels. Maybe we should not be so eager to use
27 But in no case should this be a kernel config option.
29 Cc: Rafael Aquini <aquini@redhat.com>
30 Cc: Andrew Morton <akpm@linux-foundation.org>
31 Cc: Jiri Slaby <jirislaby@kernel.org>
32 Cc: Suren Baghdasaryan <surenb@google.com>
33 Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
34 Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
35 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
37 arch/Kconfig | 12 ------------
38 1 file changed, 12 deletions(-)
42 @@ -1029,21 +1029,10 @@ config ARCH_MMAP_RND_BITS_MAX
43 config ARCH_MMAP_RND_BITS_DEFAULT
46 -config FORCE_MAX_MMAP_RND_BITS
47 - bool "Force maximum number of bits to use for ASLR of mmap base address"
50 - ARCH_MMAP_RND_BITS and ARCH_MMAP_RND_COMPAT_BITS represent the number
51 - of bits to use for ASLR and if no custom value is assigned (EXPERT)
52 - then the architecture's lower bound (minimum) value is assumed.
53 - This toggle changes that default assumption to assume the arch upper
54 - bound (maximum) value instead.
56 config ARCH_MMAP_RND_BITS
57 int "Number of bits to use for ASLR of mmap base address" if EXPERT
58 range ARCH_MMAP_RND_BITS_MIN ARCH_MMAP_RND_BITS_MAX
59 default ARCH_MMAP_RND_BITS_DEFAULT if ARCH_MMAP_RND_BITS_DEFAULT
60 - default ARCH_MMAP_RND_BITS_MAX if FORCE_MAX_MMAP_RND_BITS
61 default ARCH_MMAP_RND_BITS_MIN
62 depends on HAVE_ARCH_MMAP_RND_BITS
64 @@ -1078,7 +1067,6 @@ config ARCH_MMAP_RND_COMPAT_BITS
65 int "Number of bits to use for ASLR of mmap base address for compatible applications" if EXPERT
66 range ARCH_MMAP_RND_COMPAT_BITS_MIN ARCH_MMAP_RND_COMPAT_BITS_MAX
67 default ARCH_MMAP_RND_COMPAT_BITS_DEFAULT if ARCH_MMAP_RND_COMPAT_BITS_DEFAULT
68 - default ARCH_MMAP_RND_COMPAT_BITS_MAX if FORCE_MAX_MMAP_RND_BITS
69 default ARCH_MMAP_RND_COMPAT_BITS_MIN
70 depends on HAVE_ARCH_MMAP_RND_COMPAT_BITS