linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] 2.4.24-pre1 fix 'noexec' behaviour
@ 2003-12-13 12:23 Nuno Monteiro
  0 siblings, 0 replies; only message in thread
From: Nuno Monteiro @ 2003-12-13 12:23 UTC (permalink / raw)
  To: marcelo.tosatti; +Cc: linux-kernel


Hi Marcelo.


This patch submitted by Ullrich Drepper to 2.6 last week fixes the 
behaviour of 'noexec' mounted partitions. Up until now it was possible to 
circumvent the 'noexec' flag and run binaries off a 'noexec' partition by 
using ld-linux.so.2 or any other executable loader. This patch allows to 
properly honour the 'noexec' behaviour.

Please review and apply.


Regards,


		Nuno



--- linux-2.4.24-pre1/mm/mmap.c.orig	2003-12-13 11:52:56.943963096 +0000
+++ linux-2.4.24-pre1/mm/mmap.c	2003-12-13 11:55:37.674528336 +0000
@@ -14,6 +14,7 @@
 #include <linux/file.h>
 #include <linux/fs.h>
 #include <linux/personality.h>
+#include <linux/mount.h>
 
 #include <asm/uaccess.h>
 #include <asm/pgalloc.h>
@@ -400,8 +401,13 @@
 	int error;
 	rb_node_t ** rb_link, * rb_parent;
 
-	if (file && (!file->f_op || !file->f_op->mmap))
-		return -ENODEV;
+	if (file) {
+		if (!file->f_op || !file->f_op->mmap)
+			return -ENODEV;
+
+		if ((prot & PROT_EXEC) && (file->f_vfsmnt->mnt_flags & MNT_NOEXEC))
+			return -EPERM;
+	}
 
 	if (!len)
 		return addr;

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2003-12-13 18:48 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-12-13 12:23 [PATCH] 2.4.24-pre1 fix 'noexec' behaviour Nuno Monteiro

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).