kernel-hardening.lists.openwall.com archive mirror
 help / color / mirror / Atom feed
From: "Lan Zheng (lanzheng)" <lanzheng@cisco.com>
To: "security@kernel.org" <security@kernel.org>,
	Kees Cook <keescook@chromium.org>,
	"kernel-hardening@lists.openwall.com"
	<kernel-hardening@lists.openwall.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Cc: "Lan Zheng (lanzheng)" <lanzheng@cisco.com>
Subject: [PATCH v1 1/1] Kernel Config to make randomize_va_space read-only.
Date: Wed, 24 Feb 2021 03:53:37 +0000	[thread overview]
Message-ID: <99738B18-C4E2-4DBA-A142-8F20650D7ADC@cisco.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 1927 bytes --]

From ba2ec52f170a8e69d6c44238bb578f9518a7e3b7 Mon Sep 17 00:00:00 2001

From: lanzheng <lanzheng@cisco.com>

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.



Signed-off-by: lanzheng <lanzheng@cisco.com>

Reviewed-by: Yongkui Han <yonhan@cisco.com>

Tested-by: Nirmala Arumugam <niarumug@cisco.com>

---

 kernel/sysctl.c  | 4 ++++

 security/Kconfig | 8 ++++++++

 2 files changed, 12 insertions(+)



diff --git a/kernel/sysctl.c b/kernel/sysctl.c

index c9fbdd848138..2aa9bc8044c7 100644

--- a/kernel/sysctl.c

+++ b/kernel/sysctl.c

@@ -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

diff --git a/security/Kconfig b/security/Kconfig

index 7561f6f99f1d..18b9dff4648c 100644

--- a/security/Kconfig

+++ b/security/Kconfig

@@ -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

--


[-- Attachment #2: Type: text/html, Size: 8524 bytes --]

             reply	other threads:[~2021-02-24 14:07 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-24  3:53 Lan Zheng (lanzheng) [this message]
2021-02-24 14:11 ` [PATCH v1 1/1] Kernel Config to make randomize_va_space read-only Greg KH
2021-02-25  4:42 Lan Zheng (lanzheng)
2021-02-25 11:40 ` Greg KH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=99738B18-C4E2-4DBA-A142-8F20650D7ADC@cisco.com \
    --to=lanzheng@cisco.com \
    --cc=keescook@chromium.org \
    --cc=kernel-hardening@lists.openwall.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=security@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).