Commit 58392dbd authored by Ulrich Drepper's avatar Ulrich Drepper Committed by Linus Torvalds

[PATCH] Fix 'noexec' behaviour

We should not allow mmap() with PROT_EXEC on mounts marked "noexec",
since otherwise there is no way for user-supplied executable loaders
(like ld.so and emulator environments) to properly honour the
"noexec"ness of the target.
parent fcc13592
......@@ -19,6 +19,7 @@
#include <linux/hugetlb.h>
#include <linux/profile.h>
#include <linux/module.h>
#include <linux/mount.h>
#include <asm/uaccess.h>
#include <asm/pgalloc.h>
......@@ -477,6 +478,9 @@ unsigned long do_mmap_pgoff(struct file * file, unsigned long addr,
if (file && (!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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment