mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Nuno Monteiro <nuno@itsari.org>
To: marcelo.tosatti@cyclades.com
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] 2.4.24-pre1 fix 'noexec' behaviour
Date: Sat, 13 Dec 2003 12:23:46 +0000	[thread overview]
Message-ID: <20031213122346.GA1609@hobbes.netcabo.pt> (raw)


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;

                 reply	other threads:[~2003-12-13 18:48 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20031213122346.GA1609@hobbes.netcabo.pt \
    --to=nuno@itsari.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marcelo.tosatti@cyclades.com \
    /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®