public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] close mprotect noexec hole
@ 2006-10-15 18:34 Ulrich Drepper
  2006-10-15 18:47 ` Linus Torvalds
  0 siblings, 1 reply; 9+ messages in thread
From: Ulrich Drepper @ 2006-10-15 18:34 UTC (permalink / raw)
  To: akpm, linux-kernel, torvalds

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;

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2006-10-15 22:35 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-10-15 18:34 [PATCH] close mprotect noexec hole Ulrich Drepper
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox