summaryrefslogtreecommitdiff
path: root/mm/memory.c
diff options
context:
space:
mode:
authorJoel Granados <joel.granados@kernel.org>2025-04-30 14:42:13 +0200
committerJoel Granados <joel.granados@kernel.org>2025-07-23 11:52:47 +0200
commit851911aa7210ca27f007bd79553172e2e3ba8723 (patch)
treee13d6376a22e519b2a014786c83c38fab9deffed /mm/memory.c
parentfff6703fc843569d7a2f78ca08e7a69a9be22b0f (diff)
downloadlinux-851911aa7210ca27f007bd79553172e2e3ba8723.tar.gz
linux-851911aa7210ca27f007bd79553172e2e3ba8723.tar.bz2
linux-851911aa7210ca27f007bd79553172e2e3ba8723.zip
mm: move randomize_va_space into memory.c
Move the randomize_va_space variable together with all its sysctl table elements into memory.c. Register it to the "kernel" directory by adding it to the subsys initialization calls This is part of a greater effort to move ctl tables into their respective subsystems which will reduce the merge conflicts in kernel/sysctl.c. Reviewed-by: Luis Chamberlain <mcgrof@kernel.org> Reviewed-by: Kees Cook <kees@kernel.org> Signed-off-by: Joel Granados <joel.granados@kernel.org>
Diffstat (limited to 'mm/memory.c')
-rw-r--r--mm/memory.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/mm/memory.c b/mm/memory.c
index 8eba595056fe..f9e334fb9166 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -125,6 +125,24 @@ int randomize_va_space __read_mostly =
2;
#endif
+static const struct ctl_table mmu_sysctl_table[] = {
+ {
+ .procname = "randomize_va_space",
+ .data = &randomize_va_space,
+ .maxlen = sizeof(int),
+ .mode = 0644,
+ .proc_handler = proc_dointvec,
+ },
+};
+
+static int __init init_mm_sysctl(void)
+{
+ register_sysctl_init("kernel", mmu_sysctl_table);
+ return 0;
+}
+
+subsys_initcall(init_mm_sysctl);
+
#ifndef arch_wants_old_prefaulted_pte
static inline bool arch_wants_old_prefaulted_pte(void)
{