UPSTREAM: USB: qmi_wwan: Make forced int 4 whitelist generic
[cascardo/linux.git] / mm / mmap.c
index 848ef52..72c2d6f 100644 (file)
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -87,6 +87,7 @@ EXPORT_SYMBOL(vm_get_page_prot);
 int sysctl_overcommit_memory __read_mostly = OVERCOMMIT_GUESS;  /* heuristic overcommit */
 int sysctl_overcommit_ratio __read_mostly = 50;        /* default is 50% */
 int sysctl_max_map_count __read_mostly = DEFAULT_MAX_MAP_COUNT;
+int sysctl_mmap_noexec_taint __read_mostly = CONFIG_MMAP_NOEXEC_TAINT;
 /*
  * Make sure vm_committed_as in one cacheline and not cacheline shared with
  * other variables. It can be updated by several CPUs frequently.
@@ -1053,7 +1054,8 @@ static unsigned long do_mmap_pgoff(struct file *file, unsigned long addr,
                        if (file->f_path.mnt->mnt_flags & MNT_NOEXEC) {
                                if (vm_flags & VM_EXEC)
                                        return -EPERM;
-                               vm_flags &= ~VM_MAYEXEC;
+                               if (sysctl_mmap_noexec_taint)
+                                       vm_flags &= ~VM_MAYEXEC;
                        }
 
                        if (!file->f_op || !file->f_op->mmap)