Kernel Config to make randomize_va_space read-only.
Subsystems (2)
PATCH 1/1 Kernel Config to make randomize_va_space read-only.
From ba2ec52f170a8e69d6c44238bb578f9518a7e3b7 Mon Sep 17 00:00:00 2001
From: lanzheng <[email protected]>
Date: Tue, 23 Feb 2021 22:49:34 -0500
Subject: [PATCH] This patch adds a kernel build config knob that disallows
changes to the sysctl variable randomize_va_space.It makes harder for attacker to disable ASLR and reduces security risks.
--- kernel/sysctl.c | 4 ++++ security/Kconfig | 8 ++++++++ 2 files changed, 12 insertions(+)
kernel/sysctl.c +4 -0
@@ -2426,7 +2426,11 @@ static struct ctl_table kern_table[] = { .procname = "randomize_va_space", .data = &randomize_va_space, .maxlen = sizeof(int), +#if defined(CONFIG_RANDOMIZE_VA_SPACE_READONLY ) + .mode = 0444, +#else .mode = 0644, +#endif .proc_handler = proc_dointvec, },#endif
security/Kconfig +8 -0
@@ -7,6 +7,14 @@ menu "Security options" source "security/keys/Kconfig" +config RANDOMIZE_VA_SPACE_READONLY + bool "Disallow change of randomize_va_space" + default y + help + If you say Y here, /proc/sys/kernel/randomize_va_space can not + be changed by any user, including root, this will help prevent + disablement of ASLR. + config SECURITY_DMESG_RESTRICT bool "Restrict unprivileged access to the kernel syslog" default n
--
Quoted 3 lines · Lan Zheng (lanzheng)
From
ba2ec52f170a8e69d6c44238bb578f9518a7e3b7Mon Sep 17 00:00:00 2001
From: lanzheng <[email protected]>
Date: Tue, 23 Feb 2021 22:49:34 -0500
Why is this here?
Quoted 3 lines
Subject: [PATCH] This patch adds a kernel build config knob that disallows
changes to the sysctl variable randomize_va_space.It makes harder for attacker to disable ASLR and reduces security risks.
I think you need to read the documentation for how to write a good changelog text.
Quoted 30 lines
Signed-off-by lanzheng <[email protected]>Reviewed-by Yongkui Han <[email protected]>Tested-by Nirmala Arumugam <[email protected]>--- kernel/sysctl.c | 4 ++++ security/Kconfig | 8 ++++++++ 2 files changed, 12 insertions(+)kernel/sysctl.c +4
-0@@ -2426,7 +2426,11 @@ static struct ctl_table kern_table[] = { .procname = "randomize_va_space", .data = &randomize_va_space, .maxlen = sizeof(int), +#if defined(CONFIG_RANDOMIZE_VA_SPACE_READONLY ) + .mode = 0444, +#else .mode = 0644, +#endif .proc_handler = proc_dointvec, },#endif security/Kconfig +0
-0
security/Kconfig menu "Security options" · line 12
Quoted 6 lines
security/Kconfig +3
-0@@ -7,6 +7,14 @@ menu "Security options" source "security/keys/Kconfig" +config RANDOMIZE_VA_SPACE_READONLY + bool "Disallow change of randomize_va_space" + default y
This should only be "default y" if you can not boot here without this option.
But why is this even needed to be an option at all? What is causing this to be turned off? Can't you keep this from being changed by root through other means today?
thanks,
greg k-h