mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ulrich Drepper <drepper@redhat.com>
To: akpm@osdl.org, linux-kernel@vger.kernel.org, torvalds@osdl.org
Subject: [PATCH] close mprotect noexec hole
Date: Sun, 15 Oct 2006 14:34:11 -0400	[thread overview]
Message-ID: <200610151834.k9FIYBK5015809@devserv.devel.redhat.com> (raw)

The following patch closes the hole in mprotect discovered during
the noexec mount discussions.  Without this the protection is
incomplete and pretty much useless.  With it and additional techniques
like SELinux all holes can be plugged in a fine-grained way.

I think it should be in .19 since it's a security problem not to have
it.  Tested on x86-64.


Signed-off-by: Ulrich Drepper <drepper@redhat.com>

--- mm/mprotect.c	2006-10-01 09:35:14.000000000 -0700
+++ mm/mprotect.c-new	2006-10-11 14:54:55.000000000 -0700
@@ -251,6 +251,10 @@
 	error = -ENOMEM;
 	if (!vma)
 		goto out;
+	error = -EACCES;
+	if ((reqprot & PROT_EXEC) && vma->vm_file &&
+	    (vma->vm_file->f_vfsmnt->mnt_flags & MNT_NOEXEC))
+		goto out;
 	if (unlikely(grows & PROT_GROWSDOWN)) {
 		if (vma->vm_start >= end)
 			goto out;

             reply	other threads:[~2006-10-15 18:34 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-10-15 18:34 Ulrich Drepper [this message]
2006-10-15 18:47 ` Linus Torvalds
2006-10-15 19:14   ` Ulrich Drepper
2006-10-15 19:40     ` Linus Torvalds
2006-10-15 21:37       ` Ulrich Drepper
2006-10-15 19:17   ` privilege levels and kernel mode ranjith kumar
2006-10-15 19:24     ` bert hubert
2006-10-15 20:02     ` Jan Engelhardt
2006-10-15 23:02     ` Alan Cox

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=200610151834.k9FIYBK5015809@devserv.devel.redhat.com \
    --to=drepper@redhat.com \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@osdl.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

all inboxes | Powered by JetHome®