mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: James Morris <jmorris@namei.org>
To: Stephen Smalley <sds@tycho.nsa.gov>
Cc: Eric Paris <eparis@redhat.com>, Alan Cox <alan@redhat.com>,
	linux-kernel@vger.kernel.org, selinux@tycho.nsa.gov,
	drepper@redhat.com, roland@redhat.com, arjan@infradead.org,
	mingo@elte.hu, viro@zeniv.linux.org.uk, chrisw@redhat.com,
	sgrubb@redhat.com
Subject: Re: [PATCH] Protection for exploiting null dereference using mmap
Date: Wed, 6 Jun 2007 14:01:47 -0400 (EDT)	[thread overview]
Message-ID: <Line.LNX.4.64.0706061400020.31665@d.namei> (raw)
In-Reply-To: <1181151040.3699.181.camel@moss-spartans.epoch.ncsc.mil>

On Wed, 6 Jun 2007, Stephen Smalley wrote:

> With the fix already noted by James,
> 
> Acked-by:  Stephen Smalley <sds@tycho.nsa.gov>

Final patch applied to:

git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/selinux-2.6.git#for-akpm


Also queued there is the following patch which enables the check in 
SELinux:


Subject: [PATCH] SELinux: enable minimum address checking for mmap

Enable enable minimum address checking for mmap if not already enabled, and
disable it on exit if we enabled it. Processes will then require the
new mmap_zero permission to override the check.  Set the default value to
64KB as suggested.  If already set, the existing value will be used.

Acked-by: Stephen Smalley <sds@tycho.nsa.gov>
Acked-by: Eric Paris <eparis@redhat.com>
Signed-off-by: James Morris <jmorris@namei.org>
---
 security/selinux/hooks.c |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
index 2b44832..9a8db0b 100644
--- a/security/selinux/hooks.c
+++ b/security/selinux/hooks.c
@@ -112,6 +112,9 @@ int selinux_enabled = 1;
 /* Original (dummy) security module. */
 static struct security_operations *original_ops = NULL;
 
+/* Did we enable minimum mmap address checking? */
+static int enabled_mmap_min_addr;
+
 /* Minimal support for a secondary security module,
    just to allow the use of the dummy or capability modules.
    The owlsm module can alternatively be used as a secondary
@@ -4912,6 +4915,16 @@ static __init int selinux_init(void)
 	sel_inode_cache = kmem_cache_create("selinux_inode_security",
 					    sizeof(struct inode_security_struct),
 					    0, SLAB_PANIC, NULL, NULL);
+
+	/*
+	 * Tasks cannot mmap below this without the mmap_zero permission.
+	 * If not enabled already, do so by setting it to 64KB.
+	 */
+	if (mmap_min_addr == 0) {
+		enabled_mmap_min_addr = 1;
+		mmap_min_addr = 65536;
+	}
+
 	avc_init();
 
 	original_ops = secondary_ops = security_ops;
@@ -5061,6 +5074,10 @@ int selinux_disable(void)
 
 	selinux_disabled = 1;
 	selinux_enabled = 0;
+	
+	/* Disable minimum mmap address check only if we enabled it */
+	if (enabled_mmap_min_addr)
+		mmap_min_addr = 0;
 
 	/* Reset security_ops to the secondary module, dummy or capability. */
 	security_ops = secondary_ops;
-- 
1.5.0.6


  reply	other threads:[~2007-06-06 18:02 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1180561713.3633.27.camel@dhcp231-215.rdu.redhat.com>
     [not found] ` <20070603205653.GE25869@devserv.devel.redhat.com>
     [not found]   ` <1180964306.14220.34.camel@moss-spartans.epoch.ncsc.mil>
2007-06-05 20:34     ` Eric Paris
2007-06-05 21:00       ` James Morris
2007-06-05 21:16         ` Alan Cox
2007-06-05 21:28           ` Eric Paris
2007-06-05 22:46             ` H. Peter Anvin
2007-06-07 14:28               ` Pavel Machek
2007-06-06 12:47             ` Stephen Smalley
2007-06-07 16:58               ` Jan Engelhardt
2007-06-06  6:30           ` Eric Paris
2007-06-06 13:21             ` James Morris
2007-06-06 17:30             ` Stephen Smalley
2007-06-06 18:01               ` James Morris [this message]
2007-06-06 18:06             ` Chris Wright
2007-06-20 19:48             ` Adam Jackson
2007-06-05 22:49       ` Chris Wright
2007-06-05 22:53       ` Chris Wright
2007-06-06 12:12         ` Stephen Smalley
2007-06-06  9:01       ` Russell Coker
2007-06-06 12:18         ` Stephen Smalley

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=Line.LNX.4.64.0706061400020.31665@d.namei \
    --to=jmorris@namei.org \
    --cc=alan@redhat.com \
    --cc=arjan@infradead.org \
    --cc=chrisw@redhat.com \
    --cc=drepper@redhat.com \
    --cc=eparis@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=roland@redhat.com \
    --cc=sds@tycho.nsa.gov \
    --cc=selinux@tycho.nsa.gov \
    --cc=sgrubb@redhat.com \
    --cc=viro@zeniv.linux.org.uk \
    /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

all inboxes | Powered by JetHome®