Skip to content

Commit 71a5849

Browse files
samitolvanenpalmer-dabbelt
authored andcommitted
mm: Change mmap_rnd_bits_max to __ro_after_init
Allow mmap_rnd_bits_max to be updated on architectures that determine virtual address space size at runtime instead of relying on Kconfig options by changing it from const to __ro_after_init. Signed-off-by: Sami Tolvanen <[email protected]> Reviewed-by: Kees Cook <[email protected]> Reviewed-by: Palmer Dabbelt <[email protected]> Acked-by: Palmer Dabbelt <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Palmer Dabbelt <[email protected]>
1 parent 6613476 commit 71a5849

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

include/linux/mm.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ extern int sysctl_legacy_va_layout;
8686

8787
#ifdef CONFIG_HAVE_ARCH_MMAP_RND_BITS
8888
extern const int mmap_rnd_bits_min;
89-
extern const int mmap_rnd_bits_max;
89+
extern int mmap_rnd_bits_max __ro_after_init;
9090
extern int mmap_rnd_bits __read_mostly;
9191
#endif
9292
#ifdef CONFIG_HAVE_ARCH_MMAP_RND_COMPAT_BITS

mm/mmap.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464

6565
#ifdef CONFIG_HAVE_ARCH_MMAP_RND_BITS
6666
const int mmap_rnd_bits_min = CONFIG_ARCH_MMAP_RND_BITS_MIN;
67-
const int mmap_rnd_bits_max = CONFIG_ARCH_MMAP_RND_BITS_MAX;
67+
int mmap_rnd_bits_max __ro_after_init = CONFIG_ARCH_MMAP_RND_BITS_MAX;
6868
int mmap_rnd_bits __read_mostly = CONFIG_ARCH_MMAP_RND_BITS;
6969
#endif
7070
#ifdef CONFIG_HAVE_ARCH_MMAP_RND_COMPAT_BITS

0 commit comments

Comments
 (0)