2.4.24-pre1 fix 'noexec' behaviour
Subsystems (2)
PATCH 1/1 2.4.24-pre1 fix 'noexec' behaviour
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
mm/mmap.c renamed from mm/mmap.c.orig +8 -2
@@ -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;